diff --git a/app/helpers/admin/application_settings/settings_helper.rb b/app/helpers/admin/application_settings/settings_helper.rb index 0a7f20caa02dacafb2e4048f304058e45c2d03bf..9ea07ba4e6e624c581c2c6ec97c571a816f97708 100644 --- a/app/helpers/admin/application_settings/settings_helper.rb +++ b/app/helpers/admin/application_settings/settings_helper.rb @@ -16,12 +16,23 @@ def project_missing_pipeline_yaml?(project) project.repository&.gitlab_ci_yml.blank? end + def code_suggestions_description + link_start = code_suggestions_link_start(code_suggestions_docs_url) + + # rubocop:disable Layout/LineLength + # rubocop:disable Style/FormatString + s_('CodeSuggestionsSM|Enable Code Suggestions for users of this instance. %{link_start}What are Code Suggestions?%{link_end}') + .html_safe % { link_start: link_start, link_end: '</a>'.html_safe } + # rubocop:enable Style/FormatString + # rubocop:enable Layout/LineLength + 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.') + s_('CodeSuggestionsSM|On GitLab.com, create a token. This token is required to use Code Suggestions on your self-managed instance. %{link_start}How do I create a token?%{link_end}') .html_safe % { link_start: link_start, link_end: '</a>'.html_safe } # rubocop:enable Style/FormatString # rubocop:enable Layout/LineLength @@ -33,8 +44,8 @@ def code_suggestions_agreement # rubocop:disable Layout/LineLength # rubocop:disable Style/FormatString - s_('CodeSuggestionsSM|• Agree to the %{terms_link_start}GitLab Testing Agreement%{link_end}.%{br} • Acknowledge that GitLab will send data from the instance, including personal data, to Google for cloud hosting.%{br} 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 } + s_('CodeSuggestionsSM|By enabling this feature, you agree to the %{terms_link_start}GitLab Testing Agreement%{link_end} and acknowledge that GitLab will send data from the instance, including personal data, to our %{ai_docs_link_start}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 } # rubocop:enable Style/FormatString # rubocop:enable Layout/LineLength end @@ -53,7 +64,7 @@ def code_suggestions_agreement_url end def code_suggestions_ai_docs_url - 'https://docs.gitlab.com/ee/user/ai_features.html' + 'https://docs.gitlab.com/ee/user/ai_features.html#third-party-services' end def code_suggestions_pat_docs_url diff --git a/app/views/admin/application_settings/_ai_access.html.haml b/app/views/admin/application_settings/_ai_access.html.haml index 41b0a08128e0025ec9db3cac5c1ea15fe75b2b84..97f46adef5184865bc47f501609bb30a06bf1c6c 100644 --- a/app/views/admin/application_settings/_ai_access.html.haml +++ b/app/views/admin/application_settings/_ai_access.html.haml @@ -12,8 +12,7 @@ = render Pajamas::ButtonComponent.new(button_options: { class: 'js-settings-toggle' }) do = expanded ? _('Collapse') : _('Expand') %p - = s_('CodeSuggestionsSM|Enable Code Suggestion for users of this GitLab instance.') - = link_to sprite_icon('question-o'), code_suggestions_docs_url, target: '_blank', class: 'has-tooltip', title: _('More information') + = code_suggestions_description .settings-content = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-ai-access-settings'), html: { class: 'fieldset-form', id: 'ai-access-settings' } do |f| @@ -22,7 +21,7 @@ %fieldset .form-group = f.gitlab_ui_checkbox_component :instance_level_code_suggestions_enabled, - s_('CodeSuggestionsSM|Turn on Code Suggestions for this instance. By turning on this feature, you:'), + s_('CodeSuggestionsSM|Enable Code Suggestions for this instance %{beta}').html_safe % { beta: gl_badge_tag(_('Beta'), variant: :neutral, size: :sm) }, help_text: code_suggestions_agreement = f.label :ai_access_token, token_label, class: 'label-bold' = f.password_field :ai_access_token, value: token_value, autocomplete: 'on', class: 'form-control gl-form-input', aria: { describedby: 'code_suggestions_token_explanation' } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 6483fbf7a21d862c34128341a9588e55a1ece7da..96d134eaeb14c6b933b58e21dcb5c425c694f7cb 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -11148,25 +11148,25 @@ msgstr "" msgid "CodeSuggestionsAlert|Get started with Code Suggestions, available for free during the beta period." msgstr "" -msgid "CodeSuggestionsSM|• Agree to the %{terms_link_start}GitLab Testing Agreement%{link_end}.%{br} • Acknowledge that GitLab will send data from the instance, including personal data, to Google for cloud hosting.%{br} We may also send data to %{ai_docs_link_start}third-party AI providers%{link_end} to provide this feature." +msgid "CodeSuggestionsSM|By enabling this feature, you agree to the %{terms_link_start}GitLab Testing Agreement%{link_end} and acknowledge that GitLab will send data from the instance, including personal data, to our %{ai_docs_link_start}AI providers%{link_end} to provide this feature." msgstr "" msgid "CodeSuggestionsSM|Code Suggestions" msgstr "" -msgid "CodeSuggestionsSM|Enable Code Suggestion for users of this GitLab instance." +msgid "CodeSuggestionsSM|Enable Code Suggestions for this instance %{beta}" msgstr "" -msgid "CodeSuggestionsSM|Enter new personal access token" +msgid "CodeSuggestionsSM|Enable Code Suggestions for users of this instance. %{link_start}What are Code Suggestions?%{link_end}" msgstr "" -msgid "CodeSuggestionsSM|Personal access token" +msgid "CodeSuggestionsSM|Enter new personal access token" msgstr "" -msgid "CodeSuggestionsSM|Turn on Code Suggestions for this instance. By turning on this feature, you:" +msgid "CodeSuggestionsSM|On GitLab.com, create a token. This token is required to use Code Suggestions on your self-managed instance. %{link_start}How do I create a token?%{link_end}" msgstr "" -msgid "CodeSuggestionsSM|Your personal access token from GitLab.com. See the %{link_start}documentation%{link_end} for information on creating a personal access token." +msgid "CodeSuggestionsSM|Personal access token" msgstr "" msgid "CodeSuggestionsThirdPartyAlert|%{code_suggestions_link_start}Code Suggestions%{link_end} now uses third-party AI services to provide higher quality suggestions. You can %{third_party_link_start}disable third-party services%{link_end} for your group, or disable Code Suggestions entirely in %{profile_settings_link_start}your user profile%{link_end}." diff --git a/spec/helpers/admin/application_settings/settings_helper_spec.rb b/spec/helpers/admin/application_settings/settings_helper_spec.rb index efffc224eb2f0b712d797d837dd6df248dcc2093..b008f52c0eb48bd7025e814fab3892f4ec753748 100644 --- a/spec/helpers/admin/application_settings/settings_helper_spec.rb +++ b/spec/helpers/admin/application_settings/settings_helper_spec.rb @@ -33,6 +33,12 @@ end describe 'Code Suggestions for Self-Managed instances', feature_category: :code_suggestions do + describe '#code_suggestions_description' do + subject { helper.code_suggestions_description } + + it { is_expected.to include 'https://docs.gitlab.com/ee/user/project/repository/code_suggestions.html' } + end + describe '#code_suggestions_token_explanation' do subject { helper.code_suggestions_token_explanation }