mirror of
https://github.com/valitydev/redash.git
synced 2024-11-06 17:15:17 +00:00
First page implemented (home)
This commit is contained in:
parent
4e0c9af18d
commit
da790de60d
@ -4,17 +4,14 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Redash</title>
|
||||
|
||||
<link rel="stylesheet" href="./assets/css/superflat_redash.css">
|
||||
<link rel="stylesheet" href="./assets/css/redash.css">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="./assets/images/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="./assets/images/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="./assets/images/favicon-16x16.png">
|
||||
</head>
|
||||
<body ng-app="app">
|
||||
<div class="container">
|
||||
<section>
|
||||
<app-header></app-header>
|
||||
<div ng-view></div>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -7,6 +7,9 @@ import ngResource from 'angular-resource';
|
||||
import uiBootstrap from 'angular-ui-bootstrap';
|
||||
import { each } from 'underscore';
|
||||
|
||||
import './assets/css/superflat_redash.css';
|
||||
import './assets/css/redash.css';
|
||||
|
||||
import * as pages from './pages';
|
||||
import * as components from './components';
|
||||
import * as filters from './filters';
|
||||
|
35
frontend/app/pages/home/home.html
Normal file
35
frontend/app/pages/home/home.html
Normal file
@ -0,0 +1,35 @@
|
||||
<div class="container">
|
||||
<div class="tile m-t-10 m-b-5">
|
||||
<div class="t-body p-5">
|
||||
<a href="queries/new" ng-show="$ctrl.canCreateQuery" class="btn btn-default">New Query</a>
|
||||
<button ng-show="$ctrl.canCreateDashboard" type="button" class="btn btn-default"
|
||||
data-toggle="modal" href="#new_dashboard_dialog">New Dashboard
|
||||
</button>
|
||||
<a href="alerts/new" class="btn btn-default">New Alert</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tile">
|
||||
<div class="t-body tb-padding">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<p class="f-500 m-b-20 c-black">Recent Dashboards</p>
|
||||
<div class="list-group">
|
||||
<a ng-href="dashboard/{{dashboard.slug}}" class="list-group-item" ng-repeat="dashboard in $ctrl.recentDashboards">
|
||||
{{dashboard.name}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<p class="f-500 m-b-20 c-black">Recent Queries</p>
|
||||
<div class="list-group">
|
||||
<a ng-href="queries/{{query.id}}" class="list-group-item"
|
||||
ng-repeat="query in $ctrl.recentQueries">{{query.name}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,13 +1,21 @@
|
||||
class HomeController {
|
||||
constructor(Dashboard) {
|
||||
console.log(Dashboard.query());
|
||||
}
|
||||
import template from './home.html';
|
||||
|
||||
function HomeCtrl($scope, currentUser, Events, Dashboard, Query) {
|
||||
Events.record(currentUser, 'view', 'page', 'personal_homepage');
|
||||
// $scope.$parent.pageTitle = 'Home';
|
||||
|
||||
// todo: maybe this should come from some serivce as we have this logic elsewhere.
|
||||
this.canCreateQuery = currentUser.hasPermission('create_query');
|
||||
this.canCreateDashboard = currentUser.hasPermission('create_dashboard');
|
||||
|
||||
this.recentQueries = Query.recent();
|
||||
this.recentDashboards = Dashboard.recent();
|
||||
}
|
||||
|
||||
export default function (ngModule) {
|
||||
ngModule.component('pageHome', {
|
||||
template: '<div>Home {{1923 | durationHumanize}} </div>',
|
||||
controller: HomeController,
|
||||
template,
|
||||
controller: HomeCtrl,
|
||||
});
|
||||
|
||||
return {
|
||||
|
30
frontend/app/services/events.js
Normal file
30
frontend/app/services/events.js
Normal file
@ -0,0 +1,30 @@
|
||||
import { debounce } from 'underscore';
|
||||
|
||||
function Events($http) {
|
||||
this.events = [];
|
||||
|
||||
this.post = debounce(() => {
|
||||
const events = this.events;
|
||||
this.events = [];
|
||||
|
||||
$http.post('api/events', events);
|
||||
}, 1000);
|
||||
|
||||
this.record = function record(user, action, objectType, objectId, additionalProperties) {
|
||||
const event = {
|
||||
user_id: user.id,
|
||||
action,
|
||||
object_type: objectType,
|
||||
object_id: objectId,
|
||||
timestamp: Date.now() / 1000.0,
|
||||
};
|
||||
Object.assign(event, additionalProperties);
|
||||
this.events.push(event);
|
||||
|
||||
this.post();
|
||||
};
|
||||
}
|
||||
|
||||
export default function (ngModule) {
|
||||
ngModule.service('Events', Events);
|
||||
}
|
@ -2,3 +2,4 @@ export { default as Dashboard } from './dashboard';
|
||||
export { default as Widget } from './widget';
|
||||
export { default as Query } from './query';
|
||||
export { default as QueryResult } from './query_result';
|
||||
export { default as Events } from './events';
|
||||
|
Loading…
Reference in New Issue
Block a user