@@ -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();
@@ -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);
@@ -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) {