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
c290eca1
Commit
c290eca1
authored
Jul 16, 2019
by
Sarah Yasonik
Committed by
Stan Hu
Jul 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor EnvironmentsController#metrics_dashboard endpoint
parent
be7290a9
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
137 additions
and
78 deletions
+137
-78
app/controllers/projects/environments_controller.rb
app/controllers/projects/environments_controller.rb
+9
-7
spec/controllers/projects/environments_controller_spec.rb
spec/controllers/projects/environments_controller_spec.rb
+128
-71
No files found.
app/controllers/projects/environments_controller.rb
View file @
c290eca1
...
...
@@ -160,20 +160,22 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end
def
metrics_dashboard
return
render_403
unless
Feature
.
enabled?
(
:environment_metrics_use_prometheus_endpoint
,
project
)
if
Feature
.
enabled?
(
:environment_metrics_show_multiple_dashboards
,
project
)
if
Feature
.
enabled?
(
:gfm_embedded_metrics
,
project
)
&&
params
[
:embedded
]
result
=
dashboard_finder
.
find
(
project
,
current_user
,
environment
,
dashboard_path:
params
[
:dashboard
],
embedded:
params
[
:embedded
]
)
elsif
Feature
.
enabled?
(
:environment_metrics_show_multiple_dashboards
,
project
)
result
=
dashboard_finder
.
find
(
project
,
current_user
,
environment
,
dashboard_path:
params
[
:dashboard
]
)
unless
params
[
:embedded
]
result
[
:all_dashboards
]
=
dashboard_finder
.
find_all_paths
(
project
)
end
result
[
:all_dashboards
]
=
dashboard_finder
.
find_all_paths
(
project
)
else
result
=
dashboard_finder
.
find
(
project
,
current_user
,
environment
)
end
...
...
spec/controllers/projects/environments_controller_spec.rb
View file @
c290eca1
This diff is collapsed.
Click to expand it.
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