Commit ada615e7 authored by Frédéric Caplette's avatar Frédéric Caplette

Merge branch '341029-geo-sites-route-rename' into 'master'

Geo - Rename routes from Nodes to Sites

See merge request gitlab-org/gitlab!78150
parents 37c553d0 7e9d16fa
......@@ -62,7 +62,7 @@ Example response:
"container_repositories_max_capacity": 10,
"sync_object_storage": false,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/3/edit",
"web_edit_url": "https://primary.example.com/admin/geo/sites/3/edit",
"web_geo_projects_url": "http://secondary.example.com/admin/geo/projects",
"_links": {
"self": "https://primary.example.com/api/v4/geo_nodes/3",
......@@ -103,7 +103,7 @@ Example response:
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/1/edit",
"web_edit_url": "https://primary.example.com/admin/geo/sites/1/edit",
"_links": {
"self": "https://primary.example.com/api/v4/geo_nodes/1",
"status":"https://primary.example.com/api/v4/geo_nodes/1/status",
......@@ -128,7 +128,7 @@ Example response:
"minimum_reverification_interval": 7,
"sync_object_storage": true,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/2/edit",
"web_edit_url": "https://primary.example.com/admin/geo/sites/2/edit",
"web_geo_projects_url": "https://secondary.example.com/admin/geo/projects",
"_links": {
"self":"https://primary.example.com/api/v4/geo_nodes/2",
......@@ -169,7 +169,7 @@ Example response:
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/1/edit",
"web_edit_url": "https://primary.example.com/admin/geo/sites/1/edit",
"_links": {
"self": "https://primary.example.com/api/v4/geo_nodes/1",
"status":"https://primary.example.com/api/v4/geo_nodes/1/status",
......@@ -226,7 +226,7 @@ Example response:
"minimum_reverification_interval": 7,
"sync_object_storage": true,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/2/edit",
"web_edit_url": "https://primary.example.com/admin/geo/sites/2/edit",
"web_geo_projects_url": "https://secondary.example.com/admin/geo/projects",
"_links": {
"self":"https://primary.example.com/api/v4/geo_nodes/2",
......@@ -277,7 +277,7 @@ Example response:
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/1/edit",
"web_edit_url": "https://primary.example.com/admin/geo/sites/1/edit",
"_links": {
"self": "https://primary.example.com/api/v4/geo_nodes/1",
"status":"https://primary.example.com/api/v4/geo_nodes/1/status",
......
......@@ -29,7 +29,7 @@ export default {
return this.node && this.node.primary;
},
pageTitle() {
return this.node ? __('Edit Geo Node') : __('Add New Node');
return this.node ? __('Edit Geo Site') : __('Add New Site');
},
pillDetails() {
return {
......
......@@ -18,12 +18,12 @@ class Admin::Geo::NodesController < Admin::Geo::ApplicationController
end
def new
@form_title = _('Add New Node')
@form_title = _('Add New Site')
render :form
end
def edit
@form_title = _('Edit Geo Node')
@form_title = _('Edit Geo Site')
render :form
end
......
- add_to_breadcrumbs _('Geo Nodes'), admin_geo_nodes_path
- add_to_breadcrumbs _('Geo Sites'), admin_geo_nodes_path
- page_title @form_title
#js-geo-node-form{ data: { "selective-sync-types" => selective_sync_types_json,
......
......@@ -50,7 +50,12 @@ namespace :admin do
get '/projects', to: redirect(path: 'admin/geo/replication/projects')
get '/designs', to: redirect(path: 'admin/geo/replication/designs')
resources :nodes, only: [:index, :create, :new, :edit, :update]
resources :nodes, path: 'sites', only: [:index, :create, :new, :edit, :update]
# Old Route Replaced in 14.7
get '/nodes', to: redirect(path: 'admin/geo/sites')
get '/nodes/new', to: redirect(path: 'admin/geo/sites/new')
get '/nodes/:id/edit', to: redirect(path: 'admin/geo/sites/%{id}/edit')
scope '/replication' do
get '/', to: redirect(path: 'admin/geo/replication/projects')
......
......@@ -21,7 +21,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do
breadcrumbs = page.all(:css, '.breadcrumbs-list>li')
expect(breadcrumbs.length).to eq(3)
expect(breadcrumbs[0].text).to eq('Admin Area')
expect(breadcrumbs[1].text).to eq('Geo Nodes')
expect(breadcrumbs[1].text).to eq('Geo Sites')
expect(breadcrumbs[2].text).to eq(text)
end
......@@ -136,7 +136,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do
end
it 'includes Geo Nodes in breadcrumbs' do
expect_breadcrumb('Add New Node')
expect_breadcrumb('Add New Site')
end
end
......@@ -161,7 +161,7 @@ RSpec.describe 'admin Geo Nodes', :js, :geo do
end
it 'includes Geo Nodes in breadcrumbs' do
expect_breadcrumb('Edit Geo Node')
expect_breadcrumb('Edit Geo Site')
end
end
......
......@@ -34,9 +34,9 @@ describe('GeoNodeFormApp', () => {
describe.each`
formType | node | title | pillTitle | variant
${'create a secondary node'} | ${null} | ${'Add New Node'} | ${'Secondary'} | ${'muted'}
${'update a secondary node'} | ${{ primary: false }} | ${'Edit Geo Node'} | ${'Secondary'} | ${'muted'}
${'update a primary node'} | ${{ primary: true }} | ${'Edit Geo Node'} | ${'Primary'} | ${'info'}
${'create a secondary node'} | ${null} | ${'Add New Site'} | ${'Secondary'} | ${'muted'}
${'update a secondary node'} | ${{ primary: false }} | ${'Edit Geo Site'} | ${'Secondary'} | ${'muted'}
${'update a primary node'} | ${{ primary: true }} | ${'Edit Geo Site'} | ${'Primary'} | ${'info'}
`(`form header`, ({ formType, node, title, pillTitle, variant }) => {
describe(`when node form is to ${formType}`, () => {
beforeEach(() => {
......
......@@ -68,4 +68,4 @@ export const MOCK_ERROR_MESSAGE = {
url: ["can't be blank", 'must be a valid URL'],
};
export const MOCK_NODES_PATH = 'gitlab/admin/geo/nodes';
export const MOCK_NODES_PATH = 'gitlab/admin/geo/sites';
export const MOCK_NEW_NODE_URL = 'http://localhost:3000/admin/geo/nodes/new';
export const MOCK_NEW_NODE_URL = 'http://localhost:3000/admin/geo/sites/new';
export const MOCK_EMPTY_STATE_SVG = 'illustrations/empty-state/geo-empty.svg';
......@@ -140,7 +140,7 @@ export const MOCK_NODES = [
replicationSlotsUsedCount: 0,
version: '10.4.0-pre',
revision: 'b93c51849b',
webEditUrl: 'http://127.0.0.1:3001/admin/geo/nodes/1',
webEditUrl: 'http://127.0.0.1:3001/admin/geo/sites/1',
},
{
id: 2,
......@@ -210,7 +210,7 @@ export const MOCK_NODE_STATUSES_RES = [
replication_slots_used_count: 0,
version: '10.4.0-pre',
revision: 'b93c51849b',
web_edit_url: 'http://127.0.0.1:3001/admin/geo/nodes/1',
web_edit_url: 'http://127.0.0.1:3001/admin/geo/sites/1',
},
{
geo_node_id: 2,
......
......@@ -10,4 +10,4 @@ export const MOCK_BASIC_SETTINGS_DATA = {
export const STRING_OVER_255 = new Array(257).join('a');
export const MOCK_NODES_PATH = 'gitlab/admin/geo/nodes';
export const MOCK_NODES_PATH = 'gitlab/admin/geo/sites';
......@@ -63,7 +63,7 @@ RSpec.describe API::GeoNodes, :request_store, :geo, :prometheus, api: true do
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('public_api/v4/geo_node', dir: 'ee')
expect(json_response['web_edit_url']).to end_with("/admin/geo/nodes/#{primary.id}/edit")
expect(json_response['web_edit_url']).to end_with("/admin/geo/sites/#{primary.id}/edit")
links = json_response['_links']
expect(links['self']).to end_with("/api/v4/geo_nodes/#{primary.id}")
......
......@@ -44,23 +44,39 @@ RSpec.describe 'EE-specific admin routing' do
let(:geo_node) { create(:geo_node) }
it 'routes / to #index' do
expect(get('/admin/geo/nodes')).to route_to('admin/geo/nodes#index')
expect(get('/admin/geo')).to route_to('admin/geo/nodes#index')
end
it 'routes /sites to #index' do
expect(get('/admin/geo/sites')).to route_to('admin/geo/nodes#index')
end
it 'routes /new to #new' do
expect(get('/admin/geo/nodes/new')).to route_to('admin/geo/nodes#new')
expect(get('/admin/geo/sites/new')).to route_to('admin/geo/nodes#new')
end
it 'routes /edit to #edit' do
expect(get("/admin/geo/nodes/#{geo_node.id}/edit")).to route_to('admin/geo/nodes#edit', id: geo_node.to_param)
expect(get("/admin/geo/sites/#{geo_node.id}/edit")).to route_to('admin/geo/nodes#edit', id: geo_node.to_param)
end
it 'routes post / to #create' do
expect(post('/admin/geo/nodes/')).to route_to('admin/geo/nodes#create')
expect(post('/admin/geo/sites/')).to route_to('admin/geo/nodes#create')
end
it 'routes patch /:id to #update' do
expect(patch("/admin/geo/nodes/#{geo_node.id}")).to route_to('admin/geo/nodes#update', id: geo_node.to_param)
expect(patch("/admin/geo/sites/#{geo_node.id}")).to route_to('admin/geo/nodes#update', id: geo_node.to_param)
end
it 'redirects /nodes to /sites', type: :request do
expect(get('/admin/geo/nodes')).to redirect_to('/admin/geo/sites')
end
it 'redirects /nodes/new to /sites/new', type: :request do
expect(get('/admin/geo/nodes/new')).to redirect_to('/admin/geo/sites/new')
end
it 'redirects /nodes/:id/edit to /sites/:id/new', type: :request do
expect(get("/admin/geo/nodes/#{geo_node.id}/edit")).to redirect_to("/admin/geo/sites/#{geo_node.id}/edit")
end
end
......
......@@ -11,7 +11,7 @@ RSpec.shared_examples 'allowlisted /admin/geo requests' do
end
context 'allowlisted requests' do
it_behaves_like 'allowlisted request', :patch, '/admin/geo/nodes/1'
it_behaves_like 'allowlisted request', :patch, '/admin/geo/sites/1'
it_behaves_like 'allowlisted request', :delete, '/admin/geo/replication/projects/1'
......
......@@ -1982,7 +1982,7 @@ msgstr ""
msgid "Add LICENSE"
msgstr ""
msgid "Add New Node"
msgid "Add New Site"
msgstr ""
msgid "Add README"
......@@ -12799,7 +12799,7 @@ msgstr ""
msgid "Edit Deploy Key"
msgstr ""
msgid "Edit Geo Node"
msgid "Edit Geo Site"
msgstr ""
msgid "Edit Group Hook"
......@@ -15614,15 +15614,15 @@ msgstr ""
msgid "Geo"
msgstr ""
msgid "Geo Nodes"
msgstr ""
msgid "Geo Replication"
msgstr ""
msgid "Geo Settings"
msgstr ""
msgid "Geo Sites"
msgstr ""
msgid "Geo sites"
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