filterSrv refactoring fixes

This commit is contained in:
Torkel Ödegaard 2014-05-27 16:39:16 +02:00
parent 3e24a87ead
commit 9f548b9dee
3 changed files with 9 additions and 10 deletions

View File

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

View File

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

View File

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