Commit aff4bf8f by Mitsuhiro Tanda

minor refactoring

parent ba1e1532
...@@ -403,11 +403,10 @@ function (angular, $, _, moment) { ...@@ -403,11 +403,10 @@ function (angular, $, _, moment) {
if (oldVersion < 11) { if (oldVersion < 11) {
// update template variables // update template variables
for (i = 0 ; i < this.templating.list.length; i++) { _.each(this.templating.list, function(templateVariable) {
var templateVariable = this.templating.list[i];
if (templateVariable.refresh) { templateVariable.refresh = 'On Dashboard Load'; } if (templateVariable.refresh) { templateVariable.refresh = 'On Dashboard Load'; }
if (!templateVariable.refresh) { templateVariable.refresh = 'Never'; } if (!templateVariable.refresh) { templateVariable.refresh = 'Never'; }
} });
} }
if (panelUpgrades.length === 0) { if (panelUpgrades.length === 0) {
......
...@@ -21,13 +21,13 @@ function (angular, _, kbn) { ...@@ -21,13 +21,13 @@ function (angular, _, kbn) {
}, $rootScope); }, $rootScope);
$rootScope.onAppEvent('refresh', function() { $rootScope.onAppEvent('refresh', function() {
var promises = []; var promises = _.chain(self.variables)
for (var i = 0; i < self.variables.length; i++) { .filter(function(variable) {
var variable = self.variables[i]; return variable.refresh === 'On Time Change and Dashboard Load';
if (variable.refresh === 'On Time Change and Dashboard Load') { })
promises.push(self.updateOptions(variable)); .map(function(variable) {
} return self.updateOptions(variable);
} }).value();
return $q.all(promises); return $q.all(promises);
}, $rootScope); }, $rootScope);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment