mirror of
https://github.com/grafana/grafana.git
synced 2025-01-24 23:37:01 -06:00
minor refactoring
This commit is contained in:
parent
ba1e1532ac
commit
aff4bf8f6c
@ -403,11 +403,10 @@ function (angular, $, _, moment) {
|
||||
|
||||
if (oldVersion < 11) {
|
||||
// update template variables
|
||||
for (i = 0 ; i < this.templating.list.length; i++) {
|
||||
var templateVariable = this.templating.list[i];
|
||||
_.each(this.templating.list, function(templateVariable) {
|
||||
if (templateVariable.refresh) { templateVariable.refresh = 'On Dashboard Load'; }
|
||||
if (!templateVariable.refresh) { templateVariable.refresh = 'Never'; }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (panelUpgrades.length === 0) {
|
||||
|
@ -21,13 +21,13 @@ function (angular, _, kbn) {
|
||||
}, $rootScope);
|
||||
|
||||
$rootScope.onAppEvent('refresh', function() {
|
||||
var promises = [];
|
||||
for (var i = 0; i < self.variables.length; i++) {
|
||||
var variable = self.variables[i];
|
||||
if (variable.refresh === 'On Time Change and Dashboard Load') {
|
||||
promises.push(self.updateOptions(variable));
|
||||
}
|
||||
}
|
||||
var promises = _.chain(self.variables)
|
||||
.filter(function(variable) {
|
||||
return variable.refresh === 'On Time Change and Dashboard Load';
|
||||
})
|
||||
.map(function(variable) {
|
||||
return self.updateOptions(variable);
|
||||
}).value();
|
||||
return $q.all(promises);
|
||||
}, $rootScope);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user