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 2019/11/08 00:16:24 UTC

[GitHub] [incubator-superset] etr2460 commented on a change in pull request #8521: [WIP][dashboard scoped filter] part 2: add algorithm to convert checked ids to scope object

etr2460 commented on a change in pull request #8521: [WIP][dashboard scoped filter] part 2: add algorithm to convert checked ids to scope object
URL: https://github.com/apache/incubator-superset/pull/8521#discussion_r343938467
 
 

 ##########
 File path: superset/assets/src/dashboard/util/getFilterScopeNodesTree.js
 ##########
 @@ -25,83 +27,93 @@ import {
 
 const FILTER_SCOPE_CONTAINER_TYPES = [TAB_TYPE, DASHBOARD_ROOT_TYPE];
 
-export default function getFilterScopeNodesTree({
+function traverse({
+  currentNode = {},
   components = {},
-  isSingleEditMode = true,
-  checkedFilterFields = [],
-  selectedChartId,
+  filterFields = [],
+  selectedChartId = 0,
 }) {
-  function traverse(currentNode) {
-    if (!currentNode) {
-      return null;
-    }
-
-    const type = currentNode.type;
-    if (CHART_TYPE === type && currentNode.meta.chartId) {
-      const chartNode = {
-        value: currentNode.meta.chartId,
-        label:
-          currentNode.meta.sliceName || `${type} ${currentNode.meta.chartId}`,
-        type,
-        showCheckbox: selectedChartId !== currentNode.meta.chartId,
-      };
-
-      if (isSingleEditMode) {
-        return chartNode;
-      }
+  if (!currentNode) {
+    return null;
+  }
 
-      return {
-        ...chartNode,
-        children: checkedFilterFields.map(filterField => ({
-          value: `${currentNode.meta.chartId}:${filterField}`,
-          label: `${currentNode.meta.chartId}:${filterField}`,
-          type: 'filter_box',
-          showCheckbox: false,
-        })),
-      };
-    }
+  const type = currentNode.type;
+  if (CHART_TYPE === type && currentNode.meta.chartId) {
 
 Review comment:
   this will throw an error if currentNode isn't defined (as `{}.meta.chartId` will throw)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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