From 193b6712462f8bb29d28ef6d9c452acf8fe11f71 Mon Sep 17 00:00:00 2001 From: Andreas Christou Date: Wed, 1 Feb 2023 09:25:03 +0000 Subject: [PATCH] [v9.4.x] TemplateVariables: Fix custom variable function support (#62509) (#62573) TemplateVariables: Fix custom variable function support (#62509) Validate query values (cherry picked from commit 3ac97dd39627b2446f36c876f407d6c136ab34ff) # Conflicts: # public/app/features/query/state/runRequest.ts --- public/app/features/query/state/runRequest.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/app/features/query/state/runRequest.ts b/public/app/features/query/state/runRequest.ts index 440bf4f4e6c..b3ccc3435f5 100644 --- a/public/app/features/query/state/runRequest.ts +++ b/public/app/features/query/state/runRequest.ts @@ -176,9 +176,14 @@ export function callQueryMethod( request: DataQueryRequest, queryFunction?: typeof datasource.query ) { - // If the datasource has defined a default query, make sure it's applied if the query is empty + // If the datasource has defined a default query, make sure it's applied request.targets = request.targets.map((t) => - queryIsEmpty(t) ? { ...datasource?.getDefaultQuery?.(CoreApp.PanelEditor), ...t } : t + queryIsEmpty(t) + ? { + ...datasource?.getDefaultQuery?.(CoreApp.PanelEditor), + ...t, + } + : t ); // If its a public datasource, just return the result. Expressions will be handled on the backend.