diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx index 81cd563c807bb..4021fa2c38597 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx @@ -43,6 +43,7 @@ import { SequentialScheme, legacyValidateInteger, validateNonEmpty, + JsonArray, } from '@superset-ui/core'; import { @@ -340,7 +341,10 @@ const order_desc: SharedControlConfig<'CheckboxControl'> = { default: true, description: t('Whether to sort descending or ascending'), visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), + Boolean( + controls?.timeseries_limit_metric.value && + (controls?.timeseries_limit_metric.value as JsonArray).length, + ), }; const limit: SharedControlConfig<'SelectControl'> = { diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts index c87bcc0fef68b..ca18b712b82f9 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts @@ -34,18 +34,8 @@ const config: ControlPanelConfig = { ['adhoc_filters'], ['groupby'], ['limit', 'timeseries_limit_metric'], + ['order_desc'], [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, { name: 'contribution', config: { diff --git a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts index a8f8d7e7be3ce..ea87c024e8533 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts @@ -37,18 +37,8 @@ const config: ControlPanelConfig = { }, ], ['limit', 'timeseries_limit_metric'], + ['order_desc'], [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, { name: 'contribution', config: { diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/controlPanel.ts index 7023f019ee28c..66fd5dcca834c 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/controlPanel.ts @@ -32,19 +32,7 @@ const config: ControlPanelConfig = { ['adhoc_filters'], ['limit', 'row_limit'], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], ], }, { diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx b/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx index 03c18b601612c..c742e6d1335cb 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx +++ b/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx @@ -40,18 +40,8 @@ const config: ControlPanelConfig = { ['adhoc_filters'], ['groupby'], ['limit', 'timeseries_limit_metric'], + ['order_desc'], [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, { name: 'contribution', config: { diff --git a/superset-frontend/plugins/legacy-plugin-chart-pivot-table/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-pivot-table/src/controlPanel.ts index b1dd768e1d4b4..e4c0b477c4827 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-pivot-table/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-pivot-table/src/controlPanel.ts @@ -39,19 +39,7 @@ const config: ControlPanelConfig = { ['columns'], ['row_limit', null], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], ], }, { diff --git a/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx b/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx index a400095185fc1..fd04117e6217c 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx +++ b/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx @@ -38,18 +38,8 @@ const config: ControlPanelConfig = { ['adhoc_filters'], ['groupby'], ['limit', 'timeseries_limit_metric'], + ['order_desc'], [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, { name: 'contribution', config: { diff --git a/superset-frontend/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts index 666bbd41ddd68..bc400d2f4b0a9 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts @@ -36,19 +36,7 @@ const config: ControlPanelConfig = { ['groupby'], ['row_limit'], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], ], }, { diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts index ed8b31b9e9809..3df9e00057b1a 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts @@ -51,19 +51,7 @@ const config: ControlPanelConfig = { ['columns'], ['row_limit'], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], [ { name: 'contribution', diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx index bae735b692bad..87503166b7977 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx @@ -83,19 +83,7 @@ const config: ControlPanelConfig = { emitFilterControl, ['limit'], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], ['row_limit'], ], }, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx index 08d09a0147272..bd40eeebe0e75 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx @@ -80,19 +80,7 @@ const config: ControlPanelConfig = { emitFilterControl, ['limit'], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], ['row_limit'], ], }, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx index 21110c82cfefa..4cdf16c8395a2 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx @@ -60,19 +60,7 @@ const config: ControlPanelConfig = { emitFilterControl, ['limit'], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], ['row_limit'], ], }, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/controlPanel.tsx index 701c3a57ff561..d2f3acce9e08f 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/controlPanel.tsx @@ -77,19 +77,7 @@ const config: ControlPanelConfig = { emitFilterControl, ['limit'], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], ['row_limit'], ], }, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx index 8b40330730af5..1416a7db4686c 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx @@ -83,19 +83,7 @@ const config: ControlPanelConfig = { emitFilterControl, ['limit'], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], ['row_limit'], ], }, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx index f7fd56b7fa577..1f1e22b49b3a5 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx @@ -84,19 +84,7 @@ const config: ControlPanelConfig = { emitFilterControl, ['limit'], ['timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, - ], + ['order_desc'], ['row_limit'], ], }, diff --git a/superset-frontend/src/explore/controlPanels/sections.tsx b/superset-frontend/src/explore/controlPanels/sections.tsx index c1c68ad2f70b0..a1c786a73c15d 100644 --- a/superset-frontend/src/explore/controlPanels/sections.tsx +++ b/superset-frontend/src/explore/controlPanels/sections.tsx @@ -108,18 +108,8 @@ export const NVD3TimeSeries: ControlPanelSectionConfig[] = [ ['adhoc_filters'], ['groupby'], ['limit', 'timeseries_limit_metric'], + ['order_desc'], [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort descending'), - default: true, - description: t('Whether to sort descending or ascending'), - visibility: ({ controls }) => - Boolean(controls?.timeseries_limit_metric.value), - }, - }, { name: 'contribution', config: {