mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 23:53:09 +08:00
Loki: Fix Loki with repeated panels and interpolation for Explore (#21685)
This commit is contained in:
@ -2,6 +2,7 @@ import _ from 'lodash';
|
||||
import ResponseParser from './response_parser';
|
||||
import PostgresQuery from 'app/plugins/datasource/postgres/postgres_query';
|
||||
import { getBackendSrv } from '@grafana/runtime';
|
||||
import { ScopedVars } from '@grafana/data';
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||
//Types
|
||||
@ -49,14 +50,17 @@ export class PostgresDatasource {
|
||||
return quotedValues.join(',');
|
||||
};
|
||||
|
||||
interpolateVariablesInQueries(queries: PostgresQueryForInterpolation[]): PostgresQueryForInterpolation[] {
|
||||
interpolateVariablesInQueries(
|
||||
queries: PostgresQueryForInterpolation[],
|
||||
scopedVars: ScopedVars
|
||||
): PostgresQueryForInterpolation[] {
|
||||
let expandedQueries = queries;
|
||||
if (queries && queries.length > 0) {
|
||||
expandedQueries = queries.map(query => {
|
||||
const expandedQuery = {
|
||||
...query,
|
||||
datasource: this.name,
|
||||
rawSql: this.templateSrv.replace(query.rawSql, {}, this.interpolateVariable),
|
||||
rawSql: this.templateSrv.replace(query.rawSql, scopedVars, this.interpolateVariable),
|
||||
};
|
||||
return expandedQuery;
|
||||
});
|
||||
|
Reference in New Issue
Block a user