From 340ed4125eeaadd4e77d680320e4c6b2a4982c92 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 2 Nov 2021 00:29:52 -0700 Subject: [PATCH] DataSourceWithBackend: implement interpolateVariablesInQueries by default (#41152) --- .../grafana-runtime/src/utils/DataSourceWithBackend.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts b/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts index 0046c4aaa12..c4ee525d5f7 100644 --- a/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts +++ b/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts @@ -160,6 +160,13 @@ class DataSourceWithBackend< */ filterQuery?(query: TQuery): boolean; + /** + * Apply template variables for explore + */ + interpolateVariablesInQueries(queries: TQuery[], scopedVars: ScopedVars | {}): TQuery[] { + return queries.map((q) => this.applyTemplateVariables(q, scopedVars) as TQuery); + } + /** * Override to apply template variables. The result is usually also `TQuery`, but sometimes this can * be used to modify the query structure before sending to the backend.