(cherry picked from commit b374b01260)
Co-authored-by: Victor Marin <36818606+mdvictor@users.noreply.github.com>
This commit is contained in:
co-authored by
Victor Marin
parent
0bdc74ba39
commit
c9341d5314
@@ -106,6 +106,11 @@ export abstract class SqlDatasource extends DataSourceWithBackend<SQLQuery, SQLO
|
||||
}
|
||||
|
||||
async metricFindQuery(query: string, optionalOptions?: MetricFindQueryOptions): Promise<MetricFindValue[]> {
|
||||
let refId = 'tempvar';
|
||||
if (optionalOptions && optionalOptions.variable && optionalOptions.variable.name) {
|
||||
refId = optionalOptions.variable.name;
|
||||
}
|
||||
|
||||
const rawSql = this.templateSrv.replace(
|
||||
query,
|
||||
getSearchFilterScopedVar({ query, wildcardChar: '%', options: optionalOptions }),
|
||||
@@ -113,7 +118,7 @@ export abstract class SqlDatasource extends DataSourceWithBackend<SQLQuery, SQLO
|
||||
);
|
||||
|
||||
const interpolatedQuery: SQLQuery = {
|
||||
refId: 'tempvar',
|
||||
refId: refId,
|
||||
datasource: this.getRef(),
|
||||
rawSql,
|
||||
format: QueryFormat.Table,
|
||||
@@ -200,4 +205,5 @@ interface RunSQLOptions extends MetricFindQueryOptions {
|
||||
|
||||
interface MetricFindQueryOptions extends SearchFilterOptions {
|
||||
range?: TimeRange;
|
||||
variable?: VariableWithMultiSupport;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user