mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
MSSQL/MySQL: Add correct refId when fetching variable query results (#56919)
This commit is contained in:
parent
902a230867
commit
b374b01260
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user