summaryrefslogtreecommitdiff
path: root/app/helpers/auto_devops_helper.rb
blob: 0f0d5350df6ca464a8aa6f97548e45647855a1c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module AutoDevopsHelper
  def show_auto_devops_callout?(project)
    Feature.get(:auto_devops_banner_disabled).off? &&
      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

  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
end