-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Persistent list filters #12229
Persistent list filters #12229
Conversation
@@ -39,7 +43,7 @@ function RoutedTabs({ tabsArray }) { | |||
aria-label={typeof tab.name === 'string' ? tab.name : null} | |||
eventKey={tab.id} | |||
key={tab.id} | |||
link={tab.link} | |||
href={`#${tab.link}`} |
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.
This is a bit quirky... help the URL appear correctly while mousing over the link.
Ideally, I'd like to remove the hash from URLs entirely to make this unnecessary, but it may be too late for that
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.
import { useEffect } from 'react'; | ||
import { useLocation, useHistory } from 'react-router'; | ||
|
||
const STORAGE_KEY = 'persistentFilter'; |
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 could move this one to the constant file. Also, the other constants used on session storage starts with awx to make ease to identify them, and avoid name collision.
@@ -78,7 +79,9 @@ function Templates() { | |||
</Route> | |||
<Route path="/templates"> | |||
<PageSection> | |||
<TemplateList /> | |||
<PersistentFilters pageKey="templates"> |
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 noticed a delay in certain pages to filter be evaluated using firefox, on chrome seems to be more responsive.
filter.mov
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.
hey @keithjgrant, excellent work. There is an issue on awx/devel once an user, lets say User A is logged out, another User b logging in back the User B will be redirect to where the URL where User A left. This issue was not introduced by this PR, but saving the filters will redirect to the previous saved filter. This issue could be addressed by #11167
3dd2236
to
ddbe1d0
Compare
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.
All of my concerns have been addressed. Well done Keith!
ddbe1d0
to
b8becbf
Compare
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.
After further investigating, it seems the above failed tests are unrelated. Great job on this!
* add PersistentFilters component * add PersistentFilters test * add persistent filters to all list pages * update tests * clear sessionStorage on logout * fix persistent filter on wfjt detail; cleanup
SUMMARY
Keeps any list search/pagination filters in place when clicking the "Back to XXX" button. Applies to all top-level list pages except Schedules page.
This also updates
RoutedTabs
to use the properhref
prop on each tab, so URLs show as expected in the browser while hovering mouse over the tabs.ISSUE TYPE
COMPONENT NAME