From d5768ab649a70fd4f541ad4982498f622160b220 Mon Sep 17 00:00:00 2001 From: Stephen Liu <750188453@qq.com> Date: Tue, 21 Dec 2021 15:27:21 +0800 Subject: [PATCH] fix(explore): make SORT-Descending visible if Sort-by has value (#17726) --- .../plugins/legacy-plugin-chart-horizon/src/controlPanel.ts | 2 ++ .../legacy-plugin-chart-paired-t-test/src/controlPanel.ts | 2 ++ .../src/controlPanel.ts | 2 ++ .../plugins/legacy-plugin-chart-partition/src/controlPanel.tsx | 2 ++ .../plugins/legacy-plugin-chart-pivot-table/src/controlPanel.ts | 2 ++ .../plugins/legacy-plugin-chart-rose/src/controlPanel.tsx | 2 ++ .../plugins/legacy-plugin-chart-treemap/src/controlPanel.ts | 2 ++ .../legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts | 2 ++ .../plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx | 2 ++ .../plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx | 2 ++ .../src/Timeseries/Regular/Bar/controlPanel.tsx | 2 ++ .../src/Timeseries/Regular/Scatter/controlPanel.tsx | 2 ++ .../src/Timeseries/Regular/controlPanel.tsx | 2 ++ .../plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx | 2 ++ .../plugin-chart-echarts/src/Timeseries/controlPanel.tsx | 2 ++ superset-frontend/src/explore/controlPanels/sections.tsx | 2 ++ 16 files changed, 32 insertions(+) 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 63571600d..c87bcc0fe 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts @@ -42,6 +42,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, { 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 f3504ea64..a8f8d7e7b 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 @@ -45,6 +45,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, { 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 2b24a090f..7023f019e 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 @@ -40,6 +40,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], 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 488168912..bee80945f 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx +++ b/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx @@ -48,6 +48,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, { 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 d992829c7..b1dd768e1 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 @@ -47,6 +47,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], 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 ed173951d..72acb6157 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx +++ b/superset-frontend/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx @@ -46,6 +46,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, { 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 972639601..666bbd41d 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts @@ -44,6 +44,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], 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 b1459ddea..ed8b31b9e 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 @@ -59,6 +59,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx index 8a84263ba..a71db9d3d 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx @@ -354,6 +354,8 @@ export const timeSeriesSection: ControlPanelSectionConfig[] = [ label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], 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 44d1e80d1..0dcc76fcc 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 @@ -89,6 +89,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], 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 68460e1ec..990233642 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 @@ -86,6 +86,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], 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 772e2b06f..a2a344656 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 @@ -66,6 +66,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], 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 d7159472f..3e0dc46b4 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 @@ -83,6 +83,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], 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 a006d0f66..1deb72379 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 @@ -89,6 +89,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], 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 2763a62c0..5878882d3 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx @@ -90,6 +90,8 @@ const config: ControlPanelConfig = { label: t('Sort Descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, ], diff --git a/superset-frontend/src/explore/controlPanels/sections.tsx b/superset-frontend/src/explore/controlPanels/sections.tsx index b231fd5f2..4ff269df3 100644 --- a/superset-frontend/src/explore/controlPanels/sections.tsx +++ b/superset-frontend/src/explore/controlPanels/sections.tsx @@ -125,6 +125,8 @@ export const NVD3TimeSeries: ControlPanelSectionConfig[] = [ label: t('Sort descending'), default: true, description: t('Whether to sort descending or ascending'), + visibility: ({ controls }) => + Boolean(controls?.timeseries_limit_metric.value), }, }, {