Adds pagination to model index
What does this MR do and why?
Adds pagination to model index
Limit was harcdoded to 100 entries, now it does proper pagination. The goal of this MR is to just add pagination, not to improve the UX, which is part of #385061 (closed)
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
-
Enable the feature flag and create a bunch of models on rails console
Feature.enable("model_registry") p = Project.find_by(id: 19) # or whatever project you want to use for testing 30.times { |n| Ml::FindOrCreateModelService.new(p, "model_#{n}").execute }
-
Navigate to
<my_project>/-/ml/models
. Wihtout the change, all 30 models will be displayed. With the change, you will be able to see the pagination
Queries
SELECT
"ml_models".*
FROM
"ml_models"
WHERE
"ml_models"."project_id" = 19
AND ("ml_models"."id" > 1)
ORDER BY
"ml_models"."id" ASC
LIMIT 21
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/22844/commands/73695
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Eduardo Bonet