Commit f21a90f7 authored by Robert Speicher's avatar Robert Speicher

Merge branch '216134_05-geo-settings-remove-old' into 'master'

Geo Settings Form - Remove Old Code

Closes #216134

See merge request gitlab-org/gitlab!35879
parents f7634ac9 f9fa7317
import initGeoSettingsForm from 'ee/geo_settings'; import initGeoSettingsForm from 'ee/geo_settings';
if (gon.features?.enableGeoSettingsFormJs) { document.addEventListener('DOMContentLoaded', initGeoSettingsForm);
document.addEventListener('DOMContentLoaded', initGeoSettingsForm);
}
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
class Admin::Geo::SettingsController < Admin::ApplicationSettingsController class Admin::Geo::SettingsController < Admin::ApplicationSettingsController
helper ::EE::GeoHelper helper ::EE::GeoHelper
before_action :check_license!, except: :show before_action :check_license!, except: :show
before_action do
push_frontend_feature_flag(:enable_geo_settings_form_js)
end
def show def show
end end
......
%section.geo-haml-form
%h2.page-title
= _('Geo Settings')
%p.page-subtitle.light
= _('Geo allows you to replicate your GitLab instance to other geographical locations.')
= form_for @application_setting, url: admin_geo_settings_path, html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
.form-group
= f.label :geo_status_timeout, 'Connection timeout', class: 'label-bold'
= f.number_field :geo_status_timeout, class: 'form-control'
.form-text.text-muted
= _('The amount of seconds after which a request to get a secondary node status will time out.')
.form-group
= f.label :geo_node_allowed_ips, 'Allowed Geo IP', class: 'label-bold'
= f.text_field :geo_node_allowed_ips, class: 'form-control'
.form-text.text-muted
= _('List of IPs and CIDRs of allowed secondary nodes. Comma-separated, e.g. "1.1.1.1, 2.2.2.0/24"')
= f.submit _('Save changes'), class: "btn btn-success"
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
= render partial: 'admin/geo/shared/license_alert' = render partial: 'admin/geo/shared/license_alert'
- if Gitlab::Geo.license_allows? - if Gitlab::Geo.license_allows?
- if Feature.enabled?(:enable_geo_settings_form_js) #js-geo-settings-form
#js-geo-settings-form
- else
= render_if_exists 'admin/geo/settings/form'
- else - else
= render 'shared/empty_states/geo' = render 'shared/empty_states/geo'
---
title: Geo Settings Form - Redesign
merge_request: 35879
author:
type: changed
...@@ -15,57 +15,26 @@ RSpec.describe 'Admin updates EE-only settings' do ...@@ -15,57 +15,26 @@ RSpec.describe 'Admin updates EE-only settings' do
context 'Geo settings' do context 'Geo settings' do
context 'when the license has Geo feature' do context 'when the license has Geo feature' do
context 'when enable_geo_settings_form_js is false' do before do
before do visit admin_geo_settings_path
stub_feature_flags(enable_geo_settings_form_js: false)
visit admin_geo_settings_path
end
it 'hides JS alert' do
expect(page).not_to have_content("Geo is only available for users who have at least a Premium license.")
end
it 'renders HAML form instead of JS' do
expect(page).not_to have_css("#js-geo-settings-form")
expect(page).to have_css(".geo-haml-form")
end
it 'allows users to change Geo settings' do
page.within('section') do
fill_in 'Connection timeout', with: 15
fill_in 'Allowed Geo IP', with: '192.34.34.34'
click_button 'Save changes'
end
expect(current_settings.geo_status_timeout).to eq(15)
expect(current_settings.geo_node_allowed_ips).to eq('192.34.34.34')
expect(page).to have_content 'Application settings saved successfully'
end
end end
context 'when enable_geo_settings_form_js is true' do it 'hides JS alert' do
before do expect(page).not_to have_content("Geo is only available for users who have at least a Premium license.")
stub_feature_flags(enable_geo_settings_form_js: true) end
visit admin_geo_settings_path
end
it 'hides JS alert' do
expect(page).not_to have_content("Geo is only available for users who have at least a Premium license.")
end
it 'renders JS form instead of HAML' do it 'renders JS form' do
expect(page).to have_css("#js-geo-settings-form") expect(page).to have_css("#js-geo-settings-form")
expect(page).not_to have_css(".geo-haml-form")
end
end end
end end
context 'when the license does not have Geo feature' do context 'when the license does not have Geo feature' do
it 'shows JS alert' do before do
allow(License).to receive(:feature_available?).and_return(false) allow(License).to receive(:feature_available?).and_return(false)
visit admin_geo_settings_path visit admin_geo_settings_path
end
it 'shows JS alert' do
expect(page).to have_content("Geo is only available for users who have at least a Premium license.") expect(page).to have_content("Geo is only available for users who have at least a Premium license.")
end end
end end
......
...@@ -10453,9 +10453,6 @@ msgstr "" ...@@ -10453,9 +10453,6 @@ msgstr ""
msgid "Geo Settings" msgid "Geo Settings"
msgstr "" msgstr ""
msgid "Geo allows you to replicate your GitLab instance to other geographical locations."
msgstr ""
msgid "Geo nodes are paused using a command run on the node" msgid "Geo nodes are paused using a command run on the node"
msgstr "" msgstr ""
...@@ -13735,9 +13732,6 @@ msgstr "" ...@@ -13735,9 +13732,6 @@ msgstr ""
msgid "List available repositories" msgid "List available repositories"
msgstr "" msgstr ""
msgid "List of IPs and CIDRs of allowed secondary nodes. Comma-separated, e.g. \"1.1.1.1, 2.2.2.0/24\""
msgstr ""
msgid "List settings" msgid "List settings"
msgstr "" msgstr ""
...@@ -22907,9 +22901,6 @@ msgstr "" ...@@ -22907,9 +22901,6 @@ msgstr ""
msgid "The above settings apply to all projects with the selected compliance framework(s)." msgid "The above settings apply to all projects with the selected compliance framework(s)."
msgstr "" msgstr ""
msgid "The amount of seconds after which a request to get a secondary node status will time out."
msgstr ""
msgid "The application will be used where the client secret can be kept confidential. Native mobile apps and Single Page Apps are considered non-confidential." msgid "The application will be used where the client secret can be kept confidential. Native mobile apps and Single Page Apps are considered non-confidential."
msgstr "" msgstr ""
......
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