2018-08-18 07:19:57 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-05 09:39:19 -04:00
|
|
|
module AutoDevopsHelper
|
2017-09-05 07:35:31 -04:00
|
|
|
def show_auto_devops_callout?(project)
|
2020-06-02 08:08:33 -04:00
|
|
|
Feature.disabled?(:auto_devops_banner_disabled) &&
|
2017-09-12 08:00:50 -04:00
|
|
|
show_callout?('auto_devops_settings_dismissed') &&
|
2017-09-07 07:23:05 -04:00
|
|
|
can?(current_user, :admin_pipeline, project) &&
|
2017-09-12 03:21:47 -04:00
|
|
|
project.has_auto_devops_implicitly_disabled? &&
|
|
|
|
!project.repository.gitlab_ci_yml &&
|
2017-09-16 09:02:37 -04:00
|
|
|
!project.ci_service
|
|
|
|
end
|
2019-03-12 06:15:33 -04:00
|
|
|
|
|
|
|
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-13 23:09:24 -04:00
|
|
|
|
|
|
|
def auto_devops_settings_path(project)
|
|
|
|
project_settings_ci_cd_path(project, anchor: 'autodevops-settings')
|
|
|
|
end
|
2017-09-05 07:35:31 -04:00
|
|
|
end
|