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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
82ee1d29
Commit
82ee1d29
authored
Dec 08, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce `cancelable` and `returnable` [ci skip]
parent
cd4a2270
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
35 deletions
+64
-35
lib/gitlab/ci/status/build/cancelable.rb
lib/gitlab/ci/status/build/cancelable.rb
+31
-0
lib/gitlab/ci/status/build/common.rb
lib/gitlab/ci/status/build/common.rb
+0
-25
lib/gitlab/ci/status/build/factory.rb
lib/gitlab/ci/status/build/factory.rb
+1
-1
lib/gitlab/ci/status/build/play.rb
lib/gitlab/ci/status/build/play.rb
+1
-9
lib/gitlab/ci/status/build/retryable.rb
lib/gitlab/ci/status/build/retryable.rb
+31
-0
No files found.
lib/gitlab/ci/status/build/cancelable.rb
0 → 100644
View file @
82ee1d29
module
Gitlab
module
Ci
module
Status
module
Status
class
Cancelable
<
SimpleDelegator
extend
Status
::
Extended
def
has_action?
(
current_user
)
can?
(
current_user
,
:update_build
,
subject
)
end
def
action_icon
'remove'
end
def
action_path
cancel_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
end
def
action_method
:post
end
def
self
.
matches?
(
build
)
build
.
cancelable?
end
end
end
end
end
end
lib/gitlab/ci/status/build/common.rb
View file @
82ee1d29
...
...
@@ -12,31 +12,6 @@ module Gitlab
@subject
.
project
,
@subject
.
pipeline
)
end
def
has_action?
(
current_user
)
(
subject
.
cancelable?
||
subject
.
retryable?
)
&&
can?
(
current_user
,
:update_build
,
@subject
)
end
def
action_icon
case
when
subject
.
cancelable?
then
'icon_play'
when
subject
.
retryable?
then
'repeat'
end
end
def
action_path
case
when
subject
.
cancelable?
cancel_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
when
subject
.
retryable?
retry_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
end
end
def
action_method
:post
end
end
end
end
...
...
lib/gitlab/ci/status/build/factory.rb
View file @
82ee1d29
...
...
@@ -6,7 +6,7 @@ module Gitlab
private
def
extended_statuses
[
Stop
,
Play
]
[
Stop
,
Play
,
Cancelable
,
Retryable
]
end
def
core_status
...
...
lib/gitlab/ci/status/build/play.rb
View file @
82ee1d29
...
...
@@ -13,20 +13,12 @@ module Gitlab
'play'
end
def
icon
'icon_status_skipped'
end
def
to_s
'play'
end
def
has_action?
(
current_user
)
can?
(
current_user
,
:update_build
,
subject
)
end
def
action_icon
:play
'play'
end
def
action_path
...
...
lib/gitlab/ci/status/build/retryable.rb
0 → 100644
View file @
82ee1d29
module
Gitlab
module
Ci
module
Status
module
Status
class
Retryable
<
SimpleDelegator
extend
Status
::
Extended
def
has_action?
(
current_user
)
can?
(
current_user
,
:update_build
,
subject
)
end
def
action_icon
'repeat'
end
def
action_path
retry_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
end
def
action_method
:post
end
def
self
.
matches?
(
build
)
build
.
retryable?
end
end
end
end
end
end
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