2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
module AutoDevopsHelper
|
|
|
|
def show_auto_devops_callout?(project)
|
2020-06-23 00:09:42 +05:30
|
|
|
Feature.disabled?(:auto_devops_banner_disabled) &&
|
2018-03-17 18:26:18 +05:30
|
|
|
show_callout?('auto_devops_settings_dismissed') &&
|
|
|
|
can?(current_user, :admin_pipeline, project) &&
|
|
|
|
project.has_auto_devops_implicitly_disabled? &&
|
|
|
|
!project.repository.gitlab_ci_yml &&
|
|
|
|
!project.ci_service
|
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
def badge_for_auto_devops_scope(auto_devops_receiver)
|
|
|
|
return unless auto_devops_receiver.auto_devops_enabled?
|
|
|
|
|
|
|
|
case auto_devops_receiver.first_auto_devops_config[:scope]
|
|
|
|
when :project
|
|
|
|
nil
|
|
|
|
when :group
|
|
|
|
s_('CICD|group enabled')
|
|
|
|
when :instance
|
|
|
|
s_('CICD|instance enabled')
|
|
|
|
end
|
|
|
|
end
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
def auto_devops_settings_path(project)
|
|
|
|
project_settings_ci_cd_path(project, anchor: 'autodevops-settings')
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|