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

Add frontend support for Manage Users pagination #8371

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

mpbrown
Copy link
Collaborator

@mpbrown mpbrown commented Dec 24, 2024

FRONTEND PULL REQUEST

Related Issue

Changes Proposed

  • Adds pagination to the Manage Users side nav
  • Updates the routing for the default Settings page to use settings/users/:pageNumber so that the page number can be retrieved from the url params
  • Adds a "No results found" message with a button to clear the search filter

Testing

  • Deployed on dev5
  • Select Access organization account from the support admin dashboard
  • Select Big Organization, type in "test" for justification, and click Access data
  • Select either facility
  • Go to the Settings page and it should bring you to Manage Users
  • Test that pagination works as expected

Screenshots

Page 1 of results
image

Page 5 of results
image

Last page of results
image

Search results with multiple pages
image

Search results with single result page
image

No results found
image

@mpbrown mpbrown force-pushed the mike/8103-manage-users-pagination-frontend branch 3 times, most recently from 52233eb to 31b2d0a Compare December 26, 2024 19:05
@mpbrown mpbrown force-pushed the mike/8103-manage-users-pagination-backend branch from c3ecb82 to 3a6b61e Compare December 26, 2024 19:11
@mpbrown mpbrown force-pushed the mike/8103-manage-users-pagination-frontend branch from 31b2d0a to b2174fb Compare December 26, 2024 19:20
@mpbrown mpbrown force-pushed the mike/8103-manage-users-pagination-backend branch from 3a6b61e to d3166f1 Compare January 2, 2025 16:57
Base automatically changed from mike/8103-manage-users-pagination-backend to main January 15, 2025 22:36
@mpbrown mpbrown force-pushed the mike/8103-manage-users-pagination-frontend branch from 21a5f9b to 86fc1ca Compare January 16, 2025 15:18
@mpbrown mpbrown force-pushed the mike/8103-manage-users-pagination-frontend branch from cc6a935 to c7c7652 Compare January 27, 2025 16:29
@mpbrown mpbrown force-pushed the mike/8103-manage-users-pagination-frontend branch from c7c7652 to e6a3da8 Compare January 28, 2025 22:25
boolean requestedPageOutOfBounds = startIndex > totalSearchResults;

if (onlyOnePageOfResults || requestedPageOutOfBounds) {
startIndex = 0;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Had to handle this edge case because I encountered an error when I was on page 7 of all results and entered a search query. The app requested page 7 of the search results and the backend calculated the start index as a higher index than the end index. This caused an illegal argument error when attempting to create the sublist

@mpbrown
Copy link
Collaborator Author

mpbrown commented Feb 5, 2025

@khayeni-SL @kenieh I updated dev5 with the styling changes and fixed the bug @emyl3 found. The search is now handled with the url query parameter name so when a search is input it will always bring them to the first page of those search results. PR should be all ready for review!

emyl3
emyl3 previously approved these changes Feb 7, 2025
Copy link
Collaborator

@emyl3 emyl3 left a comment

Choose a reason for hiding this comment

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

Left a couple nits and one thing I noticed based on our search implementation (Sorry I didn't notice this earlier when you introduced the implementation. 😓)

Looks like this search behaves slightly differently than our other ones.

search.functionality.mov

Let me know what you decide to do. Everything else looks good and works as expected for me.

frontend/src/app/Settings/Users/UsersSideNav.tsx Outdated Show resolved Hide resolved
@@ -29,7 +29,7 @@ const Settings = () => {
path={"self-registration"}
element={<ManageSelfRegistrationLinksContainer />}
/>
<Route path="/" element={<ManageUsersContainer />} />
<Route path="users/:pageNumber" element={<ManageUsersContainer />} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

I forgot we could also add something like the following:

<Route index element={<Navigate replace to="users/1"/>}/>

to default it to the users page like before if someone were to navigate to /settings

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea! I just added this redirect

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated the urls we have configured for the Lighthouse checks since adding this new redirect confused it

@mpbrown
Copy link
Collaborator Author

mpbrown commented Feb 10, 2025

Looks like this search behaves slightly differently than our other ones.

This is intended since we want the user search results to appear in that side nav panel @emyl3

@emyl3
Copy link
Collaborator

emyl3 commented Feb 10, 2025

Looks like this search behaves slightly differently than our other ones.

This is intended since we want the user search results to appear in that side nav panel @emyl3

Just to clarify, I was talking about searching for a user based on "Last Name, First Name" that works in our other searches but not this one.

@mpbrown
Copy link
Collaborator Author

mpbrown commented Feb 10, 2025

Looks like this search behaves slightly differently than our other ones.

This is intended since we want the user search results to appear in that side nav panel @emyl3

Just to clarify, I was talking about searching for a user based on "Last Name, First Name" that works in our other searches but not this one.

Oh whoops I thought the clip was about the dropdown section for selecting the filter! Good callout I'll check with product to confirm for supporting the other search format as well

@bobbywells52
Copy link
Collaborator

Non blocking nit: The styling and spacing for the page toggles is inconsistent between the 3 states of first page, any middle page, and last page. Screenshots below:

Screenshot 2025-02-10 at 12 04 18 PM
Screenshot 2025-02-10 at 12 04 29 PM
Screenshot 2025-02-10 at 12 04 45 PM

bobbywells52
bobbywells52 previously approved these changes Feb 10, 2025
Copy link
Collaborator

@bobbywells52 bobbywells52 left a comment

Choose a reason for hiding this comment

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

Tested in dev5 and everything is working as expected! I've left a few non-blocking nits. Thanks for your great work on this Mike!

frontend/src/app/Settings/Users/ManageUsers.test.tsx Outdated Show resolved Hide resolved
@mpbrown
Copy link
Collaborator Author

mpbrown commented Feb 10, 2025

Non blocking nit: The styling and spacing for the page toggles is inconsistent between the 3 states of first page, any middle page, and last page. Screenshots below:

I believe this is intentional so there is not left padding of white space on the first page, but tagging @kenieh to confirm

@mpbrown
Copy link
Collaborator Author

mpbrown commented Feb 10, 2025

@emyl3 I updated the search filtering so now it should handle more flexible search queries like the results page does, thanks for finding that!

@mpbrown mpbrown requested a review from bobbywells52 February 10, 2025 20:31
Copy link
Collaborator

@arinkulshi-skylight arinkulshi-skylight left a comment

Choose a reason for hiding this comment

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

I have tested the changes in dev5. LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add pagination to "Manage users" page for user list
5 participants