|
|
|
@ -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 => { |
|
|
|
var queries = _.filter(options.targets, target => { |
|
|
|
return item.hide !== true; |
|
|
|
return target.hide !== true; |
|
|
|
}).map(item => { |
|
|
|
}).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), |
|
|
|
rawSql: queryModel.render(this.interpolateVariable), |
|
|
|
format: item.format, |
|
|
|
format: target.format, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|