diff --git a/src/app/features/annotations/editorCtrl.js b/src/app/features/annotations/editorCtrl.js index b61dd6b05e4..39b072263fc 100644 --- a/src/app/features/annotations/editorCtrl.js +++ b/src/app/features/annotations/editorCtrl.js @@ -58,6 +58,7 @@ function (angular, _, $) { $scope.update = function() { $scope.reset(); $scope.editor.index = 0; + $scope.broadcastRefresh(); }; $scope.add = function() { @@ -65,12 +66,14 @@ function (angular, _, $) { $scope.reset(); $scope.editor.index = 0; $scope.updateSubmenuVisibility(); + $scope.broadcastRefresh(); }; $scope.removeAnnotation = function(annotation) { var index = _.indexOf($scope.annotations, annotation); $scope.annotations.splice(index, 1); $scope.updateSubmenuVisibility(); + $scope.broadcastRefresh(); }; }); diff --git a/src/app/features/annotations/partials/editor.html b/src/app/features/annotations/partials/editor.html index fc7d6225d3f..db56d08f940 100644 --- a/src/app/features/annotations/partials/editor.html +++ b/src/app/features/annotations/partials/editor.html @@ -10,7 +10,8 @@
- diff --git a/src/app/features/dashboard/dashboardCtrl.js b/src/app/features/dashboard/dashboardCtrl.js index facd5fada43..8ec13b24f2d 100644 --- a/src/app/features/dashboard/dashboardCtrl.js +++ b/src/app/features/dashboard/dashboardCtrl.js @@ -72,6 +72,10 @@ function (angular, $, config) { $scope.contextSrv.lightTheme = $scope.dashboard.style === 'light'; }; + $scope.broadcastRefresh = function() { + $rootScope.$broadcast('refresh'); + }; + $scope.add_row = function(dash, row) { dash.rows.push(row); }; diff --git a/src/app/features/dashboard/dashboardSrv.js b/src/app/features/dashboard/dashboardSrv.js index 8a41ddee5d8..ef33c211d04 100644 --- a/src/app/features/dashboard/dashboardSrv.js +++ b/src/app/features/dashboard/dashboardSrv.js @@ -10,7 +10,7 @@ function (angular, $, kbn, _, moment) { var module = angular.module('grafana.services'); - module.factory('dashboardSrv', function($rootScope) { + module.factory('dashboardSrv', function() { function DashboardModel (data) { @@ -132,10 +132,6 @@ function (angular, $, kbn, _, moment) { moment.utc(date).format(format); }; - p.emit_refresh = function() { - $rootScope.$broadcast('refresh'); - }; - p._updateSchema = function(old) { var i, j, k; var oldVersion = this.version; diff --git a/src/app/features/dashboard/keybindings.js b/src/app/features/dashboard/keybindings.js index 588155ee16c..d558b554ebf 100644 --- a/src/app/features/dashboard/keybindings.js +++ b/src/app/features/dashboard/keybindings.js @@ -40,7 +40,7 @@ function(angular, $) { keyboardManager.bind('ctrl+o', function() { var current = scope.dashboard.sharedCrosshair; scope.dashboard.sharedCrosshair = !current; - scope.dashboard.emit_refresh('refresh'); + scope.broadcastRefresh(); }, { inputDisabled: true }); keyboardManager.bind('ctrl+l', function() { @@ -57,7 +57,7 @@ function(angular, $) { }, { inputDisabled: true }); keyboardManager.bind('ctrl+r', function() { - scope.dashboard.emit_refresh(); + scope.broadcastRefresh(); }, { inputDisabled: true }); keyboardManager.bind('ctrl+z', function(evt) { diff --git a/src/app/features/dashboard/viewStateSrv.js b/src/app/features/dashboard/viewStateSrv.js index 289701c05fb..08f651f8d5b 100644 --- a/src/app/features/dashboard/viewStateSrv.js +++ b/src/app/features/dashboard/viewStateSrv.js @@ -115,7 +115,7 @@ function (angular, _, $) { $timeout(function() { if (self.oldTimeRange !== self.fullscreenPanel.range) { - self.$scope.dashboard.emit_refresh(); + self.$scope.broadcastRefresh(); } else { self.fullscreenPanel.$broadcast('render');