|
|
|
@ -18,18 +18,18 @@ export class VariableSrv { |
|
|
|
|
variables: any[]; |
|
|
|
|
|
|
|
|
|
/** @ngInject */ |
|
|
|
|
constructor(private $rootScope, |
|
|
|
|
private $q, |
|
|
|
|
constructor(private $q, |
|
|
|
|
private $location, |
|
|
|
|
private $injector, |
|
|
|
|
private templateSrv: TemplateSrv, |
|
|
|
|
private timeSrv: TimeSrv) { |
|
|
|
|
$rootScope.$on('template-variable-value-updated', this.updateUrlParamsWithCurrentVariables.bind(this), $rootScope); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
init(dashboard: DashboardModel) { |
|
|
|
|
this.dashboard = dashboard; |
|
|
|
|
this.dashboard.events.on('time-range-updated', this.onTimeRangeUpdated.bind(this)); |
|
|
|
|
this.dashboard.events.on('template-variable-value-updated', this.updateUrlParamsWithCurrentVariables.bind(this)); |
|
|
|
|
|
|
|
|
|
// create working class models representing variables
|
|
|
|
|
this.variables = dashboard.templating.list = dashboard.templating.list.map(this.createVariableFromModel.bind(this)); |
|
|
|
@ -59,7 +59,7 @@ export class VariableSrv { |
|
|
|
|
|
|
|
|
|
return variable.updateOptions().then(() => { |
|
|
|
|
if (angular.toJson(previousOptions) !== angular.toJson(variable.options)) { |
|
|
|
|
this.$rootScope.$emit('template-variable-value-updated'); |
|
|
|
|
this.dashboard.templateVariableValueUpdated(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
@ -144,7 +144,7 @@ export class VariableSrv { |
|
|
|
|
|
|
|
|
|
return this.$q.all(promises).then(() => { |
|
|
|
|
if (emitChangeEvents) { |
|
|
|
|
this.$rootScope.appEvent('template-variable-value-updated'); |
|
|
|
|
this.dashboard.templateVariableValueUpdated(); |
|
|
|
|
this.dashboard.startRefresh(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|