|
@@ -20,6 +20,17 @@ function (angular, _, kbn) {
|
|
|
}
|
|
}
|
|
|
}, $rootScope);
|
|
}, $rootScope);
|
|
|
|
|
|
|
|
|
|
+ $rootScope.onAppEvent('refresh', function() {
|
|
|
|
|
+ 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);
|
|
|
|
|
+
|
|
|
this.init = function(dashboard) {
|
|
this.init = function(dashboard) {
|
|
|
this.variables = dashboard.templating.list;
|
|
this.variables = dashboard.templating.list;
|
|
|
templateSrv.init(this.variables);
|
|
templateSrv.init(this.variables);
|
|
@@ -60,7 +71,7 @@ function (angular, _, kbn) {
|
|
|
if (urlValue !== void 0) {
|
|
if (urlValue !== void 0) {
|
|
|
return self.setVariableFromUrl(variable, urlValue).then(lock.resolve);
|
|
return self.setVariableFromUrl(variable, urlValue).then(lock.resolve);
|
|
|
}
|
|
}
|
|
|
- else if (variable.refresh) {
|
|
|
|
|
|
|
+ else if (variable.refresh === 'On Dashboard Load' || variable.refresh === 'On Time Change and Dashboard Load') {
|
|
|
return self.updateOptions(variable).then(function() {
|
|
return self.updateOptions(variable).then(function() {
|
|
|
if (_.isEmpty(variable.current) && variable.options.length) {
|
|
if (_.isEmpty(variable.current) && variable.options.length) {
|
|
|
console.log("setting current for %s", variable.name);
|
|
console.log("setting current for %s", variable.name);
|