bito-code-review[bot] commented on code in PR #42941:
URL: https://github.com/apache/superset/pull/42941#discussion_r3745410291


##########
superset-frontend/plugins/plugin-chart-country-map/src/controlPanel.ts:
##########
@@ -71,6 +72,36 @@ const config: ControlPanelConfig = {
         ],
         ['currency_format'],
         ['linear_color_scheme'],
+        [
+          {
+            name: 'conditional_formatting',
+            config: {
+              type: 'ConditionalFormattingControl',
+              renderTrigger: true,
+              label: t('Custom conditional formatting'),
+              description: t(
+                'Apply conditional color formatting to numeric columns',
+              ),
+              shouldMapStateToProps() {
+                return true;
+              },
+              mapStateToProps(_, chart) {
+                const chartStatus = chart?.chartStatus;
+                const columnOptions = [
+                  {
+                    value: 'metric',
+                    label: 'metric',
+                    dataType: GenericDataType.Numeric,
+                  },
+                ];
+                return {
+                  removeIrrelevantConditions: chartStatus === 'success',
+                  columnOptions,
+                };
+              },
+            },
+          },
+        ],

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing verboseMap prop</b></div>
   <div id="fix">
   
   Add the required `verboseMap` property to the object returned by 
`mapStateToProps`, similar to other plugins, so that 
`ConditionalFormattingControl` receives its required prop and does not crash.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #3192dd</i></small>
   </div><div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Hardcoded columnOptions breaks control</b></div>
   <div id="fix">
   
   The `columnOptions` is hardcoded to only `[{ value: 'metric', label: 
'metric' }]`, making all real data columns inaccessible in the conditional 
formatting UI. Compare with the working pattern in 
`BigNumberTotal/controlPanel.ts:101-118` which extracts `colnames`/`coltypes` 
from `chart?.queriesResponse?.[0]` and dynamically builds options filtered by 
`GenericDataType.Numeric`.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #608927</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to