2018-10-30 15:05:07 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-08 04:48:08 -05:00
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
module Status
|
2016-12-08 11:52:24 -05:00
|
|
|
module Build
|
2017-05-05 09:21:06 -04:00
|
|
|
class Cancelable < Status::Extended
|
2016-12-08 08:28:49 -05:00
|
|
|
def has_action?
|
|
|
|
can?(user, :update_build, subject)
|
2016-12-08 04:48:08 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def action_icon
|
2017-10-09 08:16:21 -04:00
|
|
|
'cancel'
|
2016-12-08 04:48:08 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def action_path
|
2017-06-29 13:06:35 -04:00
|
|
|
cancel_project_job_path(subject.project, subject)
|
2016-12-08 04:48:08 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def action_method
|
|
|
|
:post
|
|
|
|
end
|
|
|
|
|
2016-12-08 12:18:30 -05:00
|
|
|
def action_title
|
|
|
|
'Cancel'
|
|
|
|
end
|
|
|
|
|
2018-03-29 13:24:19 -04:00
|
|
|
def action_button_title
|
|
|
|
_('Cancel this job')
|
|
|
|
end
|
|
|
|
|
2016-12-08 08:28:49 -05:00
|
|
|
def self.matches?(build, user)
|
2016-12-08 04:48:08 -05:00
|
|
|
build.cancelable?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|