korbit-ai[bot] commented on code in PR #33540:
URL: https://github.com/apache/superset/pull/33540#discussion_r2097744457


##########
superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx:
##########
@@ -343,6 +343,26 @@ const config: ControlPanelConfig = {
             },
           },
         ],
+        [
+          {
+            name: 'order_desc',
+            config: {
+              type: 'CheckboxControl',
+              label: t('Sort descending'),
+              default: true,
+              description: t(
+                'If enabled, this control sorts the results/values descending, 
otherwise it sorts the results ascending.',
+              ),
+              visibility: ({ controls }: ControlPanelsContainerProps) => {
+                const hasSortMetric = Boolean(
+                  controls?.timeseries_limit_metric?.value,
+                );
+                return hasSortMetric && isAggMode({ controls });
+              },

Review Comment:
   ### Missing Sort Direction Control in Raw Mode <sub>![category 
Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The visibility condition doesn't handle the 'order_by_cols' control. The 
'Sort descending' checkbox should also be visible when 'order_by_cols' has a 
value in Raw mode.
   
   
   ###### Why this matters
   Users in Raw query mode won't be able to control the sort direction even 
when they have selected columns to sort by, which contradicts the expected 
sorting functionality.
   
   ###### Suggested change ∙ *Feature Preview*
   Update the visibility condition to include Raw mode with order_by_cols:
   
   ```typescript
   visibility: ({ controls }: ControlPanelsContainerProps) => {
     const hasSortMetric = Boolean(
       controls?.timeseries_limit_metric?.value,
     );
     const hasOrderByCols = Boolean(
       controls?.order_by_cols?.value?.length,
     );
     return (hasSortMetric && isAggMode({ controls })) || 
            (hasOrderByCols && isRawMode({ controls }));
   },
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4ae6bec-6d92-434f-bcb1-617b5d313c8f/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4ae6bec-6d92-434f-bcb1-617b5d313c8f?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4ae6bec-6d92-434f-bcb1-617b5d313c8f?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4ae6bec-6d92-434f-bcb1-617b5d313c8f?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/e4ae6bec-6d92-434f-bcb1-617b5d313c8f)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:856c473e-9472-446c-a2c1-64ecf176bce7 -->
   
   
   [](856c473e-9472-446c-a2c1-64ecf176bce7)



-- 
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