Commit 007255ed authored by Kamil Trzcinski's avatar Kamil Trzcinski

Added Ci::Status::Build

parent df84444b
......@@ -100,6 +100,10 @@ module Ci
end
end
def detailed_status
Gitlab::Ci::Status::Build::Factory.new(self).fabricate!
end
def manual?
self.when == 'manual'
end
......
......@@ -131,4 +131,8 @@ class CommitStatus < ActiveRecord::Base
def has_trace?
false
end
def detailed_status
Gitlab::Ci::Status::Factory.new(self).fabricate!
end
end
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
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
......@@ -34,15 +34,15 @@ module Gitlab
end
def has_details?
raise NotImplementedError
false
end
def details_path
raise NotImplementedError
end
def has_action?
raise NotImplementedError
def has_action?(_user = nil)
false
end
def action_icon
......@@ -52,6 +52,10 @@ module Gitlab
def action_path
raise NotImplementedError
end
def action_method
raise NotImplementedError
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment