From c714ca9f2917928244ab2e913e987cbc51ac1b04 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Thu, 17 Aug 2017 23:26:07 -0700 Subject: [PATCH 1/2] [dashboard] re-enabling cascading filters https://github.com/apache/incubator-superset/pull/3183 disabled the ability of a filterbox to get filtered by another filterbox --- docs/faq.rst | 6 ++++++ superset/assets/javascripts/dashboard/Dashboard.jsx | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index b6f2788e90734..82280ed46bdfe 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -190,3 +190,9 @@ How can i configure OAuth authentication and authorization? You can take a look at this Flask-AppBuilder `configuration example `_. + +How can I set a default filter on my dashboard? +----------------------------------------------- + +Easy. Simply apply the filter and save the dashboard while the filter +is active. diff --git a/superset/assets/javascripts/dashboard/Dashboard.jsx b/superset/assets/javascripts/dashboard/Dashboard.jsx index 7cc7699c44785..2b250186bc107 100644 --- a/superset/assets/javascripts/dashboard/Dashboard.jsx +++ b/superset/assets/javascripts/dashboard/Dashboard.jsx @@ -170,10 +170,6 @@ export function dashboardContainer(dashboard, datasources, userid) { } }, effectiveExtraFilters(sliceId) { - // Don't filter the filter_box itself by preselect_filters - if (this.getSlice(sliceId).formData.viz_type === 'filter_box') { - return []; - } const f = []; const immuneSlices = this.metadata.filter_immune_slices || []; if (sliceId && immuneSlices.includes(sliceId)) { @@ -190,6 +186,10 @@ export function dashboardContainer(dashboard, datasources, userid) { immuneToFields = this.metadata.filter_immune_slice_fields[sliceId]; } for (const filteringSliceId in this.filters) { + if (filteringSliceId == sliceId) { + // Filters applied by the slice don't apply to itself + continue; + } for (const field in this.filters[filteringSliceId]) { if (!immuneToFields.includes(field)) { f.push({ From 2764f5a9b609509761b35b4be56ffb596cf1d6bb Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Fri, 18 Aug 2017 12:28:17 -0700 Subject: [PATCH 2/2] linting --- superset/assets/javascripts/dashboard/Dashboard.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/assets/javascripts/dashboard/Dashboard.jsx b/superset/assets/javascripts/dashboard/Dashboard.jsx index 2b250186bc107..3c7b912d65dac 100644 --- a/superset/assets/javascripts/dashboard/Dashboard.jsx +++ b/superset/assets/javascripts/dashboard/Dashboard.jsx @@ -186,7 +186,7 @@ export function dashboardContainer(dashboard, datasources, userid) { immuneToFields = this.metadata.filter_immune_slice_fields[sliceId]; } for (const filteringSliceId in this.filters) { - if (filteringSliceId == sliceId) { + if (filteringSliceId === sliceId) { // Filters applied by the slice don't apply to itself continue; }