mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Revert "Explore: Show log line if there is an interpolated link" (#65315)
Revert "Explore: Show log line if there is an interpolated link (#62926)"
This reverts commit aa857e2a4f.
This commit is contained in:
@@ -40,21 +40,6 @@ export class TemplateSrvMock implements TemplateSrv {
|
||||
});
|
||||
}
|
||||
|
||||
getAllVariablesInTarget(target: string, scopedVars: ScopedVars): Record<string, string> {
|
||||
const regexp = new RegExp(this.regex);
|
||||
const values: Record<string, string> = {};
|
||||
|
||||
target.replace(regexp, (match, var1, var2, fmt2, var3, fieldPath) => {
|
||||
const variableName = var1 || var2 || var3;
|
||||
values[variableName] = this.variables[variableName];
|
||||
|
||||
// Don't care about the result anyway
|
||||
return '';
|
||||
});
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
getVariableName(expression: string) {
|
||||
this.regex.lastIndex = 0;
|
||||
const match = this.regex.exec(expression);
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
AdHocVariableFilter,
|
||||
AdHocVariableModel,
|
||||
TypedVariableModel,
|
||||
VariableMap,
|
||||
} from '@grafana/data';
|
||||
import { getDataSourceSrv, setTemplateSrv, TemplateSrv as BaseTemplateSrv } from '@grafana/runtime';
|
||||
import { sceneGraph, FormatRegistryID, formatRegistry, VariableCustomFormatterFn } from '@grafana/scenes';
|
||||
@@ -352,51 +351,6 @@ export class TemplateSrv implements BaseTemplateSrv {
|
||||
});
|
||||
}
|
||||
|
||||
getAllVariablesInTarget(target: string, scopedVars: ScopedVars, format?: string | Function): VariableMap {
|
||||
const values: VariableMap = {};
|
||||
|
||||
this.replaceInVariableRegex(target, (match, var1, var2, fmt2, var3, fieldPath, fmt3) => {
|
||||
const variableName = var1 || var2 || var3;
|
||||
const variableDisplayName =
|
||||
var1 || var2 || (var3 !== undefined && fieldPath !== undefined) ? `${var3}.${fieldPath}` : var3;
|
||||
const fmt = fmt2 || fmt3 || format;
|
||||
const value = this.getVariableValue(variableName, fieldPath, scopedVars);
|
||||
if (value !== null && value !== undefined) {
|
||||
const variable = this.getVariableAtIndex(variableName);
|
||||
const text = this.getVariableText(variableName, value, scopedVars);
|
||||
values[variableDisplayName] = this.formatValue(value, fmt, variable, text);
|
||||
} else {
|
||||
values[variableDisplayName] = undefined;
|
||||
}
|
||||
|
||||
// Don't care about the result anyway
|
||||
return '';
|
||||
});
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* The replace function, for every match, will return a function that has the full match as a param
|
||||
* followed by one param per capture group of the variable regex.
|
||||
*
|
||||
* See the definition of this.regex for further comments on the variable definitions.
|
||||
*/
|
||||
private replaceInVariableRegex(
|
||||
text: string,
|
||||
replace: (
|
||||
fullMatch: string, // $simpleVarName [[squareVarName:squareFormat]] ${curlyVarName.curlyPath:curlyFormat}
|
||||
simpleVarName: string, // simpleVarName - -
|
||||
squareVarName: string, // - squareVarName -
|
||||
squareFormat: string, // - squareFormat -
|
||||
curlyVarName: string, // - - curlyVarName
|
||||
curlyPath: string, // - - curlyPath
|
||||
curlyFormat: string // - - curlyFormat
|
||||
) => string
|
||||
) {
|
||||
return text.replace(this.regex, replace);
|
||||
}
|
||||
|
||||
isAllValue(value: any) {
|
||||
return value === ALL_VARIABLE_VALUE || (Array.isArray(value) && value[0] === ALL_VARIABLE_VALUE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user