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
28c8c231
Commit
28c8c231
authored
Jan 13, 2020
by
rpereira2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Codeclimate complaints
parent
a1b6ed24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+24
-24
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
28c8c231
...
...
@@ -5,6 +5,12 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
before_action
:set_application_setting
before_action
:whitelist_query_limiting
,
only:
[
:usage_data
]
before_action
:validate_self_monitoring_feature_flag_enabled
,
only:
[
:create_self_monitoring_project
,
:status_create_self_monitoring_project
,
:delete_self_monitoring_project
,
:status_delete_self_monitoring_project
]
before_action
do
push_frontend_feature_flag
(
:self_monitoring_project
)
...
...
@@ -74,8 +80,6 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
def
create_self_monitoring_project
return
self_monitoring_project_not_implemented
unless
Feature
.
enabled?
(
:self_monitoring_project
)
job_id
=
SelfMonitoringProjectCreateWorker
.
perform_async
render
status: :accepted
,
json:
{
...
...
@@ -85,8 +89,6 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
def
status_create_self_monitoring_project
return
self_monitoring_project_not_implemented
unless
Feature
.
enabled?
(
:self_monitoring_project
)
job_id
=
params
[
:job_id
].
to_s
unless
job_id
.
length
<=
PARAM_JOB_ID_MAX_SIZE
...
...
@@ -97,26 +99,23 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
if
Gitlab
::
CurrentSettings
.
instance_administration_project_id
.
present?
render
status: :ok
,
json:
self_monitoring_data
re
turn
re
nder
status: :ok
,
json:
self_monitoring_data
elsif
SelfMonitoringProjectCreateWorker
.
in_progress?
(
job_id
)
::
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
3_000
)
render
status: :accepted
,
json:
{
re
turn
re
nder
status: :accepted
,
json:
{
message:
_
(
'Job to create self-monitoring project is in progress'
)
}
else
render
status: :bad_request
,
json:
{
message:
_
(
'Self-monitoring project does not exist. Please check logs '
\
'for any error messages'
)
}
end
render
status: :bad_request
,
json:
{
message:
_
(
'Self-monitoring project does not exist. Please check logs '
\
'for any error messages'
)
}
end
def
delete_self_monitoring_project
return
self_monitoring_project_not_implemented
unless
Feature
.
enabled?
(
:self_monitoring_project
)
job_id
=
SelfMonitoringProjectDeleteWorker
.
perform_async
render
status: :accepted
,
json:
{
...
...
@@ -126,8 +125,6 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
def
status_delete_self_monitoring_project
return
self_monitoring_project_not_implemented
unless
Feature
.
enabled?
(
:self_monitoring_project
)
job_id
=
params
[
:job_id
].
to_s
unless
job_id
.
length
<=
PARAM_JOB_ID_MAX_SIZE
...
...
@@ -138,27 +135,30 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
if
Gitlab
::
CurrentSettings
.
instance_administration_project_id
.
nil?
render
status: :ok
,
json:
{
re
turn
re
nder
status: :ok
,
json:
{
message:
_
(
'Self-monitoring project has been successfully deleted'
)
}
elsif
SelfMonitoringProjectDeleteWorker
.
in_progress?
(
job_id
)
::
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
3_000
)
render
status: :accepted
,
json:
{
re
turn
re
nder
status: :accepted
,
json:
{
message:
_
(
'Job to delete self-monitoring project is in progress'
)
}
else
render
status: :bad_request
,
json:
{
message:
_
(
'Self-monitoring project was not deleted. Please check logs '
\
'for any error messages'
)
}
end
render
status: :bad_request
,
json:
{
message:
_
(
'Self-monitoring project was not deleted. Please check logs '
\
'for any error messages'
)
}
end
private
def
validate_self_monitoring_feature_flag_enabled
self_monitoring_project_not_implemented
unless
Feature
.
enabled?
(
:self_monitoring_project
)
end
def
self_monitoring_data
{
project_id:
Gitlab
::
CurrentSettings
.
instance_administration_project_id
,
...
...
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