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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
1edbf97e
Commit
1edbf97e
authored
Apr 17, 2019
by
syasonik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to reduce complexity again
parent
ed87159a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
app/controllers/projects/environments_controller.rb
app/controllers/projects/environments_controller.rb
+4
-10
No files found.
app/controllers/projects/environments_controller.rb
View file @
1edbf97e
...
...
@@ -158,22 +158,16 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end
def
metrics_dashboard
render_403
&&
return
unless
Feature
.
enabled?
(
:environment_metrics_use_prometheus_endpoint
,
project
)
render_403
&&
return
unless
Feature
.
enabled?
(
:environment_metrics_use_prometheus_endpoint
,
@
project
)
respond_to
do
|
format
|
format
.
json
do
result
=
Gitlab
::
MetricsDashboard
::
Service
.
new
(
@project
,
@current_user
,
environment:
environment
).
get_dashboard
if
result
[
:status
]
==
:success
status_code
=
:ok
details
=
{
dashboard:
result
[
:dashboard
]
}
else
status_code
=
result
[
:http_status
]
||
:bad_request
details
=
{
message:
result
[
:message
]
}
end
ok_status
=
:ok
if
result
[
:status
]
==
:success
status
=
ok_status
||
result
[
:http_status
]
||
:bad_request
render
status:
status_code
,
json:
{
status:
result
[
:status
]
}.
merge
(
details
)
render
status:
status
,
json:
result
end
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