Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a053ae57
Commit
a053ae57
authored
Oct 02, 2019
by
Brett Walker
Committed by
Douglas Barbosa Alexandre
Oct 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor geo and template application settings
routes into EE
parent
9b4313cf
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
6 deletions
+43
-6
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+8
-3
config/routes/admin.rb
config/routes/admin.rb
+1
-1
ee/app/controllers/ee/admin/application_settings_controller.rb
...p/controllers/ee/admin/application_settings_controller.rb
+15
-0
ee/config/routes/admin.rb
ee/config/routes/admin.rb
+5
-0
ee/spec/controllers/admin/application_settings_controller_spec.rb
...controllers/admin/application_settings_controller_spec.rb
+1
-1
ee/spec/routing/admin_routing_spec.rb
ee/spec/routing/admin_routing_spec.rb
+12
-0
spec/controllers/admin/application_settings_controller_spec.rb
...controllers/admin/application_settings_controller_spec.rb
+1
-1
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
a053ae57
...
@@ -6,9 +6,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
...
@@ -6,9 +6,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
before_action
:set_application_setting
before_action
:set_application_setting
before_action
:whitelist_query_limiting
,
only:
[
:usage_data
]
before_action
:whitelist_query_limiting
,
only:
[
:usage_data
]
VALID_SETTING_PANELS
=
%w(general integrations repository
templates
VALID_SETTING_PANELS
=
%w(general integrations repository
ci_cd reporting metrics_and_profiling
ci_cd reporting metrics_and_profiling
network
geo
preferences)
.
freeze
network preferences)
.
freeze
VALID_SETTING_PANELS
.
each
do
|
action
|
VALID_SETTING_PANELS
.
each
do
|
action
|
define_method
(
action
)
{
perform_update
if
submitted?
}
define_method
(
action
)
{
perform_update
if
submitted?
}
...
@@ -145,10 +145,15 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
...
@@ -145,10 +145,15 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
end
def
render_update_error
def
render_update_error
action
=
VALID_SETTING_PANELS
.
include?
(
action_name
)
?
action_name
:
:general
action
=
valid_setting_panels
.
include?
(
action_name
)
?
action_name
:
:general
render
action
render
action
end
end
# overridden in EE
def
valid_setting_panels
VALID_SETTING_PANELS
end
end
end
Admin
::
ApplicationSettingsController
.
prepend_if_ee
(
'EE::Admin::ApplicationSettingsController'
)
Admin
::
ApplicationSettingsController
.
prepend_if_ee
(
'EE::Admin::ApplicationSettingsController'
)
config/routes/admin.rb
View file @
a053ae57
...
@@ -114,7 +114,7 @@ namespace :admin do
...
@@ -114,7 +114,7 @@ namespace :admin do
put
:reset_registration_token
put
:reset_registration_token
put
:reset_health_check_token
put
:reset_health_check_token
put
:clear_repository_check_states
put
:clear_repository_check_states
match
:general
,
:integrations
,
:repository
,
:
templates
,
:ci_cd
,
:reporting
,
:metrics_and_profiling
,
:network
,
:geo
,
:preferences
,
via:
[
:get
,
:patch
]
match
:general
,
:integrations
,
:repository
,
:
ci_cd
,
:reporting
,
:metrics_and_profiling
,
:network
,
:preferences
,
via:
[
:get
,
:patch
]
get
:lets_encrypt_terms_of_service
get
:lets_encrypt_terms_of_service
end
end
...
...
ee/app/controllers/ee/admin/application_settings_controller.rb
View file @
a053ae57
...
@@ -3,6 +3,14 @@
...
@@ -3,6 +3,14 @@
module
EE
module
EE
module
Admin
module
Admin
module
ApplicationSettingsController
module
ApplicationSettingsController
extend
::
Gitlab
::
Utils
::
Override
EE_VALID_SETTING_PANELS
=
%w(geo templates)
.
freeze
EE_VALID_SETTING_PANELS
.
each
do
|
action
|
define_method
(
action
)
{
perform_update
if
submitted?
}
end
def
visible_application_setting_attributes
def
visible_application_setting_attributes
attrs
=
super
attrs
=
super
...
@@ -36,6 +44,13 @@ module EE
...
@@ -36,6 +44,13 @@ module EE
attrs
attrs
end
end
private
override
:valid_setting_panels
def
valid_setting_panels
super
+
EE_VALID_SETTING_PANELS
end
end
end
end
end
end
end
ee/config/routes/admin.rb
View file @
a053ae57
...
@@ -25,6 +25,11 @@ namespace :admin do
...
@@ -25,6 +25,11 @@ namespace :admin do
get
:download
,
on: :member
get
:download
,
on: :member
end
end
# using `only: []` to keep duplicate routes from being created
resource
:application_settings
,
only:
[]
do
match
:geo
,
:templates
,
via:
[
:get
,
:patch
]
end
namespace
:geo
do
namespace
:geo
do
get
'/'
=>
'nodes#index'
get
'/'
=>
'nodes#index'
...
...
ee/spec/controllers/admin/application_settings_controller_spec.rb
View file @
a053ae57
...
@@ -134,7 +134,7 @@ describe Admin::ApplicationSettingsController do
...
@@ -134,7 +134,7 @@ describe Admin::ApplicationSettingsController do
end
end
describe
'verify panel actions'
do
describe
'verify panel actions'
do
%w[templates geo]
.
each
do
|
valid_action
|
Admin
::
ApplicationSettingsController
::
EE_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
...
...
ee/spec/routing/admin_routing_spec.rb
View file @
a053ae57
...
@@ -59,4 +59,16 @@ describe 'EE-specific admin routing' do
...
@@ -59,4 +59,16 @@ describe 'EE-specific admin routing' do
expect
(
post
(
'/admin/email'
)).
to
route_to
(
'admin/emails#create'
)
expect
(
post
(
'/admin/email'
)).
to
route_to
(
'admin/emails#create'
)
end
end
end
end
describe
Admin
::
ApplicationSettingsController
,
'routing'
do
it
'routes to #geo'
do
expect
(
get
(
'/admin/application_settings/geo'
)).
to
route_to
(
'admin/application_settings#geo'
)
expect
(
patch
(
'/admin/application_settings/geo'
)).
to
route_to
(
'admin/application_settings#geo'
)
end
it
'routes to #templates'
do
expect
(
get
(
'/admin/application_settings/templates'
)).
to
route_to
(
'admin/application_settings#templates'
)
expect
(
patch
(
'/admin/application_settings/templates'
)).
to
route_to
(
'admin/application_settings#templates'
)
end
end
end
end
spec/controllers/admin/application_settings_controller_spec.rb
View file @
a053ae57
...
@@ -118,7 +118,7 @@ describe Admin::ApplicationSettingsController do
...
@@ -118,7 +118,7 @@ describe Admin::ApplicationSettingsController do
end
end
describe
'verify panel actions'
do
describe
'verify panel actions'
do
(
Admin
::
ApplicationSettingsController
::
VALID_SETTING_PANELS
-
%w(templates geo)
)
.
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment