You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2022/07/01 14:37:46 UTC
[superset] 04/06: Merge
This is an automated email from the ASF dual-hosted git repository.
diegopucci pushed a commit to branch chore/color-scheme-updates
in repository https://gitbox.apache.org/repos/asf/superset.git
commit c2ddb1cc1701f56874d93b473f52b366b9e94ca0
Merge: 08ff8772b2 99a1ebc4b8
Author: geido <di...@gmail.com>
AuthorDate: Thu Jun 30 15:26:22 2022 +0300
Merge
.../src/addSlice/AddSliceContainer.test.tsx | 9 ++--
.../src/addSlice/AddSliceContainer.tsx | 31 ++++++------
superset-frontend/src/constants.ts | 4 ++
superset-frontend/src/explore/ExplorePage.tsx | 56 ++++++++++------------
.../src/explore/actions/hydrateExplore.ts | 19 ++++++--
.../exploreUtils/getParsedExploreURLParams.ts | 6 +++
6 files changed, 66 insertions(+), 59 deletions(-)
diff --cc superset-frontend/src/explore/actions/hydrateExplore.ts
index 4ffb5beedb,ec49c0cdd5..0c7491d161
--- a/superset-frontend/src/explore/actions/hydrateExplore.ts
+++ b/superset-frontend/src/explore/actions/hydrateExplore.ts
@@@ -54,26 -64,9 +64,26 @@@ export const hydrateExplore
datasource: initialDatasource,
};
const initialControls = getControlsState(
- initialData,
+ initialExploreState,
initialFormData,
) as ControlStateMapping;
+ const colorSchemeKey = initialControls['color_scheme'] && 'color_scheme';
+ const linearColorSchemeKey = initialControls['linear_color_scheme'] && 'linear_color_scheme';
+ // verifies whether the current color scheme exists in the registry
+ // if not fallbacks to the default
+ const verifyColorScheme = (type: 'CATEGORICAL' | 'SEQUENTIAL') => {
+ const schemes = type === 'CATEGORICAL' ? getCategoricalSchemeRegistry() : getSequentialSchemeRegistry();
+ const key = type === 'CATEGORICAL' ? colorSchemeKey : linearColorSchemeKey;
+ if (!schemes.items[initialFormData[key]]) {
+ Object.assign(initialFormData, {
+ color_scheme: schemes.defaultKey,
+ })
+ initialControls[key].value = schemes.defaultKey
+ }
+ }
+
+ if (colorSchemeKey) verifyColorScheme('CATEGORICAL');
+ if (linearColorSchemeKey) verifyColorScheme('SEQUENTIAL');
const exploreState = {
// note this will add `form_data` to state,
@@@ -111,9 -104,7 +121,8 @@@
? getFormDataFromControls(initialControls)
: null;
+ const latestQueryFormData = getFormDataFromControls(exploreState.controls);
-
- const chartKey: number = getChartKey(initialData);
+ const chartKey: number = getChartKey(initialExploreState);
const chart: ChartState = {
id: chartKey,
chartAlert: null,