fix(generic-chart-axes): set x-axis if unset and ff is enabled (#20107)

* fix(generic-chart-axes): set x-axis if unset and ff is enabled

* simplify

* simplify

* continue cleanup

* yet more cleanup
This commit is contained in:
Ville Brofeldt
2022-05-19 13:21:25 +03:00
committed by GitHub
parent 660af409a4
commit 0b3d3dd4ca
4 changed files with 40 additions and 19 deletions

View File

@@ -19,13 +19,14 @@
import React from 'react';
import { t, validateNonEmpty } from '@superset-ui/core';
import {
formatSelectOptionsForRange,
ColumnOption,
columnChoices,
ColumnOption,
ColumnMeta,
ControlPanelConfig,
ControlState,
formatSelectOptionsForRange,
sections,
SelectControlConfig,
ColumnMeta,
} from '@superset-ui/chart-controls';
const config: ControlPanelConfig = {
@@ -46,10 +47,8 @@ const config: ControlPanelConfig = {
choices: columnChoices(state?.datasource),
}),
// choices is from `mapStateToProps`
default: (control: { choices?: string[] }) =>
control.choices && control.choices.length > 0
? control.choices[0][0]
: null,
default: (control: ControlState) =>
control.choices?.[0]?.[0] || null,
validators: [validateNonEmpty],
},
},