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
007255ed
Commit
007255ed
authored
Dec 08, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Ci::Status::Build
parent
df84444b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
3 deletions
+84
-3
app/models/ci/build.rb
app/models/ci/build.rb
+4
-0
app/models/commit_status.rb
app/models/commit_status.rb
+4
-0
lib/gitlab/ci/status/build/common.rb
lib/gitlab/ci/status/build/common.rb
+54
-0
lib/gitlab/ci/status/build/factory.rb
lib/gitlab/ci/status/build/factory.rb
+15
-0
lib/gitlab/ci/status/core.rb
lib/gitlab/ci/status/core.rb
+7
-3
No files found.
app/models/ci/build.rb
View file @
007255ed
...
@@ -100,6 +100,10 @@ module Ci
...
@@ -100,6 +100,10 @@ module Ci
end
end
end
end
def
detailed_status
Gitlab
::
Ci
::
Status
::
Build
::
Factory
.
new
(
self
).
fabricate!
end
def
manual?
def
manual?
self
.
when
==
'manual'
self
.
when
==
'manual'
end
end
...
...
app/models/commit_status.rb
View file @
007255ed
...
@@ -131,4 +131,8 @@ class CommitStatus < ActiveRecord::Base
...
@@ -131,4 +131,8 @@ class CommitStatus < ActiveRecord::Base
def
has_trace?
def
has_trace?
false
false
end
end
def
detailed_status
Gitlab
::
Ci
::
Status
::
Factory
.
new
(
self
).
fabricate!
end
end
end
lib/gitlab/ci/status/build/common.rb
0 → 100644
View file @
007255ed
module
Gitlab
module
Ci
module
Status
module
Build
module
Common
def
has_details?
true
end
def
details_path
namespace_project_build_path
(
@subject
.
project
.
namespace
,
@subject
.
project
,
@subject
.
pipeline
)
end
def
action_type
case
when
@subject
.
playable?
then
:playable
when
@subject
.
active?
then
:cancel
when
@subject
.
retryable?
then
:retry
end
end
def
has_action?
(
current_user
)
action_type
&&
can?
(
current_user
,
:update_build
,
@subject
)
end
def
action_icon
case
action_type
when
:playable
then
'remove'
when
:cancel
then
'icon_play'
when
:retry
then
'repeat'
end
end
def
action_path
case
action_type
when
:playable
play_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
when
:cancel
cancel_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
when
:retry
retry_namespace_project_build_path
(
subject
.
project
.
namespace
,
subject
.
project
,
subject
)
end
end
def
action_method
:post
end
end
end
end
end
end
lib/gitlab/ci/status/build/factory.rb
0 → 100644
View file @
007255ed
module
Gitlab
module
Ci
module
Status
module
Build
class
Factory
<
Status
::
Factory
private
def
core_status
super
.
extend
(
Status
::
Build
::
Common
)
end
end
end
end
end
end
lib/gitlab/ci/status/core.rb
View file @
007255ed
...
@@ -34,15 +34,15 @@ module Gitlab
...
@@ -34,15 +34,15 @@ module Gitlab
end
end
def
has_details?
def
has_details?
raise
NotImplementedError
false
end
end
def
details_path
def
details_path
raise
NotImplementedError
raise
NotImplementedError
end
end
def
has_action?
def
has_action?
(
_user
=
nil
)
raise
NotImplementedError
false
end
end
def
action_icon
def
action_icon
...
@@ -52,6 +52,10 @@ module Gitlab
...
@@ -52,6 +52,10 @@ module Gitlab
def
action_path
def
action_path
raise
NotImplementedError
raise
NotImplementedError
end
end
def
action_method
raise
NotImplementedError
end
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