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 18 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 3, 2025

One thing I noticed while testing was searching for a user on a previous page, when you have navigated to a later page. The pagination doesn't reset. Hope this video makes more sense of what I'm trying to say 😅

Hmm I'll check with product and design to see what the intended behavior should be in this scenario. Right now the component determines the current page based on the url parameter so in that example the url param would still be 7 even when the search results returned just one page. We could possibly have the frontend trigger a redirect to the 1st page whenever a search is entered. I remember we discovered that focus redirect bug on the results page when we were pairing on this

@khayeni-SL
Copy link
Collaborator

In a (probably unlikely) scenario where the results return too many patient names to fit on one page, how would the user navigate to "page 2"? (Ex: There are 20+ Wallaces.) Is there a large lift to have the pagination reflect the results filter?

Alternatively, I'd want to know if pagination could be disabled so it does not imply the user can navigate between pages if the filter is active. cc @kenieh for thoughts

@mpbrown
Copy link
Collaborator Author

mpbrown commented Feb 3, 2025

In a (probably unlikely) scenario where the results return too many patient names to fit on one page, how would the user navigate to "page 2"? (Ex: There are 20+ Wallaces.) Is there a large lift to have the pagination reflect the results filter?

Yes this type of paginated search should already be supported! So if you were to search by a single character like "a" it'll show multiple pages of filtered results

@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!

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.

<div className={"padding-1 padding-left-3 padding-bottom-4"}>
<Button
className={"clear-filter-button"}
id={`clear-filter-button`}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: do we need this id 🤔

@@ -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

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
3 participants