From 290b89c7b4ae702c55f611bfac9cedb245ea8bd8 Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Fri, 1 Jul 2022 14:51:59 +0800 Subject: [PATCH] feat: apply standardized form data to deckgl (#20579) --- .../src/layers/Grid/controlPanel.ts | 10 +++++++++- .../src/layers/Hex/controlPanel.ts | 10 +++++++++- .../src/layers/Polygon/controlPanel.ts | 10 +++++++++- .../src/layers/Screengrid/controlPanel.ts | 10 +++++++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/controlPanel.ts index a96fe21dd68a7..bd0f797ba6134 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/controlPanel.ts @@ -16,7 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { + ControlPanelConfig, + getStandardizedControls, + sections, +} from '@superset-ui/chart-controls'; import { t, validateNonEmpty } from '@superset-ui/core'; import { filterNulls, @@ -71,6 +75,10 @@ const config: ControlPanelConfig = { validators: [validateNonEmpty], }, }, + formDataOverrides: formData => ({ + ...formData, + size: getStandardizedControls().shiftMetric(), + }), }; export default config; diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts index 4db5e39b964a1..53c816ae8038f 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts @@ -16,7 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { + ControlPanelConfig, + getStandardizedControls, + sections, +} from '@superset-ui/chart-controls'; import { t } from '@superset-ui/core'; import { formatSelectOptions } from '../../utilities/utils'; import { @@ -96,6 +100,10 @@ const config: ControlPanelConfig = { ], }, ], + formDataOverrides: formData => ({ + ...formData, + size: getStandardizedControls().shiftMetric(), + }), }; export default config; diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts index faea2336bb48e..a226004c76f78 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts @@ -16,7 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { + ControlPanelConfig, + getStandardizedControls, + sections, +} from '@superset-ui/chart-controls'; import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core'; import timeGrainSqlaAnimationOverrides from '../../utilities/controls'; import { formatSelectOptions } from '../../utilities/utils'; @@ -194,6 +198,10 @@ const config: ControlPanelConfig = { }, time_grain_sqla: timeGrainSqlaAnimationOverrides, }, + formDataOverrides: formData => ({ + ...formData, + metric: getStandardizedControls().shiftMetric(), + }), }; export default config; diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts index 733d12ca21b86..caf052581cbb5 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts @@ -16,7 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { + ControlPanelConfig, + getStandardizedControls, + sections, +} from '@superset-ui/chart-controls'; import { t, validateNonEmpty } from '@superset-ui/core'; import timeGrainSqlaAnimationOverrides from '../../utilities/controls'; import { @@ -76,6 +80,10 @@ const config: ControlPanelConfig = { }, time_grain_sqla: timeGrainSqlaAnimationOverrides, }, + formDataOverrides: formData => ({ + ...formData, + size: getStandardizedControls().shiftMetric(), + }), }; export default config;