Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f88d5974
Commit
f88d5974
authored
Dec 19, 2017
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pause/resume button to specific project runners
parent
3d56d93f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
6 deletions
+35
-6
app/controllers/projects/runners_controller.rb
app/controllers/projects/runners_controller.rb
+4
-4
app/views/projects/runners/_runner.html.haml
app/views/projects/runners/_runner.html.haml
+4
-0
changelogs/unreleased/20035-pause-resume-runners.yml
changelogs/unreleased/20035-pause-resume-runners.yml
+5
-0
config/routes/project.rb
config/routes/project.rb
+2
-2
spec/features/runners_spec.rb
spec/features/runners_spec.rb
+20
-0
No files found.
app/controllers/projects/runners_controller.rb
View file @
f88d5974
...
@@ -29,17 +29,17 @@ class Projects::RunnersController < Projects::ApplicationController
...
@@ -29,17 +29,17 @@ class Projects::RunnersController < Projects::ApplicationController
def
resume
def
resume
if
Ci
::
UpdateRunnerService
.
new
(
@runner
).
update
(
active:
true
)
if
Ci
::
UpdateRunnerService
.
new
(
@runner
).
update
(
active:
true
)
redirect_to
runner
_path
(
@runner
),
notice:
'Runner was successfully updated.'
redirect_to
runner
s_path
(
@project
),
notice:
'Runner was successfully updated.'
else
else
redirect_to
runner
_path
(
@runner
),
alert:
'Runner was not updated.'
redirect_to
runner
s_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
runner
_path
(
@runner
),
notice:
'Runner was successfully updated.'
redirect_to
runner
s_path
(
@project
),
notice:
'Runner was successfully updated.'
else
else
redirect_to
runner
_path
(
@runner
),
alert:
'Runner was not updated.'
redirect_to
runner
s_path
(
@project
),
alert:
'Runner was not updated.'
end
end
end
end
...
...
app/views/projects/runners/_runner.html.haml
View file @
f88d5974
...
@@ -17,6 +17,10 @@
...
@@ -17,6 +17,10 @@
.pull-right
.pull-right
-
if
@project_runners
.
include?
(
runner
)
-
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?
-
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'
,
runner_path
(
runner
),
data:
{
confirm:
"Are you sure?"
},
method: :delete
,
class:
'btn btn-danger btn-sm'
-
else
-
else
...
...
changelogs/unreleased/20035-pause-resume-runners.yml
0 → 100644
View file @
f88d5974
---
title
:
Add pause/resume button to project runners
merge_request
:
16032
author
:
Mario de la Ossa
type
:
added
config/routes/project.rb
View file @
f88d5974
...
@@ -383,8 +383,8 @@ constraints(ProjectUrlConstrainer.new) do
...
@@ -383,8 +383,8 @@ constraints(ProjectUrlConstrainer.new) do
resources
:runners
,
only:
[
:index
,
:edit
,
:update
,
:destroy
,
:show
]
do
resources
:runners
,
only:
[
:index
,
:edit
,
:update
,
:destroy
,
:show
]
do
member
do
member
do
ge
t
:resume
pos
t
:resume
ge
t
:pause
pos
t
:pause
end
end
collection
do
collection
do
...
...
spec/features/runners_spec.rb
View file @
f88d5974
...
@@ -33,6 +33,26 @@ feature 'Runners' do
...
@@ -33,6 +33,26 @@ feature 'Runners' do
expect
(
page
).
to
have_content
(
specific_runner
.
platform
)
expect
(
page
).
to
have_content
(
specific_runner
.
platform
)
end
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
scenario
'user removes an activated specific runner if this is last project for that runners'
do
visit
runners_path
(
project
)
visit
runners_path
(
project
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment