diff --git a/src/app/controllers/dash.js b/src/app/controllers/dash.js index f631550c3d9..ce2b3ebcfc3 100644 --- a/src/app/controllers/dash.js +++ b/src/app/controllers/dash.js @@ -31,21 +31,24 @@ function (angular, $, config, _) { var module = angular.module('kibana.controllers'); module.controller('DashCtrl', function( - $scope, $rootScope, dashboardKeybindings, filterSrv, dashboard, panelMoveSrv, alertSrv) { + $scope, $rootScope, dashboardKeybindings, filterSrv, dashboard, panelMoveSrv, alertSrv, timer) { $scope.editor = { index: 0 }; $scope.init = function() { - $scope.reset_row(); - dashboardKeybindings.shortcuts(); + $scope.availablePanels = config.panels; - // Clear existing alerts - alertSrv.clearAll(); + dashboardKeybindings.shortcuts(); $scope.onAppEvent('setup-dashboard', $scope.setupDashboard, $scope); }; $scope.setupDashboard = function(event, dashboardData) { + timer.cancel_all(); + alertSrv.clearAll(); + + $rootScope.fullscreen = false; + $scope.dashboard = dashboard.create(dashboardData); $scope.filter = filterSrv; $scope.filter.init($scope.dashboard); @@ -58,6 +61,8 @@ function (angular, $, config, _) { $scope.panelMoveOver = panelMove.onOver; $scope.panelMoveOut = panelMove.onOut; + window.document.title = 'Grafana - ' + $scope.dashboard.title; + $scope.emitAppEvent("dashboard-loaded", $scope.dashboard); }; diff --git a/src/app/partials/roweditor.html b/src/app/partials/roweditor.html index 8a0032aca6b..b55536e893d 100644 --- a/src/app/partials/roweditor.html +++ b/src/app/partials/roweditor.html @@ -48,7 +48,7 @@

Select Panel Type

- + Note: This row is full, new panels will wrap to a new line. You should add another row. diff --git a/src/app/services/dashboard.js b/src/app/services/dashboard.js index 19ae6f2c59a..23e4ddfc388 100644 --- a/src/app/services/dashboard.js +++ b/src/app/services/dashboard.js @@ -16,6 +16,7 @@ function (angular, $, kbn, _) { module.service('dashboard', function(timer, $rootScope, $timeout) { function DashboardModel (data) { + if (!data) { data = {}; } @@ -77,18 +78,22 @@ function (angular, $, kbn, _) { if (interval) { var _i = kbn.interval_to_ms(interval); timer.cancel(this.refresh_timer); - var dashboard_reference = this; + var self = this; this.refresh_timer = timer.register($timeout(function() { - dashboard_reference.set_interval(interval); - dashboard_reference.full_refresh(); + self.set_interval(interval); + self.emit_refresh(); },_i)); - this.full_refresh(); + this.emit_refresh(); } else { timer.cancel(this.refresh_timer); } }; + // An elasticJS client to use + /*var ejs = ejsResource(config.elasticsearch, config.elasticsearchBasicAuth); + var gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/; +*/ return { create: function(dashboard) { return new DashboardModel(dashboard);