diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /app/controllers/projects/ml/experiments_controller.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'app/controllers/projects/ml/experiments_controller.rb')
-rw-r--r-- | app/controllers/projects/ml/experiments_controller.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/app/controllers/projects/ml/experiments_controller.rb b/app/controllers/projects/ml/experiments_controller.rb index c82a959d612..1e1c4b1587c 100644 --- a/app/controllers/projects/ml/experiments_controller.rb +++ b/app/controllers/projects/ml/experiments_controller.rb @@ -7,10 +7,11 @@ module Projects feature_category :mlops - MAX_PER_PAGE = 20 + MAX_EXPERIMENTS_PER_PAGE = 20 + MAX_CANDIDATES_PER_PAGE = 30 def index - @experiments = ::Ml::Experiment.by_project_id(@project.id).page(params[:page]).per(MAX_PER_PAGE) + @experiments = ::Ml::Experiment.by_project_id(@project.id).page(params[:page]).per(MAX_EXPERIMENTS_PER_PAGE) end def show @@ -18,7 +19,26 @@ module Projects return redirect_to project_ml_experiments_path(@project) unless @experiment.present? - @candidates = @experiment.candidates&.including_metrics_and_params + page = params[:page].to_i + page = 1 if page == 0 + + @candidates = @experiment.candidates + .including_relationships + .page(page) + .per(MAX_CANDIDATES_PER_PAGE) + + return unless @candidates + + return redirect_to(url_for(page: @candidates.total_pages)) if @candidates.out_of_range? + + @pagination = { + page: page, + is_last_page: @candidates.last_page?, + per_page: MAX_CANDIDATES_PER_PAGE, + total_items: @candidates.total_count + } + + @candidates.each(&:artifact_lazy) end private |