Commit 1ef9e9c2 authored by Dylan Griffith's avatar Dylan Griffith

Inline runner_path and runners_path helpers

These were just shorthands for project_... and they will be confusing when introducing group runners so we should not have them (#10244)
parent 2135949e
...@@ -8,7 +8,7 @@ class Projects::RunnerProjectsController < Projects::ApplicationController ...@@ -8,7 +8,7 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
return head(403) unless can?(current_user, :assign_runner, @runner) return head(403) unless can?(current_user, :assign_runner, @runner)
path = runners_path(project) path = project_runners_path(project)
runner_project = @runner.assign_to(project, current_user) runner_project = @runner.assign_to(project, current_user)
if runner_project.persisted? if runner_project.persisted?
...@@ -22,6 +22,6 @@ class Projects::RunnerProjectsController < Projects::ApplicationController ...@@ -22,6 +22,6 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
runner_project = project.runner_projects.find(params[:id]) runner_project = project.runner_projects.find(params[:id])
runner_project.destroy runner_project.destroy
redirect_to runners_path(project), status: 302 redirect_to project_runners_path(project), status: 302
end end
end end
...@@ -13,7 +13,7 @@ class Projects::RunnersController < Projects::ApplicationController ...@@ -13,7 +13,7 @@ class Projects::RunnersController < Projects::ApplicationController
def update def update
if Ci::UpdateRunnerService.new(@runner).update(runner_params) if Ci::UpdateRunnerService.new(@runner).update(runner_params)
redirect_to runner_path(@runner), notice: 'Runner was successfully updated.' redirect_to project_runner_path(@project, @runner), notice: 'Runner was successfully updated.'
else else
render 'edit' render 'edit'
end end
...@@ -24,22 +24,22 @@ class Projects::RunnersController < Projects::ApplicationController ...@@ -24,22 +24,22 @@ class Projects::RunnersController < Projects::ApplicationController
@runner.destroy @runner.destroy
end end
redirect_to runners_path(@project), status: 302 redirect_to project_runners_path(@project), status: 302
end end
def resume def resume
if Ci::UpdateRunnerService.new(@runner).update(active: true) if Ci::UpdateRunnerService.new(@runner).update(active: true)
redirect_to runners_path(@project), notice: 'Runner was successfully updated.' redirect_to project_runners_path(@project), notice: 'Runner was successfully updated.'
else else
redirect_to runners_path(@project), alert: 'Runner was not updated.' redirect_to project_runners_path(@project), alert: 'Runner was not updated.'
end end
end end
def pause def pause
if Ci::UpdateRunnerService.new(@runner).update(active: false) if Ci::UpdateRunnerService.new(@runner).update(active: false)
redirect_to runners_path(@project), notice: 'Runner was successfully updated.' redirect_to project_runners_path(@project), notice: 'Runner was successfully updated.'
else else
redirect_to runners_path(@project), alert: 'Runner was not updated.' redirect_to project_runners_path(@project), alert: 'Runner was not updated.'
end end
end end
......
...@@ -19,14 +19,6 @@ module GitlabRoutingHelper ...@@ -19,14 +19,6 @@ module GitlabRoutingHelper
project_commits_path(project, ref_name, *args) project_commits_path(project, ref_name, *args)
end end
def runners_path(project, *args)
project_runners_path(project, *args)
end
def runner_path(runner, *args)
project_runner_path(@project, runner, *args)
end
def environment_path(environment, *args) def environment_path(environment, *args)
project_environment_path(environment.project, environment, *args) project_environment_path(environment.project, environment, *args)
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= runner_status_icon(runner) = runner_status_icon(runner)
- if @project_runners.include?(runner) - if @project_runners.include?(runner)
= link_to runner.short_sha, runner_path(runner), class: 'commit-sha' = link_to runner.short_sha, project_runner_path(@project, runner), class: 'commit-sha'
- if runner.locked? - if runner.locked?
= icon('lock', class: 'has-tooltip', title: 'Locked to current projects') = icon('lock', class: 'has-tooltip', title: 'Locked to current projects')
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
- else - else
= link_to 'Resume', resume_project_runner_path(@project, runner), method: :post, class: 'btn btn-success btn-sm' = link_to 'Resume', resume_project_runner_path(@project, runner), method: :post, class: 'btn btn-success btn-sm'
- if runner.belongs_to_one_project? - 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' = link_to 'Remove Runner', project_runner_path(@project, runner), data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger btn-sm'
- else - else
- runner_project = @project.runner_projects.find_by(runner_id: runner) - runner_project = @project.runner_projects.find_by(runner_id: runner)
= link_to 'Disable for this project', project_runner_project_path(@project, runner_project), data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger btn-sm' = link_to 'Disable for this project', project_runner_project_path(@project, runner_project), data: { confirm: "Are you sure?" }, method: :delete, class: 'btn btn-danger btn-sm'
......
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
%h4 Runner ##{@runner.id} %h4 Runner ##{@runner.id}
%hr %hr
= render 'form', runner: @runner, runner_form_url: runner_path(@runner) = render 'form', runner: @runner, runner_form_url: project_runner_path(@project, @runner)
...@@ -15,7 +15,7 @@ feature 'Runners' do ...@@ -15,7 +15,7 @@ feature 'Runners' do
end end
scenario 'user can see a button to install runners on kubernetes clusters' do scenario 'user can see a button to install runners on kubernetes clusters' do
visit runners_path(project) visit project_runners_path(project)
expect(page).to have_link('Install Runner on Kubernetes', href: project_clusters_path(project)) expect(page).to have_link('Install Runner on Kubernetes', href: project_clusters_path(project))
end end
...@@ -36,7 +36,7 @@ feature 'Runners' do ...@@ -36,7 +36,7 @@ feature 'Runners' do
end end
scenario 'user sees the specific runner' do scenario 'user sees the specific runner' do
visit runners_path(project) visit project_runners_path(project)
within '.activated-specific-runners' do within '.activated-specific-runners' do
expect(page).to have_content(specific_runner.display_name) expect(page).to have_content(specific_runner.display_name)
...@@ -48,7 +48,7 @@ feature 'Runners' do ...@@ -48,7 +48,7 @@ feature 'Runners' do
end end
scenario 'user can pause and resume the specific runner' do scenario 'user can pause and resume the specific runner' do
visit runners_path(project) visit project_runners_path(project)
within '.activated-specific-runners' do within '.activated-specific-runners' do
expect(page).to have_content('Pause') expect(page).to have_content('Pause')
...@@ -68,7 +68,7 @@ feature 'Runners' do ...@@ -68,7 +68,7 @@ feature 'Runners' do
end end
scenario 'user removes an activated specific runner if this is last project for that runners' do scenario 'user removes an activated specific runner if this is last project for that runners' do
visit runners_path(project) visit project_runners_path(project)
within '.activated-specific-runners' do within '.activated-specific-runners' do
click_on 'Remove Runner' click_on 'Remove Runner'
...@@ -78,7 +78,7 @@ feature 'Runners' do ...@@ -78,7 +78,7 @@ feature 'Runners' do
end end
scenario 'user edits the runner to be protected' do scenario 'user edits the runner to be protected' do
visit runners_path(project) visit project_runners_path(project)
within '.activated-specific-runners' do within '.activated-specific-runners' do
first('.edit-runner > a').click first('.edit-runner > a').click
...@@ -98,7 +98,7 @@ feature 'Runners' do ...@@ -98,7 +98,7 @@ feature 'Runners' do
end end
scenario 'user edits runner not to run untagged jobs' do scenario 'user edits runner not to run untagged jobs' do
visit runners_path(project) visit project_runners_path(project)
within '.activated-specific-runners' do within '.activated-specific-runners' do
first('.edit-runner > a').click first('.edit-runner > a').click
...@@ -117,7 +117,7 @@ feature 'Runners' do ...@@ -117,7 +117,7 @@ feature 'Runners' do
given!(:shared_runner) { create(:ci_runner, :shared) } given!(:shared_runner) { create(:ci_runner, :shared) }
scenario 'user sees CI/CD setting page' do scenario 'user sees CI/CD setting page' do
visit runners_path(project) visit project_runners_path(project)
expect(page.find('.available-shared-runners')).to have_content(shared_runner.display_name) expect(page.find('.available-shared-runners')).to have_content(shared_runner.display_name)
end end
...@@ -134,7 +134,7 @@ feature 'Runners' do ...@@ -134,7 +134,7 @@ feature 'Runners' do
end end
scenario 'user enables and disables a specific runner' do scenario 'user enables and disables a specific runner' do
visit runners_path(project) visit project_runners_path(project)
within '.available-specific-runners' do within '.available-specific-runners' do
click_on 'Enable for this project' click_on 'Enable for this project'
...@@ -159,7 +159,7 @@ feature 'Runners' do ...@@ -159,7 +159,7 @@ feature 'Runners' do
end end
scenario 'user sees shared runners description' do scenario 'user sees shared runners description' do
visit runners_path(project) visit project_runners_path(project)
expect(page.find('.shared-runners-description')).to have_content(shared_runners_html) expect(page.find('.shared-runners-description')).to have_content(shared_runners_html)
end end
...@@ -174,7 +174,7 @@ feature 'Runners' do ...@@ -174,7 +174,7 @@ feature 'Runners' do
end end
scenario 'user enables shared runners' do scenario 'user enables shared runners' do
visit runners_path(project) visit project_runners_path(project)
click_on 'Enable shared Runners' click_on 'Enable shared Runners'
...@@ -198,7 +198,7 @@ feature 'Runners' do ...@@ -198,7 +198,7 @@ feature 'Runners' do
given(:project) { create :project, group: group } given(:project) { create :project, group: group }
scenario 'group runners are not available' do scenario 'group runners are not available' do
visit runners_path(project) visit project_runners_path(project)
expect(page).to have_content 'This group does not provide any group Runners yet.' expect(page).to have_content 'This group does not provide any group Runners yet.'
...@@ -213,7 +213,7 @@ feature 'Runners' do ...@@ -213,7 +213,7 @@ feature 'Runners' do
given(:project) { create :project } given(:project) { create :project }
scenario 'group runners are not available' do scenario 'group runners are not available' do
visit runners_path(project) visit project_runners_path(project)
expect(page).to have_content 'This project does not belong to a group and can therefore not make use of group Runners.' expect(page).to have_content 'This project does not belong to a group and can therefore not make use of group Runners.'
end end
...@@ -224,7 +224,7 @@ feature 'Runners' do ...@@ -224,7 +224,7 @@ feature 'Runners' do
given(:project) { create :project, group: group } given(:project) { create :project, group: group }
scenario 'group runners are not available' do scenario 'group runners are not available' do
visit runners_path(project) visit project_runners_path(project)
expect(page).to have_content 'This group does not provide any group Runners yet.' expect(page).to have_content 'This group does not provide any group Runners yet.'
...@@ -239,14 +239,14 @@ feature 'Runners' do ...@@ -239,14 +239,14 @@ feature 'Runners' do
given!(:ci_runner) { create :ci_runner, groups: [group], description: 'group-runner' } given!(:ci_runner) { create :ci_runner, groups: [group], description: 'group-runner' }
scenario 'group runners are available' do scenario 'group runners are available' do
visit runners_path(project) visit project_runners_path(project)
expect(page).to have_content 'Available group Runners : 1' expect(page).to have_content 'Available group Runners : 1'
expect(page).to have_content 'group-runner' expect(page).to have_content 'group-runner'
end end
scenario 'group runners may be disabled for a project' do scenario 'group runners may be disabled for a project' do
visit runners_path(project) visit project_runners_path(project)
click_on 'Disable group Runners' click_on 'Disable group Runners'
......
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