From f41c18df451fa6666257667fd9022b2d93a70467 Mon Sep 17 00:00:00 2001 From: cccs-RyanS <71385290+cccs-RyanS@users.noreply.github.com> Date: Tue, 17 Jan 2023 14:34:12 -0500 Subject: [PATCH] [CLDN-1829] fixing principle filter logic with state (#234) (#244) * [CLDN-1829] fixing principle filter logic with state * [CLDN-1829] Fixing build error --- .../src/plugin/controlPanel.tsx | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-cccs-grid/src/plugin/controlPanel.tsx b/superset-frontend/src/cccs-viz/plugins/plugin-chart-cccs-grid/src/plugin/controlPanel.tsx index 10798a0923dd5..d06d18309fc71 100644 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-cccs-grid/src/plugin/controlPanel.tsx +++ b/superset-frontend/src/cccs-viz/plugins/plugin-chart-cccs-grid/src/plugin/controlPanel.tsx @@ -103,18 +103,6 @@ const validateAggControlValues = ( : []; }; -const validateAggColumnValues = ( - controls: ControlStateMapping, - values: any[], - state: ControlPanelState, -) => { - const result = validateAggControlValues(controls, values); - if (result.length === 0 && isAggMode({ controls })) { - return []; - } - return result; -}; - // function isIP(v: unknown) { // if (typeof v === 'string' && v.trim().length > 0) { // //console.log(v.trim()); @@ -239,13 +227,8 @@ const config: ControlPanelConfig = { return newState; }, - rerender: [ - 'metrics', - 'percent_metrics', - 'principalEmitFilterColumn', - ], - canCopy: true, - } as typeof sharedControls.groupby, + rerender: ['metrics', 'percent_metrics'], + }, }, ], [ @@ -437,8 +420,9 @@ const config: ControlPanelConfig = { controlState: ControlState, ) => { const { controls } = state; - const originalMapStateToProps = - sharedControls?.columns?.mapStateToProps; + const originalMapStateToProps = isRawMode({ controls }) + ? sharedControls?.columns?.mapStateToProps + : sharedControls?.groupby?.mapStateToProps; const newState = originalMapStateToProps?.(state, controlState) ?? {}; const choices = isRawMode({ controls })