summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-06-20 16:52:05 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-06-20 16:52:05 +0800
commit4efc1c4a68538126bc4cfad6d9b60710bee36f14 (patch)
treeb0800ee7ce399e064e83f422ab02c21ef286caa9
parent60ef0dd20c91fd8d8f04ec139edaa07dbab86d1b (diff)
downloadgitlab-ce-4efc1c4a68538126bc4cfad6d9b60710bee36f14.tar.gz
Rename according to:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4093#note_12563922 For clarification and consistency
-rw-r--r--app/controllers/projects/runners_controller.rb6
-rw-r--r--app/models/ci/runner.rb6
-rw-r--r--app/views/projects/runners/_runner.html.haml4
-rw-r--r--app/views/projects/runners/_specific_runners.html.haml10
-rw-r--r--spec/models/ci/runner_spec.rb14
5 files changed, 20 insertions, 20 deletions
diff --git a/app/controllers/projects/runners_controller.rb b/app/controllers/projects/runners_controller.rb
index 798d668f251..53c36635efe 100644
--- a/app/controllers/projects/runners_controller.rb
+++ b/app/controllers/projects/runners_controller.rb
@@ -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
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index fa5cf03baec..b64ec79ec2b 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -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
diff --git a/app/views/projects/runners/_runner.html.haml b/app/views/projects/runners/_runner.html.haml
index 13113f9b88f..3cf66bbcb4a 100644
--- a/app/views/projects/runners/_runner.html.haml
+++ b/app/views/projects/runners/_runner.html.haml
@@ -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
diff --git a/app/views/projects/runners/_specific_runners.html.haml b/app/views/projects/runners/_specific_runners.html.haml
index 8ae9f0d95f7..d469dda5b81 100644
--- a/app/views/projects/runners/_specific_runners.html.haml
+++ b/app/views/projects/runners/_specific_runners.html.haml
@@ -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
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index c7248ef1384..ef65eb99328 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -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