When you share a dashboard (Copy Dashboard URL, Share dashboard by email, or click the link icon next to a tab, etc), the native filter values and deprecated filter values are exported with the shortened link. However, cross filters and the new experimental embedded filters (eg, Range Filter, Select Filter, etc) are NOT exported.
Expected results
When you share a dashboard's state with someone, you'd expect ALL parts of the state to be shared. This would include every filter's setting
Actual results
The Cross Filter-type filter values are not exported
How to reproduce the bug
- Add Native filters and Range Filter or Select Filter boxes to a dashboard. Also set a table to emit cross filters.
- Set several filter values, on Native Filters and the embedded Range Filter, as well as cross filters for a table.
- Click on the dashboard's three dots and choose "Copy dashboard URL"
- Paste this URL into a new browser tab
- Note that the Native Filter values are populated, but the Range Filter, Select Filter, and emitted Cross Filter values are not
Environment
- superset version: master, as of Aug 27 (last commit was 62d8ab7f9c044e2887de794484c30c2108213e0b) using the Docker version, so all other software is as-is from the Docker configs
- any feature flags active: "DASHBOARD_NATIVE_FILTERS": True, "DASHBOARD_CROSS_FILTERS": True, "DASHBOARD_FILTERS_EXPERIMENTAL": True, "ENABLE_EXPLORE_DRAG_AND_DROP": False, "ENABLE_TEMPLATE_PROCESSING": True, "DYNAMIC_PLUGINS": True, "DASHBOARD_RBAC": True,
Checklist
- [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [x] I have reproduced the issue with at least the latest released version of superset.
- [x] I have checked the issue tracker for the same issue and I haven't found one similar.
Additional context
A little discussion here: https://apache-superset.slack.com/archives/C016B3LG5B4/p1629643453183200
The generated URLs are shortened, but prior to getting shortened, they're basically a bunch of URL parameters. I dug around and found that the Native Filters and old (deprecated) filter boxes are properly exported, but in file src/dashboard/actions/hydrate.js is what loads the preselect_filters and native_filters from the URL parameters. There's a section on setting up cross filters, but not loading any values for them from URL params. It also doesn't do anything for things like Range Filters.
I tried changing line 194, which only looks for "filter_box" elements, to instead include "filter_*" so that it would catch the range filters. It generated this example set of URL parameters:
preselect_filters={"998":{"COLUMN_NAME":"All"},"1104":{"ANOTHER_COLUMN_NAME":{"filters":[{"col":"ANOTHER_COLUMN_NAME","op":">=","val":93.75}]}}}&native_filters=(NATIVE_FILTER-XofC8k3la:(extraFormData:(),filterState:(),id:NATIVE_FILTER-XofC8k3la,ownState:()))
element 998 is an old-school (apparently deprecated) filter, element 1104 is a range filter (cross filter), and I had no value set for my one native filter. This link doesn't actually apply the set values to element 1104.
I might be able to fix this myself, if I get some assistance on where to look. These filters seem to apply similar to cross filters rather than native filters, so I'm guessing I need to look there.
Comment From: michael-s-molina
Back-end part to fix this: #17536
The front-end part will come next.
Comment From: stevetracvc
Awesome thanks @michael-s-molina ! So this should fix all the issues related to filter state?
What about old saved URLs? eg, our team already is using /r/156 for something. Will loading state from URL be kept long-term, or do you expect these to be deprecated and thus migrated to the new form? I would vote to NOT deprecate, as I also build links in the dashboard, to take you to another tab with filters pre-set. Eg, I have a table with data. One column is a list of names, and they're from a calculated column in the table that I built to generate a link to another dashboard, pre-filling filter values for that name. Sort of like a clunky drill-down.
Comment From: stale[bot]
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned
to prevent stale bot from closing the issue.
Comment From: simonvanderveldt
@michael-s-molina Do you know what needs to be done for this and if any progress has been made on this?
Comment From: michael-s-molina
@simonvanderveldt I think this was fixed. I'll close the issue but please reopen it if the bug still exists.
Comment From: jwdalton
@michael-s-molina I just tried this, and it doesn't seem to work in superset 4.0.1. Specifically, the native filter values are saved, but any selected cross filter values are not saved when creating a permalink for a dashboard.
It does look like the cross filter value is being stored in the permalink json in the key_value
table when the permalink is created, so maybe the issue is how it is being applied/used when the permalink is loaded?
Would you be able to re-open this issue?
Comment From: rusackas
Anyone interested in tackling this? If not, it may be closed as not-planned before too long. We can always move it to an Ideas Discussion if it's simply not (yet) a supported feature.
Comment From: rusackas
Can anyone say if this working in 5.0 (or master
) or not? Closing as not-planned for now, but happy to reopen if folks still see it as an issue.