Commit bc5d649a authored by Shinya Maeda's avatar Shinya Maeda Committed by Alessio Caiazza

Add unschedule action to status build

parent 7fc74818
...@@ -12,7 +12,11 @@ class BuildActionEntity < Grape::Entity ...@@ -12,7 +12,11 @@ class BuildActionEntity < Grape::Entity
end end
expose :playable?, as: :playable expose :playable?, as: :playable
expose :scheduled_at expose :scheduled_at, if: -> (build) { build.scheduled? }
expose :unschedule_path, if: -> (build) { build.scheduled? } do |build|
unschedule_project_job_path(build.project, build)
end
private private
......
...@@ -15,6 +15,7 @@ module Gitlab ...@@ -15,6 +15,7 @@ module Gitlab
Status::Build::Retryable], Status::Build::Retryable],
[Status::Build::Failed], [Status::Build::Failed],
[Status::Build::FailedAllowed, [Status::Build::FailedAllowed,
Status::Build::Unschedule,
Status::Build::Play, Status::Build::Play,
Status::Build::Stop], Status::Build::Stop],
[Status::Build::Action], [Status::Build::Action],
......
module Gitlab
module Ci
module Status
module Build
class Unschedule < Status::Extended
def label
'unschedule action'
end
def has_action?
can?(user, :update_build, subject)
end
def action_icon
'time-out'
end
def action_title
'Unschedule'
end
def action_button_title
_('Unschedule job')
end
def action_path
unschedule_project_job_path(subject.project, subject)
end
def action_method
:post
end
def self.matches?(build, user)
build.scheduled?
end
end
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