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
8d19dd96
Commit
8d19dd96
authored
Jun 25, 2020
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change action name and fix code styling
Change action name to show and fix a few code style issues.
parent
f786c359
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
28 deletions
+24
-28
app/controllers/projects/metrics_dashboard_controller.rb
app/controllers/projects/metrics_dashboard_controller.rb
+20
-24
config/routes/project.rb
config/routes/project.rb
+1
-1
spec/requests/projects/metrics_dashboard_spec.rb
spec/requests/projects/metrics_dashboard_spec.rb
+3
-3
No files found.
app/controllers/projects/metrics_dashboard_controller.rb
View file @
8d19dd96
# frozen_string_literal: true
class
Projects::MetricsDashboardController
<
Projects
::
ApplicationController
before_action
:metrics_dashboard_page
do
authorize_metrics_dashboard!
push_frontend_feature_flag
(
:prometheus_computed_alerts
)
end
def
metrics_dashboard_page
if
environment
render
'projects/environments/metrics'
else
render_404
module
Projects
class
MetricsDashboardController
<
Projects
::
ApplicationController
before_action
:authorize_metrics_dashboard!
before_action
do
push_frontend_feature_flag
(
:prometheus_computed_alerts
)
end
end
private
def
environment
@environment
||=
if
metrics_dashboard_page_params
[
:environment
]
project
.
environments
.
find
(
metrics_dashboard_page_params
[
:environment
])
def
show
if
environment
render
'projects/environments/metrics'
else
project
.
default_environment
render_404
end
end
end
def
metrics_dashboard_page_params
params
.
permit
(
:environment
)
private
def
environment
@environment
||=
if
params
[
:environment
]
project
.
environments
.
find
(
params
[
:environment
])
else
project
.
default_environment
end
end
end
end
config/routes/project.rb
View file @
8d19dd96
...
...
@@ -26,7 +26,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
scope
'-'
do
get
'archive/*id'
,
constraints:
{
format:
Gitlab
::
PathRegex
.
archive_formats_regex
,
id:
/.+?/
},
to:
'repositories#archive'
,
as:
'archive'
get
'd(/:dashboard_path)'
,
constraints:
{
dashboard_path:
/.+\.yml/
},
to:
'metrics_dashboard#
metrics_dashboard_page'
,
as: :metrics_dashboard_page
,
format:
false
to:
'metrics_dashboard#
show'
,
as: :metrics_dashboard
,
format:
false
resources
:artifacts
,
only:
[
:index
,
:destroy
]
...
...
spec/requests/projects/metrics_dashboard_spec.rb
View file @
8d19dd96
...
...
@@ -44,7 +44,7 @@ describe 'metrics dashboard page' do
end
end
describe
'GET /:namespace/:project/-d/:dashboard_path'
do
describe
'GET /:namespace/:project/-
/
d/:dashboard_path'
do
let
(
:dashboard_path
)
{
'.gitlab/dashboards/dashboard_path.yml'
}
it
'returns 200'
do
...
...
@@ -58,7 +58,7 @@ describe 'metrics dashboard page' do
end
end
describe
'GET :/namespace/:project/-d/:dashboard_path?environment=:environment.id'
do
describe
'GET :/namespace/:project/-
/
d/:dashboard_path?environment=:environment.id'
do
let
(
:dashboard_path
)
{
'.gitlab/dashboards/dashboard_path.yml'
}
it
'returns 200'
do
...
...
@@ -80,6 +80,6 @@ describe 'metrics dashboard page' do
end
def
send_request
(
params
=
{})
get
namespace_project_metrics_dashboard_pa
ge_pa
th
(
namespace_id:
project
.
namespace
,
project_id:
project
,
**
params
)
get
namespace_project_metrics_dashboard_path
(
namespace_id:
project
.
namespace
,
project_id:
project
,
**
params
)
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