You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/07/01 05:08:14 UTC

[GitHub] [superset] simcha90 commented on a change in pull request #15454: feat(dashboard-groupby): group by - add ability to exclude columns

simcha90 commented on a change in pull request #15454:
URL: https://github.com/apache/superset/pull/15454#discussion_r661978465



##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx
##########
@@ -101,11 +103,16 @@ export function ColumnSelect({
         endpoint: `/api/v1/dataset/${datasetId}`,
       }).then(
         ({ json: { result } }) => {
-          if (
-            !result.columns.some(
-              (column: Column) => column.column_name === value,
-            )
-          ) {
+          const valueExist =
+            mode === 'multiple'
+              ? result.columns.some((column: Column) =>
+                  value?.includes(column.column_name),
+                )
+              : result.columns.some(
+                  (column: Column) => column.column_name === value,
+                );
+
+          if (!valueExist) {

Review comment:
       may be we can do it shorter:
   ```
   const lookupValue = Array.isArray(value) ? value : [value]
   const valueExist = result.columns.some((column: Column) =>
                     value?.includes(column.column_name),
                   )
   ```




-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org