debian-mirror-gitlab/lib/gitlab/ci/status/build/manual.rb

41 lines
1.1 KiB
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
2018-05-09 12:01:36 +05:30
module Gitlab
module Ci
module Status
module Build
class Manual < Status::Extended
2022-06-21 17:19:12 +05:30
def self.matches?(build, user)
build.playable?
end
2018-05-09 12:01:36 +05:30
def illustration
{
image: 'illustrations/manual_action.svg',
size: 'svg-394',
title: _('This job requires a manual action'),
2022-06-21 17:19:12 +05:30
content: illustration_content
2018-05-09 12:01:36 +05:30
}
end
2022-06-21 17:19:12 +05:30
private
def illustration_content
if can?(user, :update_build, subject)
_('This job requires manual intervention to start. Before starting this job, you can add variables below for last-minute configuration changes.')
else
generic_permission_failure_message
end
end
def generic_permission_failure_message
_("This job does not run automatically and must be started manually, but you do not have access to it.")
2018-05-09 12:01:36 +05:30
end
end
end
end
end
end
2022-06-21 17:19:12 +05:30
Gitlab::Ci::Status::Build::Manual.prepend_mod_with('Gitlab::Ci::Status::Build::Manual')