Commit f9fa7317 authored by Zack Cuddy's avatar Zack Cuddy

Geo Settings Form - Remove Old Code

This MR is an attempt at MVC.

This MR removes the feature flag for the new JS Form.
This MR also removes all the old HAML code of the old form.
parent 89528ec0
import initGeoSettingsForm from 'ee/geo_settings';
if (gon.features?.enableGeoSettingsFormJs) {
document.addEventListener('DOMContentLoaded', initGeoSettingsForm);
}
document.addEventListener('DOMContentLoaded', initGeoSettingsForm);
......@@ -3,9 +3,6 @@
class Admin::Geo::SettingsController < Admin::ApplicationSettingsController
helper ::EE::GeoHelper
before_action :check_license!, except: :show
before_action do
push_frontend_feature_flag(:enable_geo_settings_form_js)
end
def show
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 @@
= render partial: 'admin/geo/shared/license_alert'
- if Gitlab::Geo.license_allows?
- if Feature.enabled?(:enable_geo_settings_form_js)
#js-geo-settings-form
- else
= render_if_exists 'admin/geo/settings/form'
- else
= render 'shared/empty_states/geo'
---
title: Geo Settings Form - Redesign
merge_request: 35879
author:
type: changed
......@@ -15,9 +15,7 @@ RSpec.describe 'Admin updates EE-only settings' do
context 'Geo settings' do
context 'when the license has Geo feature' do
context 'when enable_geo_settings_form_js is false' do
before do
stub_feature_flags(enable_geo_settings_form_js: false)
visit admin_geo_settings_path
end
......@@ -25,47 +23,18 @@ RSpec.describe 'Admin updates EE-only settings' 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
context 'when enable_geo_settings_form_js is true' do
before do
stub_feature_flags(enable_geo_settings_form_js: true)
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).not_to have_css(".geo-haml-form")
end
end
end
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)
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.")
end
end
......
......@@ -10453,9 +10453,6 @@ msgstr ""
msgid "Geo Settings"
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"
msgstr ""
......@@ -13735,9 +13732,6 @@ msgstr ""
msgid "List available repositories"
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"
msgstr ""
......@@ -22907,9 +22901,6 @@ msgstr ""
msgid "The above settings apply to all projects with the selected compliance framework(s)."
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."
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