diff --git a/src/app/controllers/dash.js b/src/app/controllers/dash.js index 4dd63be440b..b8bfae7ed54 100644 --- a/src/app/controllers/dash.js +++ b/src/app/controllers/dash.js @@ -61,14 +61,10 @@ function (angular, $, config, _) { $scope.filter = filterSrv; $scope.filter.init(dashboard.current); - $scope.$watch('dashboard.current', function(newValue) { - $scope.filter.init(newValue); + $rootScope.$on("dashboard-loaded", function(event, dashboard) { + $scope.filter.init(dashboard); }); - $scope.$watch('filter.time', function() { - $scope.dashboard.refresh(); - }, true); - // Clear existing alerts alertSrv.clearAll(); diff --git a/src/app/services/dashboard.js b/src/app/services/dashboard.js index 4f0ca8cee7c..4e269cc14b8 100644 --- a/src/app/services/dashboard.js +++ b/src/app/services/dashboard.js @@ -167,7 +167,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) { // Take out any that we're not allowed to add from the gui. self.availablePanels = _.difference(self.availablePanels,config.hidden_panels); - $rootScope.$emit('dashboard-loaded'); + $rootScope.$emit('dashboard-loaded', self.current); $timeout(function() { self.original = angular.copy(self.current); diff --git a/src/app/services/filterSrv.js b/src/app/services/filterSrv.js index 1734578c012..6ab96055419 100644 --- a/src/app/services/filterSrv.js +++ b/src/app/services/filterSrv.js @@ -55,17 +55,20 @@ define([ setTime: function(time) { _.extend(this.time, time); + // disable refresh if we have an absolute time if (time.to !== 'now') { this.old_refresh = this.dashboard.refresh; dashboard.set_interval(false); - return; } - - 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.old_refresh = null; } + + $timeout(function(){ + dashboard.refresh(); + },0); }, timeRange: function(parse) {