[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 3ac97dd396)

# Conflicts:
#	public/app/features/query/state/runRequest.ts
This commit is contained in:
Andreas Christou
2023-02-01 10:25:03 +01:00
committed by GitHub
parent 2bb672a7de
commit 193b671246
@@ -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.