You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2018/01/25 00:26:33 UTC

[incubator-superset] branch master updated: deck_multi to pass down filters to layers (#4270)

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

maximebeauchemin 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 94d9337  deck_multi to pass down filters to layers (#4270)
94d9337 is described below

commit 94d9337e0b8a2eee174a65363d25db77a282f521
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Wed Jan 24 16:26:31 2018 -0800

    deck_multi to pass down filters to layers (#4270)
    
    Filters applied to deck_multi will be passed down to layers as.
    
    If the column isn't set as "filterable", the filter is ignored.
    
    Also note that Dashboard configuration in regards to
    "filter_immune_slices" and such will be disregarded in this context as
    it isn't the dashboard controller passing down the filter and that
    context is not easily accessible here.
---
 superset/assets/visualizations/deckgl/multi.jsx | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/superset/assets/visualizations/deckgl/multi.jsx b/superset/assets/visualizations/deckgl/multi.jsx
index 63f1a88..a1bac28 100644
--- a/superset/assets/visualizations/deckgl/multi.jsx
+++ b/superset/assets/visualizations/deckgl/multi.jsx
@@ -32,11 +32,26 @@ function deckMulti(slice, payload, setControlValue) {
   };
   render();
   payload.data.slices.forEach((subslice) => {
-    const url = getExploreUrl(subslice.form_data, 'json');
+    // Filters applied to multi_deck are passed down to underlying charts
+    // note that dashboard contextual information (filter_immune_slices and such) aren't
+    // taken into consideration here
+    let filters = subslice.form_data.filters.concat(fd.filters);
+    if (fd.extra_filters) {
+      filters = filters.concat(fd.extra_filters);
+    }
+    const subsliceCopy = {
+      ...subslice,
+      form_data: {
+        ...subslice.form_data,
+        filters,
+      },
+    };
+
+    const url = getExploreUrl(subsliceCopy.form_data, 'json');
     $.get(url, (data) => {
       // Late import to avoid circular deps
-      const layer = layerGenerators[subslice.form_data.viz_type](subslice.form_data, data);
-      slice.subSlicesLayers[subslice.slice_id] = layer; // eslint-disable-line no-param-reassign
+      const layer = layerGenerators[subsliceCopy.form_data.viz_type](subsliceCopy.form_data, data);
+      slice.subSlicesLayers[subsliceCopy.slice_id] = layer; // eslint-disable-line no-param-reassign
       render();
     });
   });

-- 
To stop receiving notification emails like this one, please contact
maximebeauchemin@apache.org.