From c7d1e77429254619e73b3724331cf45f69c8a758 Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Sat, 16 Nov 2024 12:20:11 -0800 Subject: [PATCH] use currently selected data source when no source attached to saved query Signed-off-by: Amardeepsingh Siglani --- .../public/ui/saved_query_flyouts/open_saved_query_flyout.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/data/public/ui/saved_query_flyouts/open_saved_query_flyout.tsx b/src/plugins/data/public/ui/saved_query_flyouts/open_saved_query_flyout.tsx index 41aa344bbaef..96848cfdba89 100644 --- a/src/plugins/data/public/ui/saved_query_flyouts/open_saved_query_flyout.tsx +++ b/src/plugins/data/public/ui/saved_query_flyouts/open_saved_query_flyout.tsx @@ -302,7 +302,9 @@ export function OpenSavedQueryFlyout({ if (selectedQuery) { if ( // Template queries are not associated with data sources. Apply data source from current query - selectedQuery.attributes.isTemplate + selectedQuery.attributes.isTemplate || + // Associating a saved query with a data source is optional. If no data source is present, keep the current source. + !selectedQuery.attributes.query.dataset?.dataSource ) { const updatedQuery: Query = { ...queryStringManager?.getQuery(),