mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
filterSrv refactoring fixes
This commit is contained in:
parent
3e24a87ead
commit
9f548b9dee
@ -61,14 +61,10 @@ function (angular, $, config, _) {
|
|||||||
$scope.filter = filterSrv;
|
$scope.filter = filterSrv;
|
||||||
$scope.filter.init(dashboard.current);
|
$scope.filter.init(dashboard.current);
|
||||||
|
|
||||||
$scope.$watch('dashboard.current', function(newValue) {
|
$rootScope.$on("dashboard-loaded", function(event, dashboard) {
|
||||||
$scope.filter.init(newValue);
|
$scope.filter.init(dashboard);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$watch('filter.time', function() {
|
|
||||||
$scope.dashboard.refresh();
|
|
||||||
}, true);
|
|
||||||
|
|
||||||
// Clear existing alerts
|
// Clear existing alerts
|
||||||
alertSrv.clearAll();
|
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.
|
// Take out any that we're not allowed to add from the gui.
|
||||||
self.availablePanels = _.difference(self.availablePanels,config.hidden_panels);
|
self.availablePanels = _.difference(self.availablePanels,config.hidden_panels);
|
||||||
|
|
||||||
$rootScope.$emit('dashboard-loaded');
|
$rootScope.$emit('dashboard-loaded', self.current);
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
self.original = angular.copy(self.current);
|
self.original = angular.copy(self.current);
|
||||||
|
@ -55,17 +55,20 @@ define([
|
|||||||
|
|
||||||
setTime: function(time) {
|
setTime: function(time) {
|
||||||
_.extend(this.time, time);
|
_.extend(this.time, time);
|
||||||
|
|
||||||
// disable refresh if we have an absolute time
|
// disable refresh if we have an absolute time
|
||||||
if (time.to !== 'now') {
|
if (time.to !== 'now') {
|
||||||
this.old_refresh = this.dashboard.refresh;
|
this.old_refresh = this.dashboard.refresh;
|
||||||
dashboard.set_interval(false);
|
dashboard.set_interval(false);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (this.old_refresh && this.old_refresh !== this.dashboard.refresh) {
|
||||||
if (this.old_refresh && this.old_refresh !== this.dashboard.refresh) {
|
|
||||||
dashboard.set_interval(this.old_refresh);
|
dashboard.set_interval(this.old_refresh);
|
||||||
this.old_refresh = null;
|
this.old_refresh = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$timeout(function(){
|
||||||
|
dashboard.refresh();
|
||||||
|
},0);
|
||||||
},
|
},
|
||||||
|
|
||||||
timeRange: function(parse) {
|
timeRange: function(parse) {
|
||||||
|
Loading…
Reference in New Issue
Block a user