Skip to content
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

Merged
merged 6 commits into from
Jun 6, 2022
Merged

Conversation

keithjgrant
Copy link
Member

@keithjgrant keithjgrant commented May 12, 2022

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 proper href prop on each tab, so URLs show as expected in the browser while hovering mouse over the tabs.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
  • UI

@@ -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}`}
Copy link
Member Author

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

Copy link
Member

@AlexSCorey AlexSCorey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is expected behavior. The filtered list should load with I click Back to templates, right?
filters

import { useEffect } from 'react';
import { useLocation, useHistory } from 'react-router';

const STORAGE_KEY = 'persistentFilter';
Copy link
Contributor

@nixocio nixocio May 17, 2022

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">
Copy link
Contributor

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

Copy link
Contributor

@nixocio nixocio left a 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

Copy link
Member

@AlexSCorey AlexSCorey left a 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!

@cypress
Copy link

cypress bot commented May 25, 2022



Test summary

614 15 830 0Flakiness 0


Run details

Project AWX - Functional
Status Failed
Commit b8becbf
Started Jun 1, 2022 7:20 PM
Ended Jun 1, 2022 9:52 PM
Duration 32:01 💡
OS Linux Debian - 11.3
Browser Chrome 99

View run in Cypress Dashboard ➡️


Failures

users/user-tabs.spec.js Failed
1 Users - All Tabs > can view all User tabs
2 Roles tab > can see System for user role name when not present
hosts/hosts-tabs.spec.js Failed
1 Host Resource- Groups tab > can edit a group
job-templates/job-template-surveys.spec.js Failed
1 Surveys- Form > can create a survey type text
2 Surveys- Form > can create a survey type textarea
3 Surveys- Form > can create a survey type integer
4 Surveys- Form > can create a survey type float
5 Surveys- Form > can create a survey type multiplechoice
6 Surveys- Form > can create a survey type multiselect
7 Surveys- Form > can add all survey type and launch a jt
This comment includes only the first 10 test failures. See all 15 failures in the Cypress Dashboard.

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

Copy link
Contributor

@InnocentK InnocentK left a 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!

@InnocentK InnocentK merged commit fdd5607 into ansible:devel Jun 6, 2022
AlanCoding pushed a commit to AlanCoding/awx that referenced this pull request Jan 4, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants