ソースを参照

call render in query

Sven Klemm 8 年 前
コミット
17be31e216
1 ファイル変更9 行追加6 行削除
  1. 9 6
      public/app/plugins/datasource/postgres/datasource.ts

+ 9 - 6
public/app/plugins/datasource/postgres/datasource.ts

@@ -1,5 +1,6 @@
 import _ from 'lodash';
 import _ from 'lodash';
 import ResponseParser from './response_parser';
 import ResponseParser from './response_parser';
+import PostgresQuery from 'app/plugins/datasource/postgres/postgres_query';
 
 
 export class PostgresDatasource {
 export class PostgresDatasource {
   id: any;
   id: any;
@@ -33,16 +34,18 @@ export class PostgresDatasource {
   }
   }
 
 
   query(options) {
   query(options) {
-    var queries = _.filter(options.targets, item => {
-      return item.hide !== true;
-    }).map(item => {
+    var queries = _.filter(options.targets, target => {
+      return target.hide !== true;
+    }).map(target => {
+      var queryModel = new PostgresQuery(target, this.templateSrv, options.scopedVars);
+
       return {
       return {
-        refId: item.refId,
+        refId: target.refId,
         intervalMs: options.intervalMs,
         intervalMs: options.intervalMs,
         maxDataPoints: options.maxDataPoints,
         maxDataPoints: options.maxDataPoints,
         datasourceId: this.id,
         datasourceId: this.id,
-        rawSql: this.templateSrv.replace(item.rawSql, options.scopedVars, this.interpolateVariable),
-        format: item.format,
+        rawSql: queryModel.render(this.interpolateVariable),
+        format: target.format,
       };
       };
     });
     });