Commit fba329f3 by Torkel Ödegaard Committed by GitHub

BackendSrv: Fix error alert logic (#26453)

parent 9486f960
......@@ -267,7 +267,8 @@ export class TemplateSrv implements BaseTemplateSrv {
variableExists(expression: string): boolean {
const name = this.getVariableName(expression);
return (name && this.getVariableAtIndex(name)) !== undefined;
const variable = name && this.getVariableAtIndex(name);
return variable !== null && variable !== undefined;
}
highlightVariablesAsHtml(str: string) {
......@@ -427,7 +428,7 @@ export class TemplateSrv implements BaseTemplateSrv {
return value.join(',');
}
private getVariableAtIndex = (name: string): any => {
private getVariableAtIndex(name: string) {
if (!name) {
return;
}
......@@ -437,11 +438,11 @@ export class TemplateSrv implements BaseTemplateSrv {
}
return this.index[name];
};
}
private getAdHocVariables = (): any[] => {
private getAdHocVariables(): any[] {
return this.dependencies.getFilteredVariables(isAdHoc);
};
}
}
// Expose the template srv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment