2018-10-30 15:05:07 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-08 04:40:56 -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 Stop < Status::Extended
|
2016-12-08 04:40:56 -05:00
|
|
|
def label
|
2016-12-13 05:53:36 -05:00
|
|
|
'manual stop action'
|
|
|
|
end
|
|
|
|
|
2016-12-08 08:28:49 -05:00
|
|
|
def has_action?
|
|
|
|
can?(user, :update_build, subject)
|
2016-12-08 04:40:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def action_icon
|
2017-10-09 08:16:21 -04:00
|
|
|
'stop'
|
2016-12-08 12:18:30 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def action_title
|
|
|
|
'Stop'
|
2016-12-08 04:40:56 -05:00
|
|
|
end
|
|
|
|
|
2018-03-29 13:24:19 -04:00
|
|
|
def action_button_title
|
|
|
|
_('Stop this environment')
|
|
|
|
end
|
|
|
|
|
2016-12-08 04:40:56 -05:00
|
|
|
def action_path
|
2017-06-29 13:06:35 -04:00
|
|
|
play_project_job_path(subject.project, subject)
|
2016-12-08 04:40:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def action_method
|
|
|
|
:post
|
|
|
|
end
|
|
|
|
|
2016-12-08 08:28:49 -05:00
|
|
|
def self.matches?(build, user)
|
2016-12-08 04:40:56 -05:00
|
|
|
build.playable? && build.stops_environment?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|