This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new c1750af  [dashboard] clean up usage for old filter immune metadata 
(#9146)
c1750af is described below

commit c1750af54aa5088184abec09d4490b47d5dc4f8c
Author: Grace Guo <[email protected]>
AuthorDate: Wed Feb 19 09:58:34 2020 -0800

    [dashboard] clean up usage for old filter immune metadata (#9146)
    
    * [dashboard] clean up usage for filter_immune metadata
    
    * add fix per comment
---
 .../javascripts/dashboard/fixtures/mockDashboardInfo.js   |  5 +----
 .../src/dashboard/reducers/getInitialState.js             | 15 +--------------
 superset/views/core.py                                    | 10 +---------
 3 files changed, 3 insertions(+), 27 deletions(-)

diff --git 
a/superset-frontend/spec/javascripts/dashboard/fixtures/mockDashboardInfo.js 
b/superset-frontend/spec/javascripts/dashboard/fixtures/mockDashboardInfo.js
index 426a05e..228c724 100644
--- a/superset-frontend/spec/javascripts/dashboard/fixtures/mockDashboardInfo.js
+++ b/superset-frontend/spec/javascripts/dashboard/fixtures/mockDashboardInfo.js
@@ -19,10 +19,7 @@
 export default {
   id: 1234,
   slug: 'dashboardSlug',
-  metadata: {
-    filterImmuneSlices: [],
-    filterImmuneSliceFields: {},
-  },
+  metadata: {},
   userId: 'mock_user_id',
   dash_edit_perm: true,
   dash_save_perm: true,
diff --git a/superset-frontend/src/dashboard/reducers/getInitialState.js 
b/superset-frontend/src/dashboard/reducers/getInitialState.js
index b9ec8e6..9bf9344 100644
--- a/superset-frontend/src/dashboard/reducers/getInitialState.js
+++ b/superset-frontend/src/dashboard/reducers/getInitialState.js
@@ -101,9 +101,6 @@ export default function(bootstrapData) {
   let newSlicesContainer;
   let newSlicesContainerWidth = 0;
 
-  const filterImmuneSliceFields =
-    dashboard.metadata.filter_immune_slice_fields || {};
-  const filterImmuneSlices = dashboard.metadata.filter_immune_slices || [];
   const filterScopes = dashboard.metadata.filter_scopes || {};
 
   const chartQueries = {};
@@ -188,8 +185,6 @@ export default function(bootstrapData) {
           });
         }
 
-        // backward compatible:
-        // merge scoped filter settings with old global immune settings
         const scopesByChartId = Object.keys(columns).reduce((map, column) => {
           const scopeSettings = {
             ...filterScopes[key],
@@ -198,20 +193,12 @@ export default function(bootstrapData) {
             ...DASHBOARD_FILTER_SCOPE_GLOBAL,
             ...scopeSettings[column],
           };
-          const immuneChartIds = new Set(filterImmuneSlices);
-          Object.keys(filterImmuneSliceFields)
-            .filter(strChartId =>
-              filterImmuneSliceFields[strChartId].includes(column),
-            )
-            .forEach(strChartId => {
-              immuneChartIds.add(parseInt(strChartId, 10));
-            });
 
           return {
             ...map,
             [column]: {
               scope,
-              immune: [...immuneChartIds].concat(immune),
+              immune,
             },
           };
         }, {});
diff --git a/superset/views/core.py b/superset/views/core.py
index 69347f1..f94a906 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1263,16 +1263,8 @@ class Superset(BaseSupersetView):
 
         if "timed_refresh_immune_slices" not in md:
             md["timed_refresh_immune_slices"] = []
-
         if "filter_scopes" in data:
-            md.pop("filter_immune_slices", None)
-            md.pop("filter_immune_slice_fields", None)
-            md["filter_scopes"] = json.loads(data.get("filter_scopes", "{}"))
-        else:
-            if "filter_immune_slices" not in md:
-                md["filter_immune_slices"] = []
-            if "filter_immune_slice_fields" not in md:
-                md["filter_immune_slice_fields"] = {}
+            md["filter_scopes"] = json.loads(data["filter_scopes"] or "{}")
         md["expanded_slices"] = data["expanded_slices"]
         md["refresh_frequency"] = data.get("refresh_frequency", 0)
         default_filters_data = json.loads(data.get("default_filters", "{}"))

Reply via email to