From 2dbe598b2c1be525643446641420bb4b12defabe Mon Sep 17 00:00:00 2001 From: Vikrant Gupta Date: Mon, 20 May 2024 18:42:39 +0530 Subject: [PATCH] fix: retain the query name,expression and disabled property on changing panel type (#4976) * fix: retain the query name,expression and disabled property on changing panel type * fix: missing reset and init query for superset query --- frontend/src/container/NewWidget/utils.ts | 45 +++++++++++++++++++++++ frontend/src/providers/QueryBuilder.tsx | 4 ++ 2 files changed, 49 insertions(+) diff --git a/frontend/src/container/NewWidget/utils.ts b/frontend/src/container/NewWidget/utils.ts index 64d884de15..caf2604639 100644 --- a/frontend/src/container/NewWidget/utils.ts +++ b/frontend/src/container/NewWidget/utils.ts @@ -50,6 +50,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'having', 'orderBy', 'functions', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -65,6 +68,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'orderBy', 'functions', 'spaceAggregation', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -78,6 +84,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'limit', 'having', 'orderBy', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -94,6 +103,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'having', 'orderBy', 'functions', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -109,6 +121,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'orderBy', 'functions', 'spaceAggregation', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -122,6 +137,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'limit', 'having', 'orderBy', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -138,6 +156,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'having', 'orderBy', 'functions', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -153,6 +174,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'orderBy', 'functions', 'spaceAggregation', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -166,6 +190,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'limit', 'having', 'orderBy', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -182,6 +209,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'having', 'orderBy', 'functions', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -197,6 +227,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'orderBy', 'functions', 'spaceAggregation', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -210,6 +243,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'limit', 'having', 'orderBy', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -241,6 +277,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'reduceTo', 'having', 'functions', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -254,6 +293,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'reduceTo', 'functions', 'spaceAggregation', + 'queryName', + 'expression', + 'disabled', ], }, }, @@ -267,6 +309,9 @@ export const panelTypeDataSourceFormValuesMap: Record< 'limit', 'having', 'orderBy', + 'queryName', + 'expression', + 'disabled', ], }, }, diff --git a/frontend/src/providers/QueryBuilder.tsx b/frontend/src/providers/QueryBuilder.tsx index a2166a5bc8..f630b13f83 100644 --- a/frontend/src/providers/QueryBuilder.tsx +++ b/frontend/src/providers/QueryBuilder.tsx @@ -229,6 +229,9 @@ export function QueryBuilderProvider({ setCurrentQuery( timeUpdated ? merge(currentQuery, newQueryState) : newQueryState, ); + setSupersetQuery( + timeUpdated ? merge(currentQuery, newQueryState) : newQueryState, + ); setQueryType(type); }, [prepareQueryBuilderData, currentQuery], @@ -802,6 +805,7 @@ export function QueryBuilderProvider({ if (newCurrentQuery) { setCurrentQuery(newCurrentQuery); + setSupersetQuery(newCurrentQuery); } };