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
This commit is contained in:
Vikrant Gupta 2024-05-20 18:42:39 +05:30 committed by GitHub
parent cf64da2631
commit 2dbe598b2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 49 additions and 0 deletions

View File

@ -50,6 +50,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'having', 'having',
'orderBy', 'orderBy',
'functions', 'functions',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -65,6 +68,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'orderBy', 'orderBy',
'functions', 'functions',
'spaceAggregation', 'spaceAggregation',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -78,6 +84,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'limit', 'limit',
'having', 'having',
'orderBy', 'orderBy',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -94,6 +103,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'having', 'having',
'orderBy', 'orderBy',
'functions', 'functions',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -109,6 +121,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'orderBy', 'orderBy',
'functions', 'functions',
'spaceAggregation', 'spaceAggregation',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -122,6 +137,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'limit', 'limit',
'having', 'having',
'orderBy', 'orderBy',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -138,6 +156,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'having', 'having',
'orderBy', 'orderBy',
'functions', 'functions',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -153,6 +174,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'orderBy', 'orderBy',
'functions', 'functions',
'spaceAggregation', 'spaceAggregation',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -166,6 +190,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'limit', 'limit',
'having', 'having',
'orderBy', 'orderBy',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -182,6 +209,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'having', 'having',
'orderBy', 'orderBy',
'functions', 'functions',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -197,6 +227,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'orderBy', 'orderBy',
'functions', 'functions',
'spaceAggregation', 'spaceAggregation',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -210,6 +243,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'limit', 'limit',
'having', 'having',
'orderBy', 'orderBy',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -241,6 +277,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'reduceTo', 'reduceTo',
'having', 'having',
'functions', 'functions',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -254,6 +293,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'reduceTo', 'reduceTo',
'functions', 'functions',
'spaceAggregation', 'spaceAggregation',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },
@ -267,6 +309,9 @@ export const panelTypeDataSourceFormValuesMap: Record<
'limit', 'limit',
'having', 'having',
'orderBy', 'orderBy',
'queryName',
'expression',
'disabled',
], ],
}, },
}, },

View File

@ -229,6 +229,9 @@ export function QueryBuilderProvider({
setCurrentQuery( setCurrentQuery(
timeUpdated ? merge(currentQuery, newQueryState) : newQueryState, timeUpdated ? merge(currentQuery, newQueryState) : newQueryState,
); );
setSupersetQuery(
timeUpdated ? merge(currentQuery, newQueryState) : newQueryState,
);
setQueryType(type); setQueryType(type);
}, },
[prepareQueryBuilderData, currentQuery], [prepareQueryBuilderData, currentQuery],
@ -802,6 +805,7 @@ export function QueryBuilderProvider({
if (newCurrentQuery) { if (newCurrentQuery) {
setCurrentQuery(newCurrentQuery); setCurrentQuery(newCurrentQuery);
setSupersetQuery(newCurrentQuery);
} }
}; };