feat(templating): more work on new variable handling code, #6048

This commit is contained in:
Torkel Ödegaard
2016-09-17 11:28:45 +02:00
parent 46ebae7304
commit 4188c46f83
9 changed files with 192 additions and 95 deletions

View File

@@ -11,11 +11,12 @@ export class DatasourceVariable implements Variable {
options: any;
/** @ngInject */
constructor(private model, private datasourceSrv) {
constructor(private model, private datasourceSrv, private variableSrv) {
_.extend(this, model);
}
setValue(option) {
this.variableSrv.setOptionAsCurrent(this, option);
}
updateOptions() {
@@ -48,9 +49,13 @@ export class DatasourceVariable implements Variable {
this.options = options;
}
dependsOn(variableName) {
dependsOn(variable) {
return false;
}
setValueFromUrl(urlValue) {
return this.variableSrv.setOptionFromUrl(this, urlValue);
}
}
variableConstructorMap['datasource'] = DatasourceVariable;