DataSourceRef: use reference rather than id where possible (#41372)

This commit is contained in:
Ryan McKinley
2021-11-09 07:24:41 -08:00
committed by GitHub
parent 490d21fc5c
commit 6c1a0cc707
8 changed files with 31 additions and 39 deletions

View File

@ -82,7 +82,7 @@ export class PostgresDatasource extends DataSourceWithBackend<PostgresQuery, Pos
const queryModel = new PostgresQueryModel(target, this.templateSrv, scopedVars);
return {
refId: target.refId,
datasourceId: this.id,
datasource: this.getRef(),
rawSql: queryModel.render(this.interpolateVariable as any),
format: target.format,
};
@ -97,7 +97,7 @@ export class PostgresDatasource extends DataSourceWithBackend<PostgresQuery, Pos
const query = {
refId: options.annotation.name,
datasourceId: this.id,
datasource: this.getRef(),
rawSql: this.templateSrv.replace(options.annotation.rawQuery, options.scopedVars, this.interpolateVariable),
format: 'table',
};
@ -137,7 +137,7 @@ export class PostgresDatasource extends DataSourceWithBackend<PostgresQuery, Pos
const interpolatedQuery = {
refId: refId,
datasourceId: this.id,
datasource: this.getRef(),
rawSql,
format: 'table',
};