Commit b3bede33 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'justin_ho-fix-old-integration-settings' into 'master'

Move old integrations to Settings > General and introduce instance-level integrations

See merge request gitlab-org/gitlab!38488
parents bd64e82c 855a5db7
...@@ -16,7 +16,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -16,7 +16,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
push_frontend_feature_flag(:ci_instance_variables_ui, default_enabled: true) push_frontend_feature_flag(:ci_instance_variables_ui, default_enabled: true)
end end
VALID_SETTING_PANELS = %w(general integrations repository VALID_SETTING_PANELS = %w(general repository
ci_cd reporting metrics_and_profiling ci_cd reporting metrics_and_profiling
network preferences).freeze network preferences).freeze
...@@ -32,12 +32,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -32,12 +32,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end end
def integrations def integrations
if Feature.enabled?(:instance_level_integrations) @integrations = Service.find_or_initialize_instances.sort_by(&:title)
@integrations = Service.find_or_initialize_instances.sort_by(&:title)
else
set_application_setting
perform_update if submitted?
end
end end
def update def update
......
...@@ -12,7 +12,7 @@ class Admin::IntegrationsController < Admin::ApplicationController ...@@ -12,7 +12,7 @@ class Admin::IntegrationsController < Admin::ApplicationController
end end
def integrations_enabled? def integrations_enabled?
Feature.enabled?(:instance_level_integrations) true
end end
def scoped_edit_integration_path(integration) def scoped_edit_integration_path(integration)
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
= _('Amazon EKS integration allows you to provision EKS clusters from GitLab.') = _('Amazon EKS integration allows you to provision EKS clusters from GitLab.')
.settings-content .settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-eks-settings'), html: { class: 'fieldset-form' } do |f| = form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-eks-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) = form_errors(@application_setting)
%fieldset %fieldset
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
%p %p
= _('Allow rendering of PlantUML diagrams in Asciidoc documents.') = _('Allow rendering of PlantUML diagrams in Asciidoc documents.')
.settings-content .settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-plantuml-settings'), html: { class: 'fieldset-form' } do |f| = form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-plantuml-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) if expanded = form_errors(@application_setting) if expanded
%fieldset %fieldset
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
%p %p
= _('Configure the %{link} integration.').html_safe % { link: link_to('Snowplow', 'https://snowplowanalytics.com/', target: '_blank') } = _('Configure the %{link} integration.').html_safe % { link: link_to('Snowplow', 'https://snowplowanalytics.com/', target: '_blank') }
.settings-content .settings-content
= form_for @application_setting, url: general_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) if expanded = form_errors(@application_setting) if expanded
%fieldset %fieldset
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
.settings-content .settings-content
= form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-sourcegraph-settings'), html: { class: 'fieldset-form' } do |f| = form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-sourcegraph-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting) = form_errors(@application_setting)
%fieldset %fieldset
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
%p %p
= _('Control the display of third party offers.') = _('Control the display of third party offers.')
.settings-content .settings-content
= form_for @application_setting, url: general_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) if expanded = form_errors(@application_setting) if expanded
%fieldset %fieldset
......
...@@ -116,11 +116,10 @@ ...@@ -116,11 +116,10 @@
.settings-content .settings-content
#js-maintenance-mode-settings #js-maintenance-mode-settings
- if Feature.enabled?(:instance_level_integrations) = render_if_exists 'admin/application_settings/elasticsearch_form'
= render_if_exists 'admin/application_settings/elasticsearch_form' = render 'admin/application_settings/plantuml'
= render 'admin/application_settings/plantuml' = render 'admin/application_settings/sourcegraph'
= render 'admin/application_settings/sourcegraph' = render_if_exists 'admin/application_settings/slack'
= render_if_exists 'admin/application_settings/slack' = render 'admin/application_settings/third_party_offers'
= render 'admin/application_settings/third_party_offers' = render 'admin/application_settings/snowplow'
= render 'admin/application_settings/snowplow' = render 'admin/application_settings/eks'
= render 'admin/application_settings/eks'
...@@ -2,29 +2,19 @@ ...@@ -2,29 +2,19 @@
- page_title _('Integrations') - page_title _('Integrations')
- @content_class = 'limit-container-width' unless fluid_layout - @content_class = 'limit-container-width' unless fluid_layout
- if Feature.enabled?(:instance_level_integrations) - if show_admin_integrations_moved?
- if show_admin_integrations_moved? .gl-alert.gl-alert-info.js-admin-integrations-moved.mt-3{ role: 'alert', data: { feature_id: UserCalloutsHelper::ADMIN_INTEGRATIONS_MOVED, dismiss_endpoint: user_callouts_path } }
.gl-alert.gl-alert-info.js-admin-integrations-moved.mt-3{ role: 'alert', data: { feature_id: UserCalloutsHelper::ADMIN_INTEGRATIONS_MOVED, dismiss_endpoint: user_callouts_path } } = sprite_icon('information-o', css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
= sprite_icon('information-o', css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title') %button.js-close.gl-alert-dismiss{ type: 'button', 'aria-label' => _('Dismiss') }
%button.js-close.gl-alert-dismiss{ type: 'button', 'aria-label' => _('Dismiss') } = sprite_icon('close', css_class: 'gl-icon')
= sprite_icon('close', css_class: 'gl-icon') .gl-alert-body
.gl-alert-body %h4.gl-alert-title= s_('AdminSettings|Some settings have moved')
%h4.gl-alert-title= s_('AdminSettings|Some settings have moved') = html_escape_once(s_('AdminSettings|Elasticsearch, PlantUML, Slack application, Third party offers, Snowplow, Amazon EKS have moved to Settings &gt; General.')).html_safe
= html_escape_once(s_('AdminSettings|Elasticsearch, PlantUML, Slack application, Third party offers, Snowplow, Amazon EKS have moved to Settings &gt; General.')).html_safe .gl-alert-actions
.gl-alert-actions = link_to s_('AdminSettings|Go to General Settings'), general_admin_application_settings_path, class: 'btn gl-alert-action btn-info new-gl-button'
= link_to s_('AdminSettings|Go to General Settings'), general_admin_application_settings_path, class: 'btn gl-alert-action btn-info new-gl-button'
%h4= s_('AdminSettings|Apply integration settings to all Projects') %h4= s_('AdminSettings|Apply integration settings to all Projects')
%p %p
= s_('AdminSettings|Integrations configured here will automatically apply to all projects on this instance.') = s_('AdminSettings|Integrations configured here will automatically apply to all projects on this instance.')
= link_to _('Learn more'), '#' = link_to _('Learn more'), '#'
= render 'shared/integrations/index', integrations: @integrations = render 'shared/integrations/index', integrations: @integrations
- else
= render_if_exists 'admin/application_settings/elasticsearch_form'
= render 'admin/application_settings/plantuml'
= render 'admin/application_settings/sourcegraph'
= render_if_exists 'admin/application_settings/slack'
= render 'admin/application_settings/third_party_offers'
= render 'admin/application_settings/snowplow'
= render 'admin/application_settings/eks'
---
title: Move old integrations to Settings > General and introduce instance-level integrations
merge_request: 38488
author:
type: added
...@@ -14,7 +14,7 @@ class Admin::ElasticsearchController < Admin::ApplicationController ...@@ -14,7 +14,7 @@ class Admin::ElasticsearchController < Admin::ApplicationController
flash[:warning] = _('Please create an index before enabling indexing') flash[:warning] = _('Please create an index before enabling indexing')
end end
redirect_to integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings') redirect_to redirect_path
end end
# POST # POST
...@@ -27,6 +27,12 @@ class Admin::ElasticsearchController < Admin::ApplicationController ...@@ -27,6 +27,12 @@ class Admin::ElasticsearchController < Admin::ApplicationController
flash[:notice] = _('Elasticsearch reindexing triggered') flash[:notice] = _('Elasticsearch reindexing triggered')
end end
redirect_to integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings') redirect_to redirect_path
end
private
def redirect_path
general_admin_application_settings_path(anchor: 'js-elasticsearch-settings')
end end
end end
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
%p %p
= _('Elasticsearch integration. Elasticsearch AWS IAM.') = _('Elasticsearch integration. Elasticsearch AWS IAM.')
.settings-content .settings-content
= form_for @application_setting, url: general_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) if expanded = form_errors(@application_setting) if expanded
%fieldset %fieldset
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
%p %p
= _('Slack integration allows you to interact with GitLab via slash commands in a chat window.') = _('Slack integration allows you to interact with GitLab via slash commands in a chat window.')
.settings-content .settings-content
= form_for @application_setting, url: general_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) if expanded = form_errors(@application_setting) if expanded
%fieldset %fieldset
...@@ -33,4 +32,3 @@ ...@@ -33,4 +32,3 @@
= 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"
= feature_entry(_('Elasticsearch'), = feature_entry(_('Elasticsearch'),
href: integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings'), href: general_admin_application_settings_path(anchor: 'js-elasticsearch-settings'),
doc_href: help_page_path('integration/elasticsearch'), doc_href: help_page_path('integration/elasticsearch'),
enabled: Gitlab::CurrentSettings.elasticsearch_search?) enabled: Gitlab::CurrentSettings.elasticsearch_search?)
......
...@@ -19,7 +19,7 @@ RSpec.describe Admin::ElasticsearchController do ...@@ -19,7 +19,7 @@ RSpec.describe Admin::ElasticsearchController do
post :enqueue_index post :enqueue_index
expect(controller).to set_flash[:notice].to include('/admin/sidekiq/queues/elastic_full_index') expect(controller).to set_flash[:notice].to include('/admin/sidekiq/queues/elastic_full_index')
expect(response).to redirect_to integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings') expect(response).to redirect_to general_admin_application_settings_path(anchor: 'js-elasticsearch-settings')
end end
context 'without an index' do context 'without an index' do
...@@ -33,7 +33,7 @@ RSpec.describe Admin::ElasticsearchController do ...@@ -33,7 +33,7 @@ RSpec.describe Admin::ElasticsearchController do
post :enqueue_index post :enqueue_index
expect(controller).to set_flash[:warning].to include('create an index before enabling indexing') expect(controller).to set_flash[:warning].to include('create an index before enabling indexing')
expect(response).to redirect_to integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings') expect(response).to redirect_to general_admin_application_settings_path(anchor: 'js-elasticsearch-settings')
end end
end end
end end
...@@ -49,7 +49,7 @@ RSpec.describe Admin::ElasticsearchController do ...@@ -49,7 +49,7 @@ RSpec.describe Admin::ElasticsearchController do
post :trigger_reindexing post :trigger_reindexing
expect(controller).to set_flash[:notice].to include('reindexing triggered') expect(controller).to set_flash[:notice].to include('reindexing triggered')
expect(response).to redirect_to integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings') expect(response).to redirect_to general_admin_application_settings_path(anchor: 'js-elasticsearch-settings')
end end
it 'does not create a reindexing task if there is another one' do it 'does not create a reindexing task if there is another one' do
...@@ -59,7 +59,7 @@ RSpec.describe Admin::ElasticsearchController do ...@@ -59,7 +59,7 @@ RSpec.describe Admin::ElasticsearchController do
post :trigger_reindexing post :trigger_reindexing
expect(controller).to set_flash[:warning].to include('already in progress') expect(controller).to set_flash[:warning].to include('already in progress')
expect(response).to redirect_to integrations_admin_application_settings_path(anchor: 'js-elasticsearch-settings') expect(response).to redirect_to general_admin_application_settings_path(anchor: 'js-elasticsearch-settings')
end end
end end
end end
...@@ -6,7 +6,6 @@ RSpec.describe 'Admin updates EE-only settings' do ...@@ -6,7 +6,6 @@ RSpec.describe 'Admin updates EE-only settings' do
include StubENV include StubENV
before do before do
stub_feature_flags(instance_level_integrations: false)
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
sign_in(create(:admin)) sign_in(create(:admin))
allow(License).to receive(:feature_available?).and_return(true) allow(License).to receive(:feature_available?).and_return(true)
...@@ -53,7 +52,7 @@ RSpec.describe 'Admin updates EE-only settings' do ...@@ -53,7 +52,7 @@ RSpec.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 general_admin_application_settings_path
page.within('.as-elasticsearch') do page.within('.as-elasticsearch') do
click_button 'Expand' click_button 'Expand'
end end
...@@ -115,7 +114,7 @@ RSpec.describe 'Admin updates EE-only settings' do ...@@ -115,7 +114,7 @@ RSpec.describe 'Admin updates EE-only settings' do
end end
page.within('#select2-drop') do page.within('#select2-drop') do
expect(page).to have_content(project.full_path) expect(page).to have_content(project.name_with_namespace)
end end
page.within('.as-elasticsearch') do page.within('.as-elasticsearch') do
...@@ -135,7 +134,7 @@ RSpec.describe 'Admin updates EE-only settings' do ...@@ -135,7 +134,7 @@ RSpec.describe 'Admin updates EE-only settings' do
namespace = create(:elasticsearch_indexed_namespace).namespace namespace = create(:elasticsearch_indexed_namespace).namespace
project = create(:elasticsearch_indexed_project).project project = create(:elasticsearch_indexed_project).project
visit integrations_admin_application_settings_path visit general_admin_application_settings_path
expect(ElasticsearchIndexedNamespace.count).to be > 0 expect(ElasticsearchIndexedNamespace.count).to be > 0
expect(ElasticsearchIndexedProject.count).to be > 0 expect(ElasticsearchIndexedProject.count).to be > 0
...@@ -165,7 +164,7 @@ RSpec.describe 'Admin updates EE-only settings' do ...@@ -165,7 +164,7 @@ RSpec.describe 'Admin updates EE-only settings' do
it 'Enable Slack application' do it 'Enable Slack application' do
allow(Gitlab).to receive(:com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
visit integrations_admin_application_settings_path visit general_admin_application_settings_path
page.within('.as-slack') do page.within('.as-slack') do
check 'Enable Slack application' check 'Enable Slack application'
......
...@@ -71,7 +71,7 @@ module QA ...@@ -71,7 +71,7 @@ module QA
module Settings module Settings
autoload :Templates, 'qa/ee/page/admin/settings/templates' autoload :Templates, 'qa/ee/page/admin/settings/templates'
autoload :Integration, 'qa/ee/page/admin/settings/integration' autoload :Elasticsearch, 'qa/ee/page/admin/settings/elasticsearch'
autoload :Preferences, 'qa/ee/page/admin/settings/preferences' autoload :Preferences, 'qa/ee/page/admin/settings/preferences'
module Component module Component
......
...@@ -5,7 +5,7 @@ module QA ...@@ -5,7 +5,7 @@ module QA
module Page module Page
module Admin module Admin
module Settings module Settings
class Integration < QA::Page::Base class Elasticsearch < QA::Page::Base
include QA::Page::Settings::Common include QA::Page::Settings::Common
view 'ee/app/views/admin/application_settings/_elasticsearch_form.html.haml' do view 'ee/app/views/admin/application_settings/_elasticsearch_form.html.haml' do
......
...@@ -17,9 +17,9 @@ module QA ...@@ -17,9 +17,9 @@ module QA
def fabricate! def fabricate!
QA::Page::Main::Menu.perform(&:go_to_admin_area) QA::Page::Main::Menu.perform(&:go_to_admin_area)
QA::Page::Admin::Menu.perform(&:go_to_integration_settings) QA::Page::Admin::Menu.perform(&:go_to_general_settings)
QA::EE::Page::Admin::Settings::Integration.perform do |integration| QA::EE::Page::Admin::Settings::Elasticsearch.perform do |settings|
integration.expand_elasticsearch do |es| settings.expand_elasticsearch do |es|
es.check_indexing if @es_indexing es.check_indexing if @es_indexing
es.check_search if @es_enabled es.check_search if @es_enabled
es.enter_link(@es_url) es.enter_link(@es_url)
......
...@@ -142,23 +142,12 @@ RSpec.describe Admin::ApplicationSettingsController do ...@@ -142,23 +142,12 @@ RSpec.describe Admin::ApplicationSettingsController do
end end
describe 'verify panel actions' do describe 'verify panel actions' do
before do
stub_feature_flags(instance_level_integrations: false)
end
Admin::ApplicationSettingsController::VALID_SETTING_PANELS.each do |valid_action| Admin::ApplicationSettingsController::VALID_SETTING_PANELS.each do |valid_action|
it_behaves_like 'renders correct panels' do it_behaves_like 'renders correct panels' do
let(:action) { valid_action } let(:action) { valid_action }
end end
end end
end end
end
describe 'PATCH #integrations' do
before do
stub_feature_flags(instance_level_integrations: false)
sign_in(admin)
end
describe 'EKS integration' do describe 'EKS integration' do
let(:application_setting) { ApplicationSetting.current } let(:application_setting) { ApplicationSetting.current }
...@@ -172,7 +161,7 @@ RSpec.describe Admin::ApplicationSettingsController do ...@@ -172,7 +161,7 @@ RSpec.describe Admin::ApplicationSettingsController do
end end
it 'updates EKS settings' do it 'updates EKS settings' do
patch :integrations, params: { application_setting: settings_params } put :update, params: { application_setting: settings_params }
expect(application_setting.eks_integration_enabled).to be_truthy expect(application_setting.eks_integration_enabled).to be_truthy
expect(application_setting.eks_account_id).to eq '123456789012' expect(application_setting.eks_account_id).to eq '123456789012'
...@@ -186,7 +175,7 @@ RSpec.describe Admin::ApplicationSettingsController do ...@@ -186,7 +175,7 @@ RSpec.describe Admin::ApplicationSettingsController do
it 'does not update the secret key' do it 'does not update the secret key' do
application_setting.update!(eks_secret_access_key: 'dummy secret key') application_setting.update!(eks_secret_access_key: 'dummy secret key')
patch :integrations, params: { application_setting: settings_params } put :update, params: { application_setting: settings_params }
expect(application_setting.reload.eks_secret_access_key).to eq 'dummy secret key' expect(application_setting.reload.eks_secret_access_key).to eq 'dummy secret key'
end end
......
...@@ -10,16 +10,6 @@ RSpec.describe Admin::IntegrationsController do ...@@ -10,16 +10,6 @@ RSpec.describe Admin::IntegrationsController do
end end
describe '#edit' do describe '#edit' do
context 'when instance_level_integrations not enabled' do
it 'returns not_found' do
stub_feature_flags(instance_level_integrations: false)
get :edit, params: { id: Service.available_services_names.sample }
expect(response).to have_gitlab_http_status(:not_found)
end
end
Service.available_services_names.each do |integration_name| Service.available_services_names.each do |integration_name|
context "#{integration_name}" do context "#{integration_name}" do
it 'successfully displays the template' do it 'successfully displays the template' do
......
...@@ -209,8 +209,7 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n ...@@ -209,8 +209,7 @@ RSpec.describe 'Admin updates settings', :clean_gitlab_redis_shared_state, :do_n
context 'Integrations page' do context 'Integrations page' do
before do before do
stub_feature_flags(instance_level_integrations: false) visit general_admin_application_settings_path
visit integrations_admin_application_settings_path
end end
it 'Enable hiding third party offers' do it 'Enable hiding third party offers' do
......
...@@ -205,11 +205,10 @@ RSpec.describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do ...@@ -205,11 +205,10 @@ RSpec.describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
before do before do
stub_feature_flags(instance_level_integrations: false)
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
sign_in(admin) sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
visit integrations_admin_application_settings_path visit general_admin_application_settings_path
end end
it 'user does not see the offer' do it 'user does not see the offer' do
......
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