chore: use order_desc shared control consistently (#19172)

This commit is contained in:
Stephen Liu 2022-03-18 21:28:47 +08:00 committed by GitHub
parent b5e9fad11a
commit 10eb6c77a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 20 additions and 186 deletions

View File

@ -43,6 +43,7 @@ import {
SequentialScheme,
legacyValidateInteger,
validateNonEmpty,
JsonArray,
} from '@superset-ui/core';
import {
@ -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'> = {

View File

@ -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: {

View File

@ -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: {

View File

@ -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'],
],
},
{

View File

@ -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: {

View File

@ -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'],
],
},
{

View File

@ -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: {

View File

@ -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'],
],
},
{

View File

@ -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',

View File

@ -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'],
],
},

View File

@ -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'],
],
},

View File

@ -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'],
],
},

View File

@ -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'],
],
},

View File

@ -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'],
],
},

View File

@ -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'],
],
},

View File

@ -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: {