Merge branch '20035-pause-resume-runners' into 'master'
Add pause/resume button to project runners Closes #20035 See merge request gitlab-org/gitlab-ce!16032
This commit is contained in:
commit
7f8c8dad86
|
@ -29,17 +29,17 @@ class Projects::RunnersController < Projects::ApplicationController
|
|||
|
||||
def resume
|
||||
if Ci::UpdateRunnerService.new(@runner).update(active: true)
|
||||
redirect_to runner_path(@runner), notice: 'Runner was successfully updated.'
|
||||
redirect_to runners_path(@project), notice: 'Runner was successfully updated.'
|
||||
else
|
||||
redirect_to runner_path(@runner), alert: 'Runner was not updated.'
|
||||
redirect_to runners_path(@project), alert: 'Runner was not updated.'
|
||||
end
|
||||
end
|
||||
|
||||
def pause
|
||||
if Ci::UpdateRunnerService.new(@runner).update(active: false)
|
||||
redirect_to runner_path(@runner), notice: 'Runner was successfully updated.'
|
||||
redirect_to runners_path(@project), notice: 'Runner was successfully updated.'
|
||||
else
|
||||
redirect_to runner_path(@runner), alert: 'Runner was not updated.'
|
||||
redirect_to runners_path(@project), alert: 'Runner was not updated.'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
.pull-right
|
||||
- if @project_runners.include?(runner)
|
||||
- if runner.active?
|
||||
= link_to 'Pause', pause_project_runner_path(@project, runner), method: :post, class: 'btn btn-sm btn-danger', data: { confirm: "Are you sure?" }
|
||||
- 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'
|
||||
- else
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Add pause/resume button to project runners
|
||||
merge_request: 16032
|
||||
author: Mario de la Ossa
|
||||
type: added
|
|
@ -383,8 +383,8 @@ constraints(ProjectUrlConstrainer.new) do
|
|||
|
||||
resources :runners, only: [:index, :edit, :update, :destroy, :show] do
|
||||
member do
|
||||
get :resume
|
||||
get :pause
|
||||
post :resume
|
||||
post :pause
|
||||
end
|
||||
|
||||
collection do
|
||||
|
|
|
@ -33,6 +33,26 @@ feature 'Runners' do
|
|||
expect(page).to have_content(specific_runner.platform)
|
||||
end
|
||||
|
||||
scenario 'user can pause and resume the specific runner' do
|
||||
visit runners_path(project)
|
||||
|
||||
within '.activated-specific-runners' do
|
||||
expect(page).to have_content('Pause')
|
||||
end
|
||||
|
||||
click_on 'Pause'
|
||||
|
||||
within '.activated-specific-runners' do
|
||||
expect(page).to have_content('Resume')
|
||||
end
|
||||
|
||||
click_on 'Resume'
|
||||
|
||||
within '.activated-specific-runners' do
|
||||
expect(page).to have_content('Pause')
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'user removes an activated specific runner if this is last project for that runners' do
|
||||
visit runners_path(project)
|
||||
|
||||
|
|
Loading…
Reference in New Issue