diff --git a/config/locales/en.yml b/config/locales/en.yml index b47caa075893d5fb7fc24ed2f0e296fbe87706c4..fedeeef0e9a51b3934b74999146cf1568f3c8fea 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -10,8 +10,6 @@ en: pwa_short_name: "PWA short name" pwa_description: "PWA description" pwa_icon: "Icon" - application_setting: - ai_access_token: "Personal access token" incident_management/timeline_event: note: 'Timeline text' issue_link: diff --git a/ee/app/helpers/admin/application_settings_helper.rb b/ee/app/helpers/admin/application_settings_helper.rb index 7b6681ec9401a6e6dec58b6f0cb0a233e81d7249..0d9b5101306d191324414fff1745167d3f5211dd 100644 --- a/ee/app/helpers/admin/application_settings_helper.rb +++ b/ee/app/helpers/admin/application_settings_helper.rb @@ -15,13 +15,6 @@ def code_suggestions_description .html_safe % { link_start: link_start, link_end: '</a>'.html_safe } end - def code_suggestions_token_explanation - link_start = code_suggestions_link_start(code_suggestions_pat_docs_url) - - 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 } - 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) @@ -49,10 +42,6 @@ def code_suggestions_agreement_url def code_suggestions_ai_docs_url 'https://docs.gitlab.com/ee/user/ai_features.html#third-party-services' 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 # rubocop:disable Rails/OutputSafety diff --git a/ee/app/views/admin/application_settings/_ai_access.html.haml b/ee/app/views/admin/application_settings/_ai_access.html.haml index 6151621f66d45e4aab69ac67445bfec3be8247bf..c50b25ce61738b5c626786e89a87983f40d407fa 100644 --- a/ee/app/views/admin/application_settings/_ai_access.html.haml +++ b/ee/app/views/admin/application_settings/_ai_access.html.haml @@ -2,9 +2,6 @@ - return unless License.feature_available?(:code_suggestions) - expanded = integration_expanded?('ai_access') -- token_is_present = @application_setting.ai_access_token.present? -- token_label = token_is_present ? s_('CodeSuggestionsSM|Enter new personal access token') : s_('CodeSuggestionsSM|Personal access token') -- token_value = token_is_present ? ApplicationSetting::MASK_PASSWORD : '' %section.settings.no-animate#js-ai-access-settings{ class: ('expanded' if expanded) } .settings-header @@ -24,9 +21,5 @@ = f.gitlab_ui_checkbox_component :instance_level_code_suggestions_enabled, 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' } - %p.form-text.text-muted{ id: 'code_suggestions_token_explanation' } - = code_suggestions_token_explanation = f.submit _('Save changes'), pajamas_button: true diff --git a/ee/spec/helpers/admin/application_settings_helper_spec.rb b/ee/spec/helpers/admin/application_settings_helper_spec.rb index b28ca54ec3de9509300c55236231dffdf8cf612b..0b2698b727e9c36ce2c3904d9caca9cdb5f45f19 100644 --- a/ee/spec/helpers/admin/application_settings_helper_spec.rb +++ b/ee/spec/helpers/admin/application_settings_helper_spec.rb @@ -10,12 +10,6 @@ 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 } - - it { is_expected.to include 'https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token' } - end - describe '#code_suggestions_agreement' do subject { helper.code_suggestions_agreement } diff --git a/ee/spec/views/admin/application_settings/_ai_access.html.haml_spec.rb b/ee/spec/views/admin/application_settings/_ai_access.html.haml_spec.rb deleted file mode 100644 index 6e4e256e6855eefb9570911cf90dcca6615211b4..0000000000000000000000000000000000000000 --- a/ee/spec/views/admin/application_settings/_ai_access.html.haml_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'admin/application_settings/_ai_access.html.haml', :with_license, feature_category: :code_suggestions do - let_it_be(:admin) { build_stubbed(:admin) } - let(:page) { Capybara::Node::Simple.new(rendered) } - - before do - allow(::Gitlab).to receive(:org_or_com?).and_return(false) # Will not render partial for .com or .org - assign(:application_setting, application_setting) - allow(view).to receive(:current_user) { admin } - allow(view).to receive(:expanded).and_return(true) - stub_licensed_features(code_suggestions: true) - end - - context 'when ai_access_token is not set' do - let(:application_setting) { build(:application_setting) } - - it 'renders an empty password field' do - render - expect(rendered).to have_field('Personal access token', type: 'password') - expect(page.find_field('Personal access token').value).to be_blank - end - end - - context 'when ai_access_token is set' do - let(:application_setting) do - build(:application_setting, ai_access_token: 'ai_access_token', - instance_level_code_suggestions_enabled: true) - end - - it 'renders masked password field' do - render - expect(rendered).to have_field('Enter new personal access token', type: 'password') - expect(page.find_field('Enter new personal access token').value).to eq(ApplicationSetting::MASK_PASSWORD) - end - end -end diff --git a/ee/spec/views/admin/application_settings/general.html.haml_spec.rb b/ee/spec/views/admin/application_settings/general.html.haml_spec.rb index d800d1c45675ae6a5328a7418668bf32da9acf81..b71042a5561ff58177d32b71021d28d06b1f3f76 100644 --- a/ee/spec/views/admin/application_settings/general.html.haml_spec.rb +++ b/ee/spec/views/admin/application_settings/general.html.haml_spec.rb @@ -145,7 +145,6 @@ it 'does not render the form' do render expect(rendered).not_to have_field('application_setting_instance_level_code_suggestions_enabled') - expect(rendered).not_to have_field('application_setting_ai_access_token') end end @@ -167,7 +166,6 @@ it 'renders the form' do render expect(rendered).to have_field('application_setting_instance_level_code_suggestions_enabled') - expect(rendered).to have_field('application_setting_ai_access_token') end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 7ca4705cf810890229c8c077f2212158d9081a98..43f451f3f953f1a93a4d1efc3c9467c4e1a39138 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -11527,15 +11527,6 @@ msgstr "" msgid "CodeSuggestionsSM|Enable Code Suggestions for users of this instance. %{link_start}What are Code Suggestions?%{link_end}" msgstr "" -msgid "CodeSuggestionsSM|Enter new personal access token" -msgstr "" - -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|Personal access token" -msgstr "" - msgid "CodeSuggestions|%{link_start}What are code suggestions?%{link_end}" msgstr ""