Skip to content

Adds pagination to model index

Eduardo Bonet requested to merge model_registry/pagination into master

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

How to set up and validate locally

  1. 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 }
  2. 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.

Edited by Eduardo Bonet

Merge request reports

Loading