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
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)
if runner_project.persisted?
......@@ -22,6 +22,6 @@ class Projects::RunnerProjectsController < Projects::ApplicationController
runner_project = project.runner_projects.find(params[:id])
runner_project.destroy
redirect_to runners_path(project), status: 302
redirect_to project_runners_path(project), status: 302
end
end
......@@ -13,7 +13,7 @@ class Projects::RunnersController < Projects::ApplicationController
def update
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
render 'edit'
end
......@@ -24,22 +24,22 @@ class Projects::RunnersController < Projects::ApplicationController
@runner.destroy
end
redirect_to runners_path(@project), status: 302
redirect_to project_runners_path(@project), status: 302
end
def resume
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
redirect_to runners_path(@project), alert: 'Runner was not updated.'
redirect_to project_runners_path(@project), alert: 'Runner was not updated.'
end
end
def pause
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
redirect_to runners_path(@project), alert: 'Runner was not updated.'
redirect_to project_runners_path(@project), alert: 'Runner was not updated.'
end
end
......
......@@ -19,14 +19,6 @@ module GitlabRoutingHelper
project_commits_path(project, ref_name, *args)
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)
project_environment_path(environment.project, environment, *args)
end
......
......@@ -3,7 +3,7 @@
= runner_status_icon(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?
= icon('lock', class: 'has-tooltip', title: 'Locked to current projects')
......@@ -22,7 +22,7 @@
- else
= link_to 'Resume', resume_project_runner_path(@project, runner), method: :post, class: 'btn btn-success btn-sm'
- 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
- 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'
......
......@@ -3,4 +3,4 @@
%h4 Runner ##{@runner.id}
%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
end
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))
end
......@@ -36,7 +36,7 @@ feature 'Runners' do
end
scenario 'user sees the specific runner' do
visit runners_path(project)
visit project_runners_path(project)
within '.activated-specific-runners' do
expect(page).to have_content(specific_runner.display_name)
......@@ -48,7 +48,7 @@ feature 'Runners' do
end
scenario 'user can pause and resume the specific runner' do
visit runners_path(project)
visit project_runners_path(project)
within '.activated-specific-runners' do
expect(page).to have_content('Pause')
......@@ -68,7 +68,7 @@ feature 'Runners' do
end
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
click_on 'Remove Runner'
......@@ -78,7 +78,7 @@ feature 'Runners' do
end
scenario 'user edits the runner to be protected' do
visit runners_path(project)
visit project_runners_path(project)
within '.activated-specific-runners' do
first('.edit-runner > a').click
......@@ -98,7 +98,7 @@ feature 'Runners' do
end
scenario 'user edits runner not to run untagged jobs' do
visit runners_path(project)
visit project_runners_path(project)
within '.activated-specific-runners' do
first('.edit-runner > a').click
......@@ -117,7 +117,7 @@ feature 'Runners' do
given!(:shared_runner) { create(:ci_runner, :shared) }
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)
end
......@@ -134,7 +134,7 @@ feature 'Runners' do
end
scenario 'user enables and disables a specific runner' do
visit runners_path(project)
visit project_runners_path(project)
within '.available-specific-runners' do
click_on 'Enable for this project'
......@@ -159,7 +159,7 @@ feature 'Runners' do
end
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)
end
......@@ -174,7 +174,7 @@ feature 'Runners' do
end
scenario 'user enables shared runners' do
visit runners_path(project)
visit project_runners_path(project)
click_on 'Enable shared Runners'
......@@ -198,7 +198,7 @@ feature 'Runners' do
given(:project) { create :project, group: group }
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.'
......@@ -213,7 +213,7 @@ feature 'Runners' do
given(:project) { create :project }
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.'
end
......@@ -224,7 +224,7 @@ feature 'Runners' do
given(:project) { create :project, group: group }
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.'
......@@ -239,14 +239,14 @@ feature 'Runners' do
given!(:ci_runner) { create :ci_runner, groups: [group], description: 'group-runner' }
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 'group-runner'
end
scenario 'group runners may be disabled for a project' do
visit runners_path(project)
visit project_runners_path(project)
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