Rename according to:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4093#note_12563922 For clarification and consistency
This commit is contained in:
parent
60ef0dd20c
commit
4efc1c4a68
|
@ -5,9 +5,9 @@ class Projects::RunnersController < Projects::ApplicationController
|
|||
layout 'project_settings'
|
||||
|
||||
def index
|
||||
@runners = project.runners.ordered
|
||||
@specific_runners = current_user.ci_authorized_runners.
|
||||
available_for(project).ordered.page(params[:page]).per(20)
|
||||
@project_runners = project.runners.ordered
|
||||
@assignable_runners = current_user.ci_authorized_runners.
|
||||
assignable_for(project).ordered.page(params[:page]).per(20)
|
||||
@shared_runners = Ci::Runner.shared.active
|
||||
@shared_runners_count = @shared_runners.count(:all)
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ module Ci
|
|||
.where("ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true", project_id: project_id)
|
||||
end
|
||||
|
||||
scope :available_for, ->(project) do
|
||||
scope :assignable_for, ->(project) do
|
||||
# FIXME: That `to_sql` is needed to workaround a weird Rails bug.
|
||||
# Without that, placeholders would miss one and couldn't match.
|
||||
where(locked: false).
|
||||
|
@ -99,7 +99,7 @@ module Ci
|
|||
end
|
||||
|
||||
def can_pick?(build)
|
||||
available_for?(build.project) && accepting_tags?(build)
|
||||
assignable_for?(build.project) && accepting_tags?(build)
|
||||
end
|
||||
|
||||
def only_for?(project)
|
||||
|
@ -123,7 +123,7 @@ module Ci
|
|||
end
|
||||
end
|
||||
|
||||
def available_for?(project)
|
||||
def assignable_for?(project)
|
||||
!locked? || projects.exists?(id: project.id)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
%h4
|
||||
= runner_status_icon(runner)
|
||||
%span.monospace
|
||||
- if @runners.include?(runner)
|
||||
- if @project_runners.include?(runner)
|
||||
= link_to runner.short_sha, runner_path(runner)
|
||||
- if runner.locked?
|
||||
= icon('lock', class: 'has-tooltip', title: 'Exclusive to this project')
|
||||
|
@ -13,7 +13,7 @@
|
|||
= runner.short_sha
|
||||
|
||||
.pull-right
|
||||
- if @runners.include?(runner)
|
||||
- if @project_runners.include?(runner)
|
||||
- if runner.belongs_to_one_project?
|
||||
= link_to 'Remove runner', runner_path(runner), data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger btn-sm'
|
||||
- else
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
Start runner!
|
||||
|
||||
|
||||
- if @runners.any?
|
||||
- if @project_runners.any?
|
||||
%h4.underlined-title Runners activated for this project
|
||||
%ul.bordered-list.activated-specific-runners
|
||||
= render partial: 'runner', collection: @runners, as: :runner
|
||||
= render partial: 'runner', collection: @project_runners, as: :runner
|
||||
|
||||
- if @specific_runners.any?
|
||||
- if @assignable_runners.any?
|
||||
%h4.underlined-title Available specific runners
|
||||
%ul.bordered-list.available-specific-runners
|
||||
= render partial: 'runner', collection: @specific_runners, as: :runner
|
||||
= paginate @specific_runners
|
||||
= render partial: 'runner', collection: @assignable_runners, as: :runner
|
||||
= paginate @assignable_runners
|
||||
|
|
|
@ -263,7 +263,7 @@ describe Ci::Runner, models: true do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.available_for' do
|
||||
describe '.assignable_for' do
|
||||
let(:runner) { create(:ci_runner) }
|
||||
let(:project) { create(:project) }
|
||||
let(:another_project) { create(:project) }
|
||||
|
@ -278,13 +278,13 @@ describe Ci::Runner, models: true do
|
|||
end
|
||||
|
||||
context 'does not give owned runner' do
|
||||
subject { Ci::Runner.available_for(project) }
|
||||
subject { Ci::Runner.assignable_for(project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
context 'does not give shared runner' do
|
||||
subject { Ci::Runner.available_for(another_project) }
|
||||
subject { Ci::Runner.assignable_for(another_project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
@ -292,13 +292,13 @@ describe Ci::Runner, models: true do
|
|||
|
||||
context 'with unlocked runner' do
|
||||
context 'does not give owned runner' do
|
||||
subject { Ci::Runner.available_for(project) }
|
||||
subject { Ci::Runner.assignable_for(project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
context 'does give a specific runner' do
|
||||
subject { Ci::Runner.available_for(another_project) }
|
||||
subject { Ci::Runner.assignable_for(another_project) }
|
||||
|
||||
it { is_expected.to contain_exactly(runner) }
|
||||
end
|
||||
|
@ -310,13 +310,13 @@ describe Ci::Runner, models: true do
|
|||
end
|
||||
|
||||
context 'does not give owned runner' do
|
||||
subject { Ci::Runner.available_for(project) }
|
||||
subject { Ci::Runner.assignable_for(project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
context 'does not give a locked runner' do
|
||||
subject { Ci::Runner.available_for(another_project) }
|
||||
subject { Ci::Runner.assignable_for(another_project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue