-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(native-filters): Show/Hide filter bar by metdata ff #14261
Conversation
� Conflicts: � superset-frontend/src/dashboard/util/getPermissions.ts
Codecov Report
@@ Coverage Diff @@
## master #14261 +/- ##
==========================================
+ Coverage 77.05% 77.13% +0.07%
==========================================
Files 954 954
Lines 48140 48149 +9
Branches 5986 5991 +5
==========================================
+ Hits 37096 37140 +44
+ Misses 10847 10812 -35
Partials 197 197
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
- tested that migration works
- when key doesn't exist it default to true as if only the DASHBOARD_NATIVE_FILTERS FF is calling the shots
- when key is false no filter bar
- when key is true , filter bar is shown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good feature and would probably be helpful in the migration effort leaving old dashboards as-is until a conscious decision to migrate has been made. However, for now I think we should only disable native filters for dashboards that have filter boxes added to them. In addition, I'd add a comment to UPDATING.md
to let users know that this option now exists and has been set to false for all charts that have filter boxes, otherwise end users might not know why certain dashboards are missing the feature. Also calling on @graceguo-supercat and @junlincc for feeback.
superset/migrations/versions/4fad8b8b566d_show_native_filters_dashboard_metadata.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to avoid adding a database migration for this.
If some dashboard owners would like to remove the filter bar from their dashboards, it makes sense to add a metadata json option that they can set, but setting it as the default seems like overkill. Especially so when the native filters are already behind a feature flag in the first place.
Side note: There are also efforts underway to build an option for dashboard owners to auto-migrate from filter box to native filters, so the issue of having filter boxes hanging around will hopefully be short lived.
Side note 2: In the case where a non-editor is viewing a dashboard that has no native filters, it might be better to not show the filter bar since it will just be empty.
.all() | ||
) | ||
|
||
changed_filters = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this variable used for something?
Currently dashboard has no automatic logic to convert filter_box into filter bar.
In short, we should show filter bar if dashboard has any native filter metadata, otherwise, hide filter bar by default. |
It enables you to hide the filter component in a specific Dashboard |
I think I'm going to replace the migration with side note 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also hide filter bar if no native filters exists
@simcha90
@suddjian added proposal:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making that change, this LGTM
* fix:fix get permission function * feat: hide native filters by metadata * fix: fix show_native_filters name * fix: metadata * chore: add migration to hide native_filters in all existing dashboards * chore: fix pre-commit * fix: make migration migration dashboard with filter_box only * fix: pre-commit * feat: hide filter bar if no permission edit and no filters * fix: remove migration Co-authored-by: amitmiran137 <[email protected]> (cherry picked from commit 2486fd4)
metadata = {}; | ||
} | ||
|
||
metadata.show_native_filters = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simcha90 @amitmiran137 @villebro should this use the DASHBOARD_NATIVE_FILTERS
feature flag for defining the fallback rather than defaulting to true
? We've seen instances at Airbnb where dashboard native filters are showing up in the dashboard metadata even though the feature is disabled.
* fix:fix get permission function * feat: hide native filters by metadata * fix: fix show_native_filters name * fix: metadata * chore: add migration to hide native_filters in all existing dashboards * chore: fix pre-commit * fix: make migration migration dashboard with filter_box only * fix: pre-commit * feat: hide filter bar if no permission edit and no filters * fix: remove migration Co-authored-by: amitmiran137 <[email protected]>
SUMMARY
As we are slowly releasing native filters we would like to have the ability per dashboard to choose if to hide/show the filter.
some of dashboard owners still not ready to just convert their filter boxes into native filters and although they could both live together having an empty filter bar might be confusing for end clients.
therefore we are adding the ability to
Show/Hide filter bar by using
show_native_filters
as another property within the dashboard metadata in addition to the Global feature flagBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION