Commit 95ad935b authored by Mike Greiling's avatar Mike Greiling

Merge branch...

Merge branch '34418-admin-setting-integrations-incorrectly-report-validation-errors-in-ui' into 'master'

Remove unrelated errors from individual integrations

Closes #34418

See merge request gitlab-org/gitlab!18814
parents 6f23a004 3fb020e8
...@@ -416,9 +416,6 @@ linters: ...@@ -416,9 +416,6 @@ linters:
- 'app/views/u2f/_register.html.haml' - 'app/views/u2f/_register.html.haml'
- 'app/views/users/_deletion_guidance.html.haml' - 'app/views/users/_deletion_guidance.html.haml'
- 'ee/app/views/admin/_namespace_plan_info.html.haml' - 'ee/app/views/admin/_namespace_plan_info.html.haml'
- 'ee/app/views/admin/application_settings/_elasticsearch_form.html.haml'
- 'ee/app/views/admin/application_settings/_slack.html.haml'
- 'ee/app/views/admin/application_settings/_snowplow.html.haml'
- 'ee/app/views/admin/application_settings/_templates.html.haml' - 'ee/app/views/admin/application_settings/_templates.html.haml'
- 'ee/app/views/admin/audit_logs/index.html.haml' - 'ee/app/views/admin/audit_logs/index.html.haml'
- 'ee/app/views/admin/dashboard/stats.html.haml' - 'ee/app/views/admin/dashboard/stats.html.haml'
......
...@@ -315,6 +315,10 @@ module ApplicationSettingsHelper ...@@ -315,6 +315,10 @@ module ApplicationSettingsHelper
Rails.env.test? Rails.env.test?
end end
def integration_expanded?(substring)
@application_setting.errors.any? { |k| k.to_s.start_with?(substring) }
end
def instance_clusters_enabled? def instance_clusters_enabled?
can?(current_user, :read_cluster, Clusters::Instance.new) can?(current_user, :read_cluster, Clusters::Instance.new)
end end
......
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-plantuml-settings'), html: { class: 'fieldset-form' } do |f| - expanded = integration_expanded?('plantuml_')
= form_errors(@application_setting) %section.settings.as-plantuml.no-animate#js-plantuml-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('PlantUML')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _('Allow rendering of PlantUML diagrams in Asciidoc documents.')
.settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-plantuml-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) if expanded
%fieldset %fieldset
.form-group .form-group
.form-check .form-check
= f.check_box :plantuml_enabled, class: 'form-check-input' = f.check_box :plantuml_enabled, class: 'form-check-input'
= f.label :plantuml_enabled, class: 'form-check-label' do = f.label :plantuml_enabled, _('Enable PlantUML'), class: 'form-check-label'
Enable PlantUML
.form-group .form-group
= f.label :plantuml_url, 'PlantUML URL', class: 'label-bold' = f.label :plantuml_url, 'PlantUML URL', class: 'label-bold'
= f.text_field :plantuml_url, class: 'form-control', placeholder: 'http://gitlab.your-plantuml-instance.com:8080' = f.text_field :plantuml_url, class: 'form-control', placeholder: 'http://gitlab.your-plantuml-instance.com:8080'
...@@ -15,4 +24,4 @@ ...@@ -15,4 +24,4 @@
= link_to "PlantUML", "http://plantuml.com" = link_to "PlantUML", "http://plantuml.com"
diagrams in Asciidoc documents using an external PlantUML service. diagrams in Asciidoc documents using an external PlantUML service.
= f.submit 'Save changes', class: "btn btn-success" = f.submit _('Save changes'), class: "btn btn-success"
- expanded = true if !@application_setting.valid? && @application_setting.errors.any? { |k| k.to_s.start_with?('snowplow_') } - expanded = integration_expanded?('snowplow_')
%section.settings.as-snowplow.no-animate#js-snowplow-settings{ class: ('expanded' if expanded) } %section.settings.as-snowplow.no-animate#js-snowplow-settings{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
.settings-content .settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-snowplow-settings'), html: { class: 'fieldset-form' } do |f| = form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-snowplow-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) = form_errors(@application_setting) if expanded
%fieldset %fieldset
.form-group .form-group
......
- application_setting = local_assigns.fetch(:application_setting) - expanded = integration_expanded?('hide_third_party_')
%section.settings.as-third-party-offers.no-animate#js-third-party-offers-settings{ class: ('expanded' if expanded) }
.settings-header
%h4
= _('Third party offers')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _('Control the display of third party offers.')
.settings-content
= form_for application_setting, url: integrations_admin_application_settings_path(anchor: 'js-third-party-offers-settings'), html: { class: 'fieldset-form' } do |f| = form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-third-party-offers-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(application_setting) = form_errors(@application_setting) if expanded
%fieldset %fieldset
.form-group .form-group
.form-check .form-check
= f.check_box :hide_third_party_offers, class: 'form-check-input' = f.check_box :hide_third_party_offers, class: 'form-check-input'
= f.label :hide_third_party_offers, class: 'form-check-label' do = f.label :hide_third_party_offers, _('Do not display offers from third parties within GitLab'), class: 'form-check-label'
Do not display offers from third parties within GitLab
= f.submit 'Save changes', class: "btn btn-success" = f.submit _('Save changes'), class: "btn btn-success"
...@@ -2,31 +2,10 @@ ...@@ -2,31 +2,10 @@
- page_title _("Integrations") - page_title _("Integrations")
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
= render_if_exists 'admin/application_settings/elasticsearch_form', expanded: expanded_by_default? = render_if_exists 'admin/application_settings/elasticsearch_form'
= render 'admin/application_settings/plantuml'
%section.settings.as-plantuml.no-animate#js-plantuml-settings{ class: ('expanded' if expanded_by_default?) } = render_if_exists 'admin/application_settings/slack'
.settings-header = render 'admin/application_settings/third_party_offers'
%h4 = render 'admin/application_settings/snowplow'
= _('PlantUML')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded_by_default? ? _('Collapse') : _('Expand')
%p
= _('Allow rendering of PlantUML diagrams in Asciidoc documents.')
.settings-content
= render 'plantuml'
= render_if_exists 'admin/application_settings/slack', expanded: expanded_by_default?
%section.settings.as-third-party-offers.no-animate#js-third-party-offers-settings{ class: ('expanded' if expanded_by_default?) }
.settings-header
%h4
= _('Third party offers')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded_by_default? ? _('Collapse') : _('Expand')
%p
= _('Control the display of third party offers.')
.settings-content
= render 'third_party_offers', application_setting: @application_setting
= render 'admin/application_settings/snowplow', expanded: expanded_by_default?
= render_if_exists 'admin/application_settings/pendo' = render_if_exists 'admin/application_settings/pendo'
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
- recreate_index_url = help_page_url('integration/elasticsearch.md') - recreate_index_url = help_page_url('integration/elasticsearch.md')
- recreate_index_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: recreate_index_url } - recreate_index_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: recreate_index_url }
- recreate_index_text = s_("Changes won't take place until the index is %{link_start}recreated%{link_end}.").html_safe % { link_start: recreate_index_link_start, link_end: '</a>'.html_safe } - recreate_index_text = s_("Changes won't take place until the index is %{link_start}recreated%{link_end}.").html_safe % { link_start: recreate_index_link_start, link_end: '</a>'.html_safe }
- expanded = integration_expanded?('elasticsearch_')
%section.settings.as-elasticsearch.no-animate#js-elasticsearch-settings{ class: ('expanded' if expanded), data: { qa_selector: 'elasticsearch_tab' } } %section.settings.as-elasticsearch.no-animate#js-elasticsearch-settings{ class: ('expanded' if expanded), data: { qa_selector: 'elasticsearch_tab' } }
.settings-header .settings-header
...@@ -15,7 +16,7 @@ ...@@ -15,7 +16,7 @@
.settings-content .settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings'), html: { class: 'fieldset-form' } do |f| = form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) = form_errors(@application_setting) if expanded
%fieldset %fieldset
.sub-section .sub-section
...@@ -40,7 +41,7 @@ ...@@ -40,7 +41,7 @@
= f.label :elasticsearch_url, 'URL', class: 'label-bold' = f.label :elasticsearch_url, 'URL', class: 'label-bold'
= f.text_field :elasticsearch_url, value: @application_setting.elasticsearch_url.join(', '), class: 'form-control', placeholder: 'http://localhost:9200', data: { qa_selector: 'url_field' } = f.text_field :elasticsearch_url, value: @application_setting.elasticsearch_url.join(', '), class: 'form-control', placeholder: 'http://localhost:9200', data: { qa_selector: 'url_field' }
.form-text.text-muted .form-text.text-muted
The URL to use for connecting to Elasticsearch. Use a comma-separated list to support clustering (e.g., "http://localhost:9200, http://localhost:9201"). = _('The URL to use for connecting to Elasticsearch. Use a comma-separated list to support clustering (e.g., "http://localhost:9200, http://localhost:9201").')
.form-group .form-group
= f.label :elasticsearch_shards, _('Number of Elasticsearch shards'), class: 'label-bold' = f.label :elasticsearch_shards, _('Number of Elasticsearch shards'), class: 'label-bold'
...@@ -73,7 +74,7 @@ ...@@ -73,7 +74,7 @@
= f.text_field :elasticsearch_project_ids, class: 'js-elasticsearch-projects', value: elasticsearch_project_ids, data: { selected: elasticsearch_objects_options(@application_setting.elasticsearch_limited_projects(true)).to_json } = f.text_field :elasticsearch_project_ids, class: 'js-elasticsearch-projects', value: elasticsearch_project_ids, data: { selected: elasticsearch_objects_options(@application_setting.elasticsearch_limited_projects(true)).to_json }
.sub-section .sub-section
%h4 Elasticsearch AWS IAM credentials %h4= _('Elasticsearch AWS IAM credentials')
.form-group .form-group
.form-check .form-check
= f.check_box :elasticsearch_aws, class: 'form-check-input' = f.check_box :elasticsearch_aws, class: 'form-check-input'
...@@ -83,18 +84,18 @@ ...@@ -83,18 +84,18 @@
= f.label :elasticsearch_aws_region, 'AWS region', class: 'label-bold' = f.label :elasticsearch_aws_region, 'AWS region', class: 'label-bold'
= f.text_field :elasticsearch_aws_region, value: @application_setting.elasticsearch_aws_region, class: 'form-control' = f.text_field :elasticsearch_aws_region, value: @application_setting.elasticsearch_aws_region, class: 'form-control'
.form-text.text-muted .form-text.text-muted
Region that elasticsearch is configured = _('Region that Elasticsearch is configured')
.form-group .form-group
= f.label :elasticsearch_aws_access_key, 'AWS Access Key', class: 'label-bold' = f.label :elasticsearch_aws_access_key, _('AWS Access Key'), class: 'label-bold'
= f.text_field :elasticsearch_aws_access_key, value: @application_setting.elasticsearch_aws_access_key, class: 'form-control' = f.text_field :elasticsearch_aws_access_key, value: @application_setting.elasticsearch_aws_access_key, class: 'form-control'
.form-text.text-muted .form-text.text-muted
AWS Access Key. Only required if not using role instance credentials = _('AWS Access Key. Only required if not using role instance credentials')
.form-group .form-group
= f.label :elasticsearch_aws_secret_access_key, 'AWS Secret Access Key', class: 'label-bold' = f.label :elasticsearch_aws_secret_access_key, _('AWS Secret Access Key'), class: 'label-bold'
= f.password_field :elasticsearch_aws_secret_access_key, value: @application_setting.elasticsearch_aws_secret_access_key, class: 'form-control' = f.password_field :elasticsearch_aws_secret_access_key, value: @application_setting.elasticsearch_aws_secret_access_key, class: 'form-control'
.form-text.text-muted .form-text.text-muted
AWS Secret Access Key. Only required if not using role instance credentials = _('AWS Secret Access Key. Only required if not using role instance credentials')
= f.submit 'Save changes', class: "btn btn-success", data: { qa_selector: 'submit_button' } = f.submit _('Save changes'), class: "btn btn-success", data: { qa_selector: 'submit_button' }
- return unless Gitlab.dev_env_or_com? - return unless Gitlab.dev_env_or_com?
- expanded = integration_expanded?('slack_app_')
%section.settings.as-slack.no-animate#js-slack-settings{ class: ('expanded' if expanded) } %section.settings.as-slack.no-animate#js-slack-settings{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4 %h4
...@@ -11,7 +12,7 @@ ...@@ -11,7 +12,7 @@
.settings-content .settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-slack-settings'), html: { class: 'fieldset-form' } do |f| = form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-slack-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) = form_errors(@application_setting) if expanded
%fieldset %fieldset
.form-group .form-group
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
= f.label :slack_app_enabled, class: 'form-check-label' do = f.label :slack_app_enabled, class: 'form-check-label' do
Enable Slack application Enable Slack application
.form-text.text-muted .form-text.text-muted
This option is only available on GitLab.com = _('This option is only available on GitLab.com')
.form-group .form-group
= f.label :slack_app_id, 'APP_ID', class: 'label-bold' = f.label :slack_app_id, 'APP_ID', class: 'label-bold'
= f.text_field :slack_app_id, class: 'form-control' = f.text_field :slack_app_id, class: 'form-control'
...@@ -31,5 +32,5 @@ ...@@ -31,5 +32,5 @@
= f.label :slack_app_verification_token, 'Verification token', class: 'label-bold' = f.label :slack_app_verification_token, 'Verification token', class: 'label-bold'
= f.text_field :slack_app_verification_token, class: 'form-control' = f.text_field :slack_app_verification_token, class: 'form-control'
= f.submit 'Save changes', class: "btn btn-success" = f.submit _('Save changes'), class: "btn btn-success"
...@@ -52,6 +52,9 @@ describe 'Admin updates EE-only settings' do ...@@ -52,6 +52,9 @@ describe 'Admin updates EE-only settings' do
context 'Elasticsearch settings' do context 'Elasticsearch settings' do
before do before do
visit integrations_admin_application_settings_path visit integrations_admin_application_settings_path
page.within('.as-elasticsearch') do
click_button 'Expand'
end
end end
it 'changes elasticsearch settings' do it 'changes elasticsearch settings' do
...@@ -73,7 +76,7 @@ describe 'Admin updates EE-only settings' do ...@@ -73,7 +76,7 @@ describe 'Admin updates EE-only settings' do
end end
end end
it 'Allows limiting projects and namespaces to index', :js do it 'Allows limiting projects and namespaces to index', :aggregate_failures, :js do
project = create(:project) project = create(:project)
namespace = create(:namespace) namespace = create(:namespace)
...@@ -119,7 +122,7 @@ describe 'Admin updates EE-only settings' do ...@@ -119,7 +122,7 @@ describe 'Admin updates EE-only settings' do
expect(page).to have_content 'Application settings saved successfully' expect(page).to have_content 'Application settings saved successfully'
end end
it 'Allows removing all namespaces and projects', :js do it 'Allows removing all namespaces and projects', :aggregate_failures, :js do
stub_ee_application_setting(elasticsearch_limit_indexing: true) stub_ee_application_setting(elasticsearch_limit_indexing: true)
namespace = create(:elasticsearch_indexed_namespace).namespace namespace = create(:elasticsearch_indexed_namespace).namespace
...@@ -131,6 +134,8 @@ describe 'Admin updates EE-only settings' do ...@@ -131,6 +134,8 @@ describe 'Admin updates EE-only settings' do
expect(ElasticsearchIndexedProject.count).to be > 0 expect(ElasticsearchIndexedProject.count).to be > 0
page.within('.as-elasticsearch') do page.within('.as-elasticsearch') do
click_button 'Expand'
expect(page).to have_content('Namespaces to index') expect(page).to have_content('Namespaces to index')
expect(page).to have_content('Projects to index') expect(page).to have_content('Projects to index')
expect(page).to have_content(namespace.full_name) expect(page).to have_content(namespace.full_name)
......
...@@ -704,6 +704,18 @@ msgstr "" ...@@ -704,6 +704,18 @@ msgstr ""
msgid "API Token" msgid "API Token"
msgstr "" msgstr ""
msgid "AWS Access Key"
msgstr ""
msgid "AWS Access Key. Only required if not using role instance credentials"
msgstr ""
msgid "AWS Secret Access Key"
msgstr ""
msgid "AWS Secret Access Key. Only required if not using role instance credentials"
msgstr ""
msgid "Abort" msgid "Abort"
msgstr "" msgstr ""
...@@ -5739,6 +5751,9 @@ msgstr "" ...@@ -5739,6 +5751,9 @@ msgstr ""
msgid "Display name" msgid "Display name"
msgstr "" msgstr ""
msgid "Do not display offers from third parties within GitLab"
msgstr ""
msgid "Do you want to customize how Google Code email addresses and usernames are imported into GitLab?" msgid "Do you want to customize how Google Code email addresses and usernames are imported into GitLab?"
msgstr "" msgstr ""
...@@ -5925,6 +5940,9 @@ msgstr "" ...@@ -5925,6 +5940,9 @@ msgstr ""
msgid "Elasticsearch" msgid "Elasticsearch"
msgstr "" msgstr ""
msgid "Elasticsearch AWS IAM credentials"
msgstr ""
msgid "Elasticsearch indexing restrictions" msgid "Elasticsearch indexing restrictions"
msgstr "" msgstr ""
...@@ -6033,6 +6051,9 @@ msgstr "" ...@@ -6033,6 +6051,9 @@ msgstr ""
msgid "Enable Incident Management inbound alert limit" msgid "Enable Incident Management inbound alert limit"
msgstr "" msgstr ""
msgid "Enable PlantUML"
msgstr ""
msgid "Enable Pseudonymizer data collection" msgid "Enable Pseudonymizer data collection"
msgstr "" msgstr ""
...@@ -13709,6 +13730,9 @@ msgstr "" ...@@ -13709,6 +13730,9 @@ msgstr ""
msgid "Regex pattern" msgid "Regex pattern"
msgstr "" msgstr ""
msgid "Region that Elasticsearch is configured"
msgstr ""
msgid "Register" msgid "Register"
msgstr "" msgstr ""
...@@ -16501,6 +16525,9 @@ msgstr "" ...@@ -16501,6 +16525,9 @@ msgstr ""
msgid "The Issue Tracker is the place to add things that need to be improved or solved in a project. You can register or sign in to create issues for this project." msgid "The Issue Tracker is the place to add things that need to be improved or solved in a project. You can register or sign in to create issues for this project."
msgstr "" msgstr ""
msgid "The URL to use for connecting to Elasticsearch. Use a comma-separated list to support clustering (e.g., \"http://localhost:9200, http://localhost:9201\")."
msgstr ""
msgid "The X509 Certificate to use when mutual TLS is required to communicate with the external authorization service. If left blank, the server certificate is still validated when accessing over HTTPS." msgid "The X509 Certificate to use when mutual TLS is required to communicate with the external authorization service. If left blank, the server certificate is still validated when accessing over HTTPS."
msgstr "" msgstr ""
...@@ -17131,6 +17158,9 @@ msgstr "" ...@@ -17131,6 +17158,9 @@ msgstr ""
msgid "This option is disabled as you don't have write permissions for the current branch" msgid "This option is disabled as you don't have write permissions for the current branch"
msgstr "" msgstr ""
msgid "This option is only available on GitLab.com"
msgstr ""
msgid "This page is unavailable because you are not allowed to read information across multiple projects." msgid "This page is unavailable because you are not allowed to read information across multiple projects."
msgstr "" msgstr ""
......
...@@ -38,7 +38,26 @@ describe ApplicationSettingsHelper do ...@@ -38,7 +38,26 @@ describe ApplicationSettingsHelper do
it_behaves_like 'when HTTP protocol is in use', 'http' it_behaves_like 'when HTTP protocol is in use', 'http'
context 'with tracking parameters' do context 'with tracking parameters' do
it { expect(visible_attributes).to include(*%i(snowplow_collector_hostname snowplow_cookie_domain snowplow_enabled snowplow_site_id))} it { expect(visible_attributes).to include(*%i(snowplow_collector_hostname snowplow_cookie_domain snowplow_enabled snowplow_site_id)) }
it { expect(visible_attributes).to include(*%i(pendo_enabled pendo_url))} it { expect(visible_attributes).to include(*%i(pendo_enabled pendo_url)) }
end
describe '.integration_expanded?' do
let(:application_setting) { build(:application_setting) }
it 'is expanded' do
application_setting.plantuml_enabled = true
application_setting.valid?
helper.instance_variable_set(:@application_setting, application_setting)
expect(helper.integration_expanded?('plantuml_')).to be_truthy
end
it 'is not expanded' do
application_setting.valid?
helper.instance_variable_set(:@application_setting, application_setting)
expect(helper.integration_expanded?('plantuml_')).to be_falsey
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment