Skip to content
Snippets Groups Projects
Unverified Commit f88d5974 authored by Mario de la Ossa's avatar Mario de la Ossa
Browse files

Add pause/resume button to specific project runners

parent 3d56d93f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
---
title: Add pause/resume button to project runners
merge_request: 16032
author: Mario de la Ossa
type: added
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment