Skip to content

Commit

Permalink
chore: use order_desc shared control consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenLYZ committed Mar 16, 2022
1 parent 30c97ad commit 5d2916f
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 @@ -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'> = {
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 5d2916f

Please sign in to comment.