Skip to content

Conversation

@syphax-bouazzouni
Copy link
Contributor

Context

will help fix ncbo/bioportal_web_ui#411, ncbo/bioportal_web_ui#372

See details of the issue here ncbo/bioportal_web_ui#409 (comment)

With this PR, we will have the option in the UI to use either /users?search=syphax, it will return only the users with a username containing syphax
In addition it give the option to paginate the page if needed, by adding page=<number>, e.g /users?page=1

Changes

  • Add option to search by username or paginate the /users issue (453fa55)
  • Add unit test for searching and paginating the/usersendpoint (153eb82)

@jonquet
Copy link

jonquet commented Mar 27, 2025

Very good.
@imadbourouche Have you been following this (discussing with @syphax-bouazzouni) when implementing pagination on all the other calls that require it in OntoPortal legacy API ?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds search and pagination functionality to the /users endpoint. The changes allow the UI to filter users by a substring of the username and paginate the results, and new unit tests have been added to verify these enhancements.

  • Extended /users endpoint to support filtering by a search parameter.
  • Introduced pagination using page and pagesize parameters.
  • Updated unit tests and helper methods to support these features.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

File Description
test/controllers/test_users_controller.rb Added tests for searching users by username and pagination behavior.
helpers/users_helper.rb Introduced a helper (get_users) to handle search filtering and pagination.
controllers/users_controller.rb Updated endpoint to use get_users and modified create_user signature.
Gemfile Removed an unused dependency (net-ftp).

@jonquet
Copy link

jonquet commented Mar 27, 2025

Just for my own knowledge: is the Copilot automatic description comment a good one? (on a scale from 1 to 5) ?

@syphax-bouazzouni syphax-bouazzouni changed the title Feature: Add option to seaach by username or paginate the /users endpoint Feature: Add option to search by username or paginate the /users endpoint Mar 27, 2025
@syphax-bouazzouni
Copy link
Contributor Author

Just for my own knowledge: is the Copilot automatic description comment a good one? (on a scale from 1 to 5) ?

3.75

syphax-bouazzouni and others added 2 commits March 27, 2025 10:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@imadbourouche
Copy link
Member

Very good. @imadbourouche Have you been following this (discussing with @syphax-bouazzouni) when implementing pagination on all the other calls that require it in OntoPortal legacy API ?

At first i didn't follow this structure of pagination, but as we discussed last time, we will follow the same structure like here to make our endpoints has optional pagination (the endpoints that need this)

@alexskr alexskr merged commit d9cc990 into ontoportal:master Apr 3, 2025
2 checks passed
@alexskr
Copy link
Contributor

alexskr commented Apr 4, 2025

@syphax-bouazzouni This works very well!

While the minimum number of characters to trigger a search can be enforced on the UI side, it might still be worth considering paginating results by default. Currently, performance slows down when searching with one- or two-character queries.

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.

Administration Console -> Users tab no longer accessible

4 participants