Commit 79404e75 by Torkel Ödegaard

started on some big refactoring of how the app starts and how dashboard object…

started on some big refactoring of how the app starts and how dashboard object is loaded, created. This should make it easier to add other dashboard storage backends and other views
parent 92318d58
...@@ -6,15 +6,16 @@ define([ ...@@ -6,15 +6,16 @@ define([
'jquery', 'jquery',
'underscore', 'underscore',
'require', 'require',
'config',
'elasticjs', 'elasticjs',
'bootstrap', 'bootstrap',
'angular-sanitize', 'angular-sanitize',
'angular-strap', 'angular-strap',
'angular-dragdrop', 'angular-dragdrop',
'extend-jquery', 'extend-jquery',
'bindonce' 'bindonce',
], ],
function (angular, $, _, appLevelRequire) { function (angular, $, _, appLevelRequire, config) {
"use strict"; "use strict";
...@@ -67,19 +68,7 @@ function (angular, $, _, appLevelRequire) { ...@@ -67,19 +68,7 @@ function (angular, $, _, appLevelRequire) {
app.config(function ($routeProvider, $controllerProvider, $compileProvider, $filterProvider, $provide) { app.config(function ($routeProvider, $controllerProvider, $compileProvider, $filterProvider, $provide) {
$routeProvider $routeProvider.otherwise({ redirectTo: config.default_route });
.when('/dashboard', {
templateUrl: 'app/partials/dashboard.html',
})
.when('/dashboard/:kbnType/:kbnId', {
templateUrl: 'app/partials/dashboard.html',
})
.when('/dashboard/:kbnType/:kbnId/:params', {
templateUrl: 'app/partials/dashboard.html'
})
.otherwise({
redirectTo: 'dashboard'
});
// this is how the internet told me to dynamically add modules :/ // this is how the internet told me to dynamically add modules :/
register_fns.controller = $controllerProvider.register; register_fns.controller = $controllerProvider.register;
...@@ -98,7 +87,7 @@ function (angular, $, _, appLevelRequire) { ...@@ -98,7 +87,7 @@ function (angular, $, _, appLevelRequire) {
'pasvaz.bindonce' 'pasvaz.bindonce'
]; ];
var module_types = ['controllers', 'directives', 'factories', 'services', 'services.dashboard', 'filters']; var module_types = ['controllers', 'directives', 'factories', 'services', 'filters', 'routes'];
_.each(module_types, function (type) { _.each(module_types, function (type) {
var module_name = 'kibana.'+type; var module_name = 'kibana.'+type;
...@@ -120,6 +109,7 @@ function (angular, $, _, appLevelRequire) { ...@@ -120,6 +109,7 @@ function (angular, $, _, appLevelRequire) {
'directives/all', 'directives/all',
'filters/all', 'filters/all',
'components/partials', 'components/partials',
'routes/dashboard-loader',
], function () { ], function () {
// bootstrap the app // bootstrap the app
......
...@@ -31,11 +31,9 @@ function (angular, $, config, _) { ...@@ -31,11 +31,9 @@ function (angular, $, config, _) {
var module = angular.module('kibana.controllers'); var module = angular.module('kibana.controllers');
module.controller('DashCtrl', function( module.controller('DashCtrl', function(
$scope, $rootScope, $timeout, ejsResource, dashboard, filterSrv, dashboardKeybindings, $scope, $rootScope, $timeout, ejsResource, filterSrv, dashboardKeybindings,
alertSrv, panelMove, keyboardManager, grafanaVersion) { alertSrv, panelMove, keyboardManager, grafanaVersion) {
$scope.requiredElasticSearchVersion = ">=0.90.3";
$scope.editor = { $scope.editor = {
index: 0 index: 0
}; };
...@@ -54,16 +52,8 @@ function (angular, $, config, _) { ...@@ -54,16 +52,8 @@ function (angular, $, config, _) {
// Make stuff, including underscore.js available to views // Make stuff, including underscore.js available to views
$scope._ = _; $scope._ = _;
$scope.dashboard = dashboard;
$scope.dashAlerts = alertSrv; $scope.dashAlerts = alertSrv;
$scope.filter = filterSrv;
$scope.filter.init(dashboard.current);
$rootScope.$on("dashboard-loaded", function(event, dashboard) {
$scope.filter.init(dashboard);
});
// Clear existing alerts // Clear existing alerts
alertSrv.clearAll(); alertSrv.clearAll();
......
...@@ -8,8 +8,7 @@ function (angular, _, moment) { ...@@ -8,8 +8,7 @@ function (angular, _, moment) {
var module = angular.module('kibana.controllers'); var module = angular.module('kibana.controllers');
module.controller('dashLoader', function($scope, $rootScope, $http, dashboard, alertSrv, $location, playlistSrv) { module.controller('dashLoader', function($scope, $rootScope, $http, alertSrv, $location, playlistSrv) {
$scope.loader = dashboard.current.loader;
$scope.init = function() { $scope.init = function() {
$scope.gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/; $scope.gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/;
...@@ -23,6 +22,10 @@ function (angular, _, moment) { ...@@ -23,6 +22,10 @@ function (angular, _, moment) {
$rootScope.$on('zoom-out', function() { $rootScope.$on('zoom-out', function() {
$scope.zoom(2); $scope.zoom(2);
}); });
$rootScope.$on('dashboard-loaded', function(event, dashboard) {
$scope.loader = dashboard.loader;
});
}; };
$scope.exitFullscreen = function() { $scope.exitFullscreen = function() {
...@@ -30,11 +33,11 @@ function (angular, _, moment) { ...@@ -30,11 +33,11 @@ function (angular, _, moment) {
}; };
$scope.showDropdown = function(type) { $scope.showDropdown = function(type) {
if(_.isUndefined(dashboard.current.loader)) { if(_.isUndefined($scope.loader)) {
return true; return true;
} }
var _l = dashboard.current.loader; var _l = $scope.loader;
if(type === 'load') { if(type === 'load') {
return (_l.load_elasticsearch || _l.load_gist || _l.load_local); return (_l.load_elasticsearch || _l.load_gist || _l.load_local);
} }
...@@ -129,7 +132,7 @@ function (angular, _, moment) { ...@@ -129,7 +132,7 @@ function (angular, _, moment) {
// function $scope.zoom // function $scope.zoom
// factor :: Zoom factor, so 0.5 = cuts timespan in half, 2 doubles timespan // factor :: Zoom factor, so 0.5 = cuts timespan in half, 2 doubles timespan
$scope.zoom = function(factor) { $scope.zoom = function(factor) {
var _range = this.filter.timeRange(); var _range = $scope.filter.timeRange();
var _timespan = (_range.to.valueOf() - _range.from.valueOf()); var _timespan = (_range.to.valueOf() - _range.from.valueOf());
var _center = _range.to.valueOf() - _timespan/2; var _center = _range.to.valueOf() - _timespan/2;
...@@ -143,7 +146,7 @@ function (angular, _, moment) { ...@@ -143,7 +146,7 @@ function (angular, _, moment) {
_to = Date.now(); _to = Date.now();
} }
this.filter.setTime({ $scope.filter.setTime({
from:moment.utc(_from).toDate(), from:moment.utc(_from).toDate(),
to:moment.utc(_to).toDate(), to:moment.utc(_to).toDate(),
}); });
......
...@@ -15,8 +15,12 @@ function (angular, app, _) { ...@@ -15,8 +15,12 @@ function (angular, app, _) {
var lastPulldownVal; var lastPulldownVal;
var lastHideControlsVal; var lastHideControlsVal;
$scope.$watch('dashboard.current.pulldowns', function() { $scope.$watch('dashboard.pulldowns', function() {
var panel = _.find($scope.dashboard.current.pulldowns, function(pulldown) { return pulldown.enable; }); if (!$scope.dashboard) {
return;
}
var panel = _.find($scope.dashboard.pulldowns, function(pulldown) { return pulldown.enable; });
var panelEnabled = panel ? panel.enable : false; var panelEnabled = panel ? panel.enable : false;
if (lastPulldownVal !== panelEnabled) { if (lastPulldownVal !== panelEnabled) {
elem.toggleClass('submenu-controls-visible', panelEnabled); elem.toggleClass('submenu-controls-visible', panelEnabled);
...@@ -24,8 +28,12 @@ function (angular, app, _) { ...@@ -24,8 +28,12 @@ function (angular, app, _) {
} }
}, true); }, true);
$scope.$watch('dashboard.current.hideControls', function() { $scope.$watch('dashboard.hideControls', function() {
var hideControls = $scope.dashboard.current.hideControls || $scope.playlist_active; if (!$scope.dashboard) {
return;
}
var hideControls = $scope.dashboard.hideControls || $scope.playlist_active;
if (lastHideControlsVal !== hideControls) { if (lastHideControlsVal !== hideControls) {
elem.toggleClass('hide-controls', hideControls); elem.toggleClass('hide-controls', hideControls);
......
...@@ -10,13 +10,14 @@ function (angular, $, kbn, moment, _) { ...@@ -10,13 +10,14 @@ function (angular, $, kbn, moment, _) {
var module = angular.module('kibana.directives'); var module = angular.module('kibana.directives');
module.directive('grafanaGraph', function($rootScope, dashboard) { module.directive('grafanaGraph', function($rootScope) {
return { return {
restrict: 'A', restrict: 'A',
template: '<div> </div>', template: '<div> </div>',
link: function(scope, elem) { link: function(scope, elem) {
var data, plot, annotations; var data, plot, annotations;
var hiddenData = {}; var hiddenData = {};
var dashboard = scope.dashboard;
scope.$on('refresh',function() { scope.$on('refresh',function() {
if (scope.otherPanelInFullscreenMode()) { return; } if (scope.otherPanelInFullscreenMode()) { return; }
...@@ -172,7 +173,7 @@ function (angular, $, kbn, moment, _) { ...@@ -172,7 +173,7 @@ function (angular, $, kbn, moment, _) {
var max = _.isUndefined(scope.range.to) ? null : scope.range.to.getTime(); var max = _.isUndefined(scope.range.to) ? null : scope.range.to.getTime();
options.xaxis = { options.xaxis = {
timezone: dashboard.current.timezone, timezone: dashboard.timezone,
show: scope.panel['x-axis'], show: scope.panel['x-axis'],
mode: "time", mode: "time",
min: min, min: min,
...@@ -329,7 +330,7 @@ function (angular, $, kbn, moment, _) { ...@@ -329,7 +330,7 @@ function (angular, $, kbn, moment, _) {
value = kbn.getFormatFunction(format, 2)(value); value = kbn.getFormatFunction(format, 2)(value);
timestamp = dashboard.current.timezone === 'browser' ? timestamp = dashboard.timezone === 'browser' ?
moment(item.datapoint[0]).format('YYYY-MM-DD HH:mm:ss') : moment(item.datapoint[0]).format('YYYY-MM-DD HH:mm:ss') :
moment.utc(item.datapoint[0]).format('YYYY-MM-DD HH:mm:ss'); moment.utc(item.datapoint[0]).format('YYYY-MM-DD HH:mm:ss');
$tooltip $tooltip
......
...@@ -259,10 +259,11 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -259,10 +259,11 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
targets: $scope.panel.targets, targets: $scope.panel.targets,
format: $scope.panel.renderer === 'png' ? 'png' : 'json', format: $scope.panel.renderer === 'png' ? 'png' : 'json',
maxDataPoints: $scope.resolution, maxDataPoints: $scope.resolution,
datasource: $scope.panel.datasource datasource: $scope.panel.datasource,
timezone: $scope.dashboard.timezone
}; };
$scope.annotationsPromise = annotationsSrv.getAnnotations($scope.filter, $scope.rangeUnparsed); $scope.annotationsPromise = annotationsSrv.getAnnotations($scope.filter, $scope.rangeUnparsed, $scope.dashboard);
return $scope.datasource.query($scope.filter, graphiteQuery) return $scope.datasource.query($scope.filter, graphiteQuery)
.then($scope.dataHandler) .then($scope.dataHandler)
......
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<span class="brand"><img src="img/small.png" bs-tooltip="'Grafana'" data-placement="bottom"> {{dashboard.title}}</span>
<ul class="nav pull-right" ng-controller='dashLoader' ng-init="init()" ng-include="'app/partials/dashLoader.html'">
</ul>
</div>
</div>
</div>
<div class="submenu-controls"> <div class="submenu-controls">
<div class="submenu-panel" ng-controller="SubmenuCtrl" ng-repeat="pulldown in dashboard.current.pulldowns | filter:{ enable: true }"> <div class="submenu-panel" ng-controller="SubmenuCtrl" ng-repeat="pulldown in dashboard.pulldowns | filter:{ enable: true }">
<div class="submenu-panel-title"> <div class="submenu-panel-title">
<span class="small"><strong>{{pulldown.type}}:</strong></span> <span class="small"><strong>{{pulldown.type}}:</strong></span>
</div> </div>
...@@ -15,7 +25,7 @@ ...@@ -15,7 +25,7 @@
<div> <div>
<div class="grafana-container container"> <div class="grafana-container container">
<!-- Rows --> <!-- Rows -->
<div class="kibana-row" ng-controller="RowCtrl" ng-repeat="(row_name, row) in dashboard.current.rows" ng-style="row_style(row)"> <div class="kibana-row" ng-controller="RowCtrl" ng-repeat="(row_name, row) in dashboard.rows" ng-style="row_style(row)">
<div class="row-control"> <div class="row-control">
<div class="grafana-row" style="padding:0px;margin:0px;position:relative;"> <div class="grafana-row" style="padding:0px;margin:0px;position:relative;">
<div class="row-close" ng-show="row.collapse" data-placement="bottom" > <div class="row-close" ng-show="row.collapse" data-placement="bottom" >
...@@ -97,7 +107,7 @@ ...@@ -97,7 +107,7 @@
</div> </div>
</div> </div>
<div ng-show='dashboard.current.editable && dashboard.current.panel_hints' class="row-fluid add-row-panel-hint"> <div ng-show='dashboard.editable && dashboard.current.panel_hints' class="row-fluid add-row-panel-hint">
<div class="span12" style="text-align:right;"> <div class="span12" style="text-align:right;">
<span style="margin-right: 10px;" ng-click="add_row_default()" class="pointer btn btn-info btn-mini"> <span style="margin-right: 10px;" ng-click="add_row_default()" class="pointer btn btn-info btn-mini">
<span><i class="icon-plus-sign"></i> ADD A ROW</span> <span><i class="icon-plus-sign"></i> ADD A ROW</span>
......
define([
'angular',
'jquery',
'config',
'underscore'
],
function (angular, $, config, _) {
"use strict";
var module = angular.module('kibana.routes');
module.config(function($routeProvider) {
$routeProvider
.when('/dashboard/file/:jsonFile', {
templateUrl: 'app/partials/dashboard.html',
controller : 'DashFromFileProvider',
});
});
module.controller('DashFromFileProvider', function($scope, $rootScope, $http, $routeParams, alertSrv, dashboard, filterSrv) {
$scope.init = function() {
console.log('DashFromFileProvider->init()')
file_load($routeParams.jsonFile)
.then(function(data) {
$scope.dashboard = dashboard.create(data);
$scope.filter = filterSrv;
$scope.filter.init($scope.dashboard);
$rootScope.$emit("dashboard-loaded", $scope.dashboard);
});
};
var renderTemplate = function(json,params) {
var _r;
_.templateSettings = {interpolate : /\{\{(.+?)\}\}/g};
var template = _.template(json);
var rendered = template({ARGS:params});
try {
_r = angular.fromJson(rendered);
} catch(e) {
_r = false;
}
return _r;
};
var file_load = function(file) {
return $http({
url: "app/dashboards/"+file.replace(/\.(?!json)/,"/")+'?' + new Date().getTime(),
method: "GET",
transformResponse: function(response) {
return renderTemplate(response,$routeParams);
}
}).then(function(result) {
if(!result) {
return false;
}
return result.data;
},function() {
alertSrv.set('Error',"Could not load <i>dashboards/"+file+"</i>. Please make sure it exists" ,'error');
return false;
});
};
$scope.init();
});
});
...@@ -7,20 +7,12 @@ define([ ...@@ -7,20 +7,12 @@ define([
var module = angular.module('kibana.services'); var module = angular.module('kibana.services');
module.service('annotationsSrv', function(dashboard, datasourceSrv, $q, alertSrv, $rootScope) { module.service('annotationsSrv', function(datasourceSrv, $q, alertSrv, $rootScope) {
var promiseCached; var promiseCached;
var annotationPanel;
var list = []; var list = [];
this.init = function() { this.init = function() {
$rootScope.$on('refresh', this.clearCache); $rootScope.$on('refresh', this.clearCache);
$rootScope.$on('dashboard-loaded', this.dashboardLoaded);
this.dashboardLoaded();
};
this.dashboardLoaded = function () {
annotationPanel = _.findWhere(dashboard.current.pulldowns, { type: 'annotations' });
}; };
this.clearCache = function() { this.clearCache = function() {
...@@ -28,7 +20,8 @@ define([ ...@@ -28,7 +20,8 @@ define([
list = []; list = [];
}; };
this.getAnnotations = function(filterSrv, rangeUnparsed) { this.getAnnotations = function(filterSrv, rangeUnparsed, dashboard) {
var annotationPanel = _.findWhere(dashboard.pulldowns, { type: 'annotations' });
if (!annotationPanel.enable) { if (!annotationPanel.enable) {
return $q.when(null); return $q.when(null);
} }
......
...@@ -8,33 +8,28 @@ define([ ...@@ -8,33 +8,28 @@ define([
'modernizr', 'modernizr',
'filesaver' 'filesaver'
], ],
function (angular, $, kbn, _, config, moment, Modernizr) { function (angular, $, kbn, _) {
'use strict'; 'use strict';
var module = angular.module('kibana.services'); var module = angular.module('kibana.services');
module.service('dashboard', function( module.service('dashboard', function(timer, $rootScope) {
$routeParams, $http, $rootScope, $injector, $location, $timeout,
ejsResource, timer, alertSrv, $q function DashboardModel (data) {
) { this.title = data.title;
// A hash of defaults to use when loading a dashboard this.tags = data.tags || [];
this.style = data.style || "dark";
var _dash = { this.timezone = data.browser || 'browser';
title: "", this.editable = data.editble || true;
tags: [], this.rows = data.rows || [];
style: "dark", this.pulldowns = data.pulldowns || [];
timezone: 'browser', this.nav = data.nav || [];
editable: true, this.services = data.services || {};
failover: false, this.loader = data.loader;
panel_hints: true,
rows: [], _.defaults(this.loader, {
pulldowns: [{ type: 'templating' }, { type: 'annotations' }],
nav: [{ type: 'timepicker' }],
services: {},
loader: {
save_gist: false, save_gist: false,
save_elasticsearch: true, save_elasticsearch: true,
save_local: true,
save_default: true, save_default: true,
save_temp: true, save_temp: true,
save_temp_ttl_enable: true, save_temp_ttl_enable: true,
...@@ -42,10 +37,64 @@ function (angular, $, kbn, _, config, moment, Modernizr) { ...@@ -42,10 +37,64 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
load_gist: false, load_gist: false,
load_elasticsearch: true, load_elasticsearch: true,
load_elasticsearch_size: 20, load_elasticsearch_size: 20,
load_local: false,
hide: false hide: false
}, });
refresh: false
if (this.nav.length === 0) {
this.nav.push({ type: 'timepicker' });
}
if (!_.findWhere(this.pulldowns, {type: 'filtering'})) {
this.pulldowns.push({ type: 'filtering', enable: false });
}
if (!_.findWhere(this.pulldowns, {type: 'annotations'})) {
this.pulldowns.push({ type: 'annotations', enable: false });
}
_.each(this.rows, function(row) {
_.each(row.panels, function(panel) {
if (panel.type === 'graphite') {
panel.type = 'graph';
}
});
});
}
var p = DashboardModel.prototype;
p.refresh = function() {
$rootScope.$broadcast('refresh');
};
p.set_interval = function(interval) {
this.refresh = interval;
if (interval) {
var _i = kbn.interval_to_ms(interval);
timer.cancel(this.refresh_timer);
var dashboard_reference = this;
this.refresh_timer = timer.register($timeout(function() {
dashboard_reference.set_interval(interval);
dashboard_reference.full_refresh();
},_i));
this.full_refresh();
} else {
timer.cancel(this.refresh_timer);
}
};
return {
create: function(dashboard) {
return new DashboardModel(dashboard);
}
};
/*// A hash of defaults to use when loading a dashboard
var _dash = {
}; };
// An elasticJS client to use // An elasticJS client to use
...@@ -326,6 +375,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) { ...@@ -326,6 +375,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
}) })
.then(function(result) { .then(function(result) {
/*jshint -W054 */ /*jshint -W054 */
/*
var script_func = new Function('ARGS','kbn','_','moment','window','document','$','jQuery', result.data); var script_func = new Function('ARGS','kbn','_','moment','window','document','$','jQuery', result.data);
var script_result = script_func($routeParams,kbn,_,moment, window, document, $, $); var script_result = script_func($routeParams,kbn,_,moment, window, document, $, $);
...@@ -459,6 +509,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) { ...@@ -459,6 +509,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
timer.cancel(self.refresh_timer); timer.cancel(self.refresh_timer);
} }
}; };
}); */
});
}); });
...@@ -6,7 +6,7 @@ define([ ...@@ -6,7 +6,7 @@ define([
function(angular, $) { function(angular, $) {
"use strict"; "use strict";
var module = angular.module('kibana.services.dashboard'); var module = angular.module('kibana.services');
module.service('dashboardKeybindings', function($rootScope, keyboardManager, dashboard) { module.service('dashboardKeybindings', function($rootScope, keyboardManager, dashboard) {
this.shortcuts = function() { this.shortcuts = function() {
......
...@@ -8,7 +8,7 @@ define([ ...@@ -8,7 +8,7 @@ define([
var module = angular.module('kibana.services'); var module = angular.module('kibana.services');
module.factory('filterSrv', function(dashboard, $rootScope, $timeout, $routeParams) { module.factory('filterSrv', function($rootScope, $timeout, $routeParams) {
// defaults // defaults
var _d = { var _d = {
templateParameters: [], templateParameters: [],
...@@ -53,16 +53,14 @@ define([ ...@@ -53,16 +53,14 @@ define([
// disable refresh if we have an absolute time // disable refresh if we have an absolute time
if (time.to !== 'now') { if (time.to !== 'now') {
this.old_refresh = this.dashboard.refresh; this.old_refresh = this.dashboard.refresh;
dashboard.set_interval(false); this.dashboard.set_interval(false);
} }
else if (this.old_refresh && this.old_refresh !== this.dashboard.refresh) { else if (this.old_refresh && this.old_refresh !== this.dashboard.refresh) {
dashboard.set_interval(this.old_refresh); this.dashboard.set_interval(this.old_refresh);
this.old_refresh = null; this.old_refresh = null;
} }
$timeout(function() { $timeout(this.dashboard.refresh, 0);
dashboard.refresh();
},0);
}, },
timeRange: function(parse) { timeRange: function(parse) {
......
...@@ -11,7 +11,7 @@ function (angular, _, $, config, kbn, moment) { ...@@ -11,7 +11,7 @@ function (angular, _, $, config, kbn, moment) {
var module = angular.module('kibana.services'); var module = angular.module('kibana.services');
module.factory('GraphiteDatasource', function(dashboard, $q, $http) { module.factory('GraphiteDatasource', function($q, $http) {
function GraphiteDatasource(datasource) { function GraphiteDatasource(datasource) {
this.type = 'graphite'; this.type = 'graphite';
...@@ -25,8 +25,8 @@ function (angular, _, $, config, kbn, moment) { ...@@ -25,8 +25,8 @@ function (angular, _, $, config, kbn, moment) {
GraphiteDatasource.prototype.query = function(filterSrv, options) { GraphiteDatasource.prototype.query = function(filterSrv, options) {
try { try {
var graphOptions = { var graphOptions = {
from: this.translateTime(options.range.from, 'round-down'), from: this.translateTime(options.range.from, options.timezone, 'round-down'),
until: this.translateTime(options.range.to, 'round-up'), until: this.translateTime(options.range.to, options.timezone, 'round-up'),
targets: options.targets, targets: options.targets,
format: options.format, format: options.format,
maxDataPoints: options.maxDataPoints, maxDataPoints: options.maxDataPoints,
...@@ -72,7 +72,7 @@ function (angular, _, $, config, kbn, moment) { ...@@ -72,7 +72,7 @@ function (angular, _, $, config, kbn, moment) {
} }
}; };
GraphiteDatasource.prototype.translateTime = function(date, rounding) { GraphiteDatasource.prototype.translateTime = function(date, timezone, rounding) {
if (_.isString(date)) { if (_.isString(date)) {
if (date === 'now') { if (date === 'now') {
return 'now'; return 'now';
...@@ -104,7 +104,7 @@ function (angular, _, $, config, kbn, moment) { ...@@ -104,7 +104,7 @@ function (angular, _, $, config, kbn, moment) {
} }
} }
if (dashboard.current.timezone === 'browser') { if (timezone === 'browser') {
date = date.local(); date = date.local();
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<body ng-cloak body-class> <body ng-cloak body-class>
<link rel="stylesheet" href="css/bootstrap.light.min.css" ng-if="dashboard.current.style === 'light'"> <link rel="stylesheet" href="css/bootstrap.light.min.css" ng-if="dashboard.style === 'light'">
<link rel="stylesheet" href="css/bootstrap-responsive.min.css"> <link rel="stylesheet" href="css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css"> <link rel="stylesheet" href="css/font-awesome.min.css">
...@@ -28,15 +28,6 @@ ...@@ -28,15 +28,6 @@
<button type="button" class="close" ng-click="dashAlerts.clear(alert)" style="padding-right:50px">&times;</button> <button type="button" class="close" ng-click="dashAlerts.clear(alert)" style="padding-right:50px">&times;</button>
<strong>{{alert.title}}</strong> <span ng-bind-html='alert.text'></span> <div style="padding-right:10px" class='pull-right small'> {{$index + 1}} alert(s) </div> <strong>{{alert.title}}</strong> <span ng-bind-html='alert.text'></span> <div style="padding-right:10px" class='pull-right small'> {{$index + 1}} alert(s) </div>
</div> </div>
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<span class="brand"><img src="img/small.png" bs-tooltip="'Grafana'" data-placement="bottom"> {{dashboard.current.title}}</span>
<ul class="nav pull-right" ng-controller='dashLoader' ng-init="init()" ng-include="'app/partials/dashLoader.html'">
</ul>
</div>
</div>
</div>
<div ng-view ng-class="{'dashboard-fullscreen': fullscreen}"></div> <div ng-view ng-class="{'dashboard-fullscreen': fullscreen}"></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment