From 60e7ba08c3f2df8f240ca9649cbac1ccfd3a9f4c Mon Sep 17 00:00:00 2001 From: Ville Brofeldt Date: Wed, 18 May 2022 19:47:24 +0300 Subject: [PATCH] simplify control panel --- .../superset-ui-chart-controls/src/types.ts | 2 +- .../src/MixedTimeseries/controlPanel.tsx | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/types.ts b/superset-frontend/packages/superset-ui-chart-controls/src/types.ts index 73985bfc743b9..6434026d00cdd 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/types.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/src/types.ts @@ -341,7 +341,7 @@ export interface ControlPanelSectionConfig { } export interface ControlPanelConfig { - controlPanelSections: ControlPanelSectionConfig[]; + controlPanelSections: (ControlPanelSectionConfig | null)[]; controlOverrides?: ControlOverrides; sectionOverrides?: SectionOverrides; onInit?: (state: ControlStateMapping) => void; diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx index 80920af06dabb..e39c023661696 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx @@ -278,6 +278,13 @@ function createAdvancedAnalyticsSection( const config: ControlPanelConfig = { controlPanelSections: [ sections.legacyTimeseriesTime, + isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) + ? { + label: t('Shared query fields'), + expanded: true, + controlSetRows: [[xAxisControl]], + } + : null, createQuerySection(t('Query A'), ''), createAdvancedAnalyticsSection(t('Advanced analytics Query A'), ''), createQuerySection(t('Query B'), '_b'), @@ -447,12 +454,4 @@ const config: ControlPanelConfig = { ], }; -if (isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)) { - config.controlPanelSections.splice(1, 0, { - label: t('Shared query fields'), - expanded: true, - controlSetRows: [[xAxisControl]], - }); -} - export default config;