From d302f8679e1fc0f9722e21adcb42557899b2cf05 Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Tue, 18 May 2021 23:38:09 +0800 Subject: [PATCH] feat: add orderby shared control --- .../src/shared-controls/dndControls.tsx | 2 +- .../src/shared-controls/index.tsx | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/superset-ui-chart-controls/src/shared-controls/dndControls.tsx b/packages/superset-ui-chart-controls/src/shared-controls/dndControls.tsx index cdb1aa11c1..b51e8f9f95 100644 --- a/packages/superset-ui-chart-controls/src/shared-controls/dndControls.tsx +++ b/packages/superset-ui-chart-controls/src/shared-controls/dndControls.tsx @@ -112,7 +112,7 @@ export const dnd_adhoc_metric: SharedControlConfig<'DndMetricSelect'> = { default: (c: Control) => mainMetric(c.savedMetrics), }; -export const dnd_timeseries_limit_metric: SharedControlConfig<'DndMetricSelect'> = { +export const dnd_sort_by: SharedControlConfig<'DndMetricSelect'> = { type: 'DndMetricSelect', label: t('Sort by'), default: null, diff --git a/packages/superset-ui-chart-controls/src/shared-controls/index.tsx b/packages/superset-ui-chart-controls/src/shared-controls/index.tsx index 3bb9c13e1d..b58af87b45 100644 --- a/packages/superset-ui-chart-controls/src/shared-controls/index.tsx +++ b/packages/superset-ui-chart-controls/src/shared-controls/index.tsx @@ -69,7 +69,7 @@ import { dnd_adhoc_filters, dnd_adhoc_metric, dnd_adhoc_metrics, - dnd_timeseries_limit_metric, + dnd_sort_by, dndColumnsControl, dndEntity, dndGroupByControl, @@ -339,7 +339,7 @@ const limit: SharedControlConfig<'SelectControl'> = { ), }; -const timeseries_limit_metric: SharedControlConfig<'MetricsControl'> = { +const sort_by: SharedControlConfig<'MetricsControl'> = { type: 'MetricsControl', label: t('Sort By'), default: null, @@ -481,7 +481,8 @@ const sharedControls = { time_range, row_limit, limit, - timeseries_limit_metric: enableExploreDnd ? dnd_timeseries_limit_metric : timeseries_limit_metric, + timeseries_limit_metric: enableExploreDnd ? dnd_sort_by : sort_by, + orderby: enableExploreDnd ? dnd_sort_by : sort_by, series: enableExploreDnd ? dndSeries : series, entity: enableExploreDnd ? dndEntity : entity, x,