-
Notifications
You must be signed in to change notification settings - Fork 16.4k
fix: show_filters URL parameter is not working
#29422
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
Conversation
|
Thanks for the PR, @hexcafe. Hey @michael-s-molina @john-bodley, I checked out this PR locally and tested and it works ✅ but since I'm just getting familiar with frontend I wanted to get your thoughts. I didn't think so, but this also works with the horizontal filter bar 🙌 Thanks! |
|
@hexcafe @Vitor-Avila Shouldn't we just revert this part that was deleted in #23228? |
|
Any news about this PR? |
|
Would be great to see this one merged into next release. |
|
Can we please get this reviewed? |
|
@michael-s-molina would you prefer to have that code block restored as opposed to using the approach in this PR? |
@Vitor-Avila It seems we should restore that code given that |
|
Any progress on reviewing this fix? |
rusackas
left a comment
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.
Just rebased this, and it looks fine to me. Let's see if CI (still) passes.
|
I'm not sure if @Vitor-Avila or @michael-s-molina want to revisit restoring the old code block (which GitHub won't let me view at the moment for some reason 😢) but this PR looks pretty harmless to me in the meantime. |
|
I would like to prioritize getting this fix into the next release. If @hexcafe or someone else is up for restoring the old code block, great, but let's not let that hold this up further if no one can deliver that soon. (I just took an attempt but didn't get it working) |
|
@rusackas @michael-s-molina I restored the code from that PR locally (on top of
const showNativeFilters = useSelector<RootState, boolean>(
state => (getUrlParam(URL_PARAMS.showFilters) ?? true),
);
const nativeFiltersEnabled =
showNativeFilters &&
(canEdit || (!canEdit && filterValues.length !== 0));Still, when loading a dashboard with const showFilterBar = !editMode && nativeFiltersEnabled;Would it be better to build on top of this open PR or create a new one? |
|
I think just build on this PR to preserve hexcafe's contribution while also moving it forward while you're looking at the code |
|
@rusackas @sfirke @michael-s-molina I believe this should be all good now. Could I get a new review? Tried adding some tests, but manual tests are always encouraged haha 🙏 |
|
@sfirke Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments |
|
@sfirke Ephemeral environment spinning up at http://18.236.110.2:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup. |
| export const useNativeFilters = () => { | ||
| const [isInitialized, setIsInitialized] = useState(false); | ||
| const showNativeFilters = useSelector<RootState, boolean>( | ||
| state => getUrlParam(URL_PARAMS.showFilters) ?? true, |
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.
@Vitor-Avila The original code had && state.dashboardInfo.metadata?.show_native_filters. Isn't that needed anymore?
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.
@michael-s-molina my understanding is that the original PR fully removed metadata.show_native_filters (from all places). I suspect the reason for it is that this metadata config was intended to permanently hide the native filters on dashboards that had filter box, until it was fully migrated. So I don't think we need that back. If we want to bring that logic, we would need to re-update the schemas, and logic in other places too.
Not sure if you had a chance to test in that ephemeral but I believe things are working properly with these changes.
|
@sfirke I noticed you created an ephemeral here -- let me know when you're good with testing and I'll merge this one. 🙌 |
|
Hi @Vitor-Avila - I just tested in the ephemeral and it looks ready to merge 🚀 Thanks for this fix! |
|
This actually closes two issues, I just linked the other in the top post. |
|
awesome! thanks for taking the time to test it. Just merged it |
Co-authored-by: Evan Rusackas <[email protected]> Co-authored-by: Vitor Avila <[email protected]> (cherry picked from commit bcb4332)
Co-authored-by: Evan Rusackas <[email protected]> Co-authored-by: Vitor Avila <[email protected]> (cherry picked from commit bcb4332)
Co-authored-by: Evan Rusackas <[email protected]> Co-authored-by: Vitor Avila <[email protected]> (cherry picked from commit bcb4332)
SUMMARY
The
show_filtersURL param is no longer working (logic to handle it was removed with #23228).This PR re-introduces the logic pertinent to this flow from that PR + updates
DashboardBuilderso that it works with currentmaster.This fix should also reflect to embedded when setting
filters.visibletofalsethrough the SDK configuration.Fixes #26758.
Fixes #30538.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Tested both with horizontal and vertical filter bar:

Embedded:

TESTING INSTRUCTIONS
Tests added. For manual testing:
show_filters=falseas a URL parameter and access it.ADDITIONAL INFORMATION