|
|
@@ -6,6 +6,8 @@ export class DatasourceVariable implements Variable {
|
|
|
query: string;
|
|
|
options: any;
|
|
|
current: any;
|
|
|
+ multi: boolean;
|
|
|
+ includeAll: boolean;
|
|
|
refresh: any;
|
|
|
skipUrlSync: boolean;
|
|
|
|
|
|
@@ -18,6 +20,8 @@ export class DatasourceVariable implements Variable {
|
|
|
regex: '',
|
|
|
options: [],
|
|
|
query: '',
|
|
|
+ multi: false,
|
|
|
+ includeAll: false,
|
|
|
refresh: 1,
|
|
|
skipUrlSync: false,
|
|
|
};
|
|
|
@@ -69,9 +73,16 @@ export class DatasourceVariable implements Variable {
|
|
|
}
|
|
|
|
|
|
this.options = options;
|
|
|
+ if (this.includeAll) {
|
|
|
+ this.addAllOption();
|
|
|
+ }
|
|
|
return this.variableSrv.validateVariableSelectionState(this);
|
|
|
}
|
|
|
|
|
|
+ addAllOption() {
|
|
|
+ this.options.unshift({ text: 'All', value: '$__all' });
|
|
|
+ }
|
|
|
+
|
|
|
dependsOn(variable) {
|
|
|
if (this.regex) {
|
|
|
return containsVariable(this.regex, variable.name);
|
|
|
@@ -84,6 +95,9 @@ export class DatasourceVariable implements Variable {
|
|
|
}
|
|
|
|
|
|
getValueForUrl() {
|
|
|
+ if (this.current.text === 'All') {
|
|
|
+ return 'All';
|
|
|
+ }
|
|
|
return this.current.value;
|
|
|
}
|
|
|
}
|
|
|
@@ -91,5 +105,6 @@ export class DatasourceVariable implements Variable {
|
|
|
variableTypes['datasource'] = {
|
|
|
name: 'Datasource',
|
|
|
ctor: DatasourceVariable,
|
|
|
+ supportsMulti: true,
|
|
|
description: 'Enabled you to dynamically switch the datasource for multiple panels',
|
|
|
};
|