Commit 226a8605 authored by Jose Vargas's avatar Jose Vargas Committed by Adrien Kohlbecker

Paginate project_runners in ci_cd settings

This pagination applies to the project
ci_cd settings page
parent 9d660d49
......@@ -5,6 +5,8 @@ module Projects
class CiCdController < Projects::ApplicationController
include RunnerSetupScripts
NUMBER_OF_RUNNERS_PER_PAGE = 20
before_action :authorize_admin_pipeline!
before_action :define_variables
before_action do
......@@ -108,13 +110,13 @@ module Projects
end
def define_runners_variables
@project_runners = @project.runners.ordered
@project_runners = @project.runners.ordered.page(params[:page]).per(NUMBER_OF_RUNNERS_PER_PAGE)
@assignable_runners = current_user
.ci_owned_runners
.assignable_for(project)
.ordered
.page(params[:page]).per(20)
.page(params[:page]).per(NUMBER_OF_RUNNERS_PER_PAGE)
@shared_runners = ::Ci::Runner.instance_type.active
......
......@@ -17,6 +17,7 @@
%h4.underlined-title= _('Runners activated for this project')
%ul.bordered-list.activated-specific-runners
= render partial: 'projects/runners/runner', collection: @project_runners, as: :runner
= paginate @project_runners, theme: "gitlab", :params => { :anchor => '#js-runners-settings' }
- if @assignable_runners.any?
%h4.underlined-title= _('Available specific runners')
......
---
title: Paginate project_runners in ci_cd settings
merge_request: 45830
author:
type: fixed
......@@ -122,6 +122,19 @@ RSpec.describe 'Runners' do
end
end
context 'when multiple runners are configured' do
let!(:specific_runner) { create(:ci_runner, :project, projects: [project]) }
let!(:specific_runner_2) { create(:ci_runner, :project, projects: [project]) }
it 'adds pagination to the runner list' do
stub_const('Projects::Settings::CiCdController::NUMBER_OF_RUNNERS_PER_PAGE', 1)
visit project_runners_path(project)
expect(find('.pagination')).not_to be_nil
end
end
context 'when a specific runner exists in another project' do
let(:another_project) { create(:project) }
let!(:specific_runner) { create(:ci_runner, :project, projects: [another_project]) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment