Welcome to mirror list, hosted at ThFree Co, Russian Federation.

settings_helper.rb « application_settings « admin « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0a7f20caa02dacafb2e4048f304058e45c2d03bf (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# frozen_string_literal: true

module Admin
  module ApplicationSettings
    module SettingsHelper
      def inactive_projects_deletion_data(settings)
        {
          delete_inactive_projects: settings.delete_inactive_projects.to_s,
          inactive_projects_delete_after_months: settings.inactive_projects_delete_after_months,
          inactive_projects_min_size_mb: settings.inactive_projects_min_size_mb,
          inactive_projects_send_warning_email_after_months: settings.inactive_projects_send_warning_email_after_months
        }
      end

      def project_missing_pipeline_yaml?(project)
        project.repository&.gitlab_ci_yml.blank?
      end

      def code_suggestions_token_explanation
        link_start = code_suggestions_link_start(code_suggestions_pat_docs_url)

        # rubocop:disable Layout/LineLength
        # rubocop:disable Style/FormatString
        s_('CodeSuggestionsSM|Your personal access token from GitLab.com. See the %{link_start}documentation%{link_end} for information on creating a personal access token.')
          .html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
        # rubocop:enable Style/FormatString
        # rubocop:enable Layout/LineLength
      end

      def code_suggestions_agreement
        terms_link_start = code_suggestions_link_start(code_suggestions_agreement_url)
        ai_docs_link_start = code_suggestions_link_start(code_suggestions_ai_docs_url)

        # rubocop:disable Layout/LineLength
        # rubocop:disable Style/FormatString
        s_('CodeSuggestionsSM|&#8226; Agree to the %{terms_link_start}GitLab Testing Agreement%{link_end}.%{br} &#8226; Acknowledge that GitLab will send data from the instance, including personal data, to Google for cloud hosting.%{br} &nbsp;&nbsp;&nbsp;We may also send data to %{ai_docs_link_start}third-party AI providers%{link_end} to provide this feature.')
          .html_safe % { terms_link_start: terms_link_start, ai_docs_link_start: ai_docs_link_start, link_end: '</a>'.html_safe, br: '</br>'.html_safe }
        # rubocop:enable Style/FormatString
        # rubocop:enable Layout/LineLength
      end

      private

      # rubocop:disable Gitlab/DocUrl
      # We want to link SaaS docs for flexibility for every URL related to Code Suggestions on Self Managed.
      # We expect to update docs often during the Beta and we want to point user to the most up to date information.
      def code_suggestions_docs_url
        'https://docs.gitlab.com/ee/user/project/repository/code_suggestions.html'
      end

      def code_suggestions_agreement_url
        'https://about.gitlab.com/handbook/legal/testing-agreement/'
      end

      def code_suggestions_ai_docs_url
        'https://docs.gitlab.com/ee/user/ai_features.html'
      end

      def code_suggestions_pat_docs_url
        'https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token'
      end
      # rubocop:enable Gitlab/DocUrl

      def code_suggestions_link_start(url)
        "<a href=\"#{url}\" target=\"_blank\" rel=\"noopener noreferrer\">".html_safe
      end
    end
  end
end