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