Add filters and pagination to users page#2229
Merged
Merged
Conversation
166b95d to
814279d
Compare
5148913 to
788331a
Compare
DavidBiddle
reviewed
Sep 19, 2025
788331a to
d833b67
Compare
DavidBiddle
approved these changes
Sep 19, 2025
d833b67 to
93d7bf5
Compare
Add scopes to get Users by: - Name with a case insensitive, partial match strategy - Email with a case insensitive, partial match strategy - Organisation ID
We have tables on other pages, such as the group members page without a caption. The caption here is redundant as the table is the only thing on the page and is described by the page heading.
Install pagy for pagination on the users index page. govuk-components supports pagy out of the box, making it a suitable choice over other gems.
Use the pagy gem and the govuk_pagination component to add pagination to the users index page.
Add a component to the index page to specify filters for the user list and apply the specified filters in the controller.
Show a link to load the users page without filters if any filters are applied.
Add a GIN index on LOWER(name) to optimize case-insensitive searches for users.
Add a GIN index on LOWER(email) to optimize case-insensitive searches for users. We already have a unique index on email but we cannot make gin indexes unique so we need to add a separate index for searches.
So that the filter component size does not change hen the menu is shown, set the displayMenu option for the accessible-autocomplete to be 'overlay'.
We want to re-use these methods to get the options for filters in the users index view. Move them to a separarte helper module to be included in the FilterInput without having to import ApplicationHelper. Change calls to `t` to `I18n.t` so that these methods can be called from non-view contexts.
Add additional filters to filter by user role and whether they have access to the platform. Include blank options for both of these filters to display all users regardless of role or access.
This warning was triggered because we have the query parameter `role`. This is a false positive as there is no danger with being able to specify the role in this case.
93d7bf5 to
c0cb789
Compare
|
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2229.admin.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What problem does this pull request solve?
Trello card: https://trello.com/c/IlcvX9A9/186-add-filters-and-pagination-for-users-page
Add a filter component an pagination to the users page so it loads quicker and it's easier to find users.
50 users are displayed per page - this could be changed if desired.
Add indexes on the users table to make the search using the filters as efficient as possible.
Things to consider when reviewing