Skip to content

Commit

Permalink
chore: use order_desc shared control consistently (#19172)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenLYZ authored Mar 18, 2022
1 parent b5e9fad commit 10eb6c7
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
SequentialScheme,
legacyValidateInteger,
validateNonEmpty,
JsonArray,
} from '@superset-ui/core';

import {
Expand Down Expand Up @@ -345,7 +346,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'> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
],
},
Expand Down
12 changes: 1 addition & 11 deletions superset-frontend/src/explore/controlPanels/sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 10eb6c7

Please sign in to comment.