mirror of
https://github.com/apache/superset.git
synced 2026-04-27 20:14:54 +00:00
refactor(standardized form data): refine interface and improve code smells (#20518)
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
ControlSetRow,
|
||||
CustomControlItem,
|
||||
emitFilterControl,
|
||||
getStandardizedControls,
|
||||
sections,
|
||||
sharedControls,
|
||||
} from '@superset-ui/chart-controls';
|
||||
@@ -449,15 +450,23 @@ const config: ControlPanelConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
denormalizeFormData: formData => {
|
||||
const groupby =
|
||||
formData.standardizedFormData.standardizedState.columns.filter(
|
||||
col => !ensureIsArray(formData.groupby_b).includes(col),
|
||||
formDataOverrides: formData => {
|
||||
const groupby = getStandardizedControls().controls.columns.filter(
|
||||
col => !ensureIsArray(formData.groupby_b).includes(col),
|
||||
);
|
||||
getStandardizedControls().controls.columns =
|
||||
getStandardizedControls().controls.columns.filter(
|
||||
col => !groupby.includes(col),
|
||||
);
|
||||
const metrics =
|
||||
formData.standardizedFormData.standardizedState.metrics.filter(
|
||||
metric => !ensureIsArray(formData.metrics_b).includes(metric),
|
||||
|
||||
const metrics = getStandardizedControls().controls.metrics.filter(
|
||||
metric => !ensureIsArray(formData.metrics_b).includes(metric),
|
||||
);
|
||||
getStandardizedControls().controls.metrics =
|
||||
getStandardizedControls().controls.metrics.filter(
|
||||
col => !metrics.includes(col),
|
||||
);
|
||||
|
||||
return {
|
||||
...formData,
|
||||
metrics,
|
||||
|
||||
Reference in New Issue
Block a user