Просмотр исходного кода

Use closure for calling interpolateVariable

Sven Klemm 7 лет назад
Родитель
Сommit
ec0fd96f08
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      public/app/plugins/datasource/postgres/datasource.ts

+ 5 - 3
public/app/plugins/datasource/postgres/datasource.ts

@@ -50,7 +50,7 @@ export class PostgresDatasource {
         intervalMs: options.intervalMs,
         intervalMs: options.intervalMs,
         maxDataPoints: options.maxDataPoints,
         maxDataPoints: options.maxDataPoints,
         datasourceId: this.id,
         datasourceId: this.id,
-        rawSql: queryModel.render(this.interpolateVariable),
+        rawSql: queryModel.render((value, variable) => this.interpolateVariable(value, variable)),
         format: target.format,
         format: target.format,
       };
       };
     });
     });
@@ -82,7 +82,9 @@ export class PostgresDatasource {
     const query = {
     const query = {
       refId: options.annotation.name,
       refId: options.annotation.name,
       datasourceId: this.id,
       datasourceId: this.id,
-      rawSql: this.templateSrv.replace(options.annotation.rawQuery, options.scopedVars, this.interpolateVariable),
+      rawSql: this.templateSrv.replace(options.annotation.rawQuery, options.scopedVars, (value, variable) =>
+        this.interpolateVariable(value, variable)
+      ),
       format: 'table',
       format: 'table',
     };
     };
 
 
@@ -108,7 +110,7 @@ export class PostgresDatasource {
     const interpolatedQuery = {
     const interpolatedQuery = {
       refId: refId,
       refId: refId,
       datasourceId: this.id,
       datasourceId: this.id,
-      rawSql: this.templateSrv.replace(query, {}, this.interpolateVariable),
+      rawSql: this.templateSrv.replace(query, {}, (value, variable) => this.interpolateVariable(value, variable)),
       format: 'table',
       format: 'table',
     };
     };