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
cd46f7f9
Commit
cd46f7f9
authored
Jul 03, 2020
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change route and add comments
Change route from /d to /metrics. Also add comments linking to issue.
parent
8d19dd96
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
6 deletions
+15
-6
app/controllers/projects/environments_controller.rb
app/controllers/projects/environments_controller.rb
+4
-0
app/controllers/projects/metrics_dashboard_controller.rb
app/controllers/projects/metrics_dashboard_controller.rb
+5
-0
config/routes/project.rb
config/routes/project.rb
+1
-1
spec/requests/projects/metrics_dashboard_spec.rb
spec/requests/projects/metrics_dashboard_spec.rb
+5
-5
No files found.
app/controllers/projects/environments_controller.rb
View file @
cd46f7f9
# frozen_string_literal: true
# frozen_string_literal: true
class
Projects::EnvironmentsController
<
Projects
::
ApplicationController
class
Projects::EnvironmentsController
<
Projects
::
ApplicationController
# Metrics dashboard code is getting decoupled from environments and is being moved
# into app/controllers/projects/metrics_dashboard_controller.rb
# See https://gitlab.com/gitlab-org/gitlab/-/issues/226002 for more details.
include
MetricsDashboard
include
MetricsDashboard
layout
'project'
layout
'project'
...
...
app/controllers/projects/metrics_dashboard_controller.rb
View file @
cd46f7f9
# frozen_string_literal: true
# frozen_string_literal: true
module
Projects
module
Projects
class
MetricsDashboardController
<
Projects
::
ApplicationController
class
MetricsDashboardController
<
Projects
::
ApplicationController
# Metrics dashboard code is in the process of being decoupled from environments
# and is getting moved to this controller. Some code may be duplicated from
# app/controllers/projects/environments_controller.rb
# See https://gitlab.com/gitlab-org/gitlab/-/issues/226002 for more details.
before_action
:authorize_metrics_dashboard!
before_action
:authorize_metrics_dashboard!
before_action
do
before_action
do
push_frontend_feature_flag
(
:prometheus_computed_alerts
)
push_frontend_feature_flag
(
:prometheus_computed_alerts
)
...
...
config/routes/project.rb
View file @
cd46f7f9
...
@@ -25,7 +25,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
...
@@ -25,7 +25,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# Use this scope for all new project routes.
# Use this scope for all new project routes.
scope
'-'
do
scope
'-'
do
get
'archive/*id'
,
constraints:
{
format:
Gitlab
::
PathRegex
.
archive_formats_regex
,
id:
/.+?/
},
to:
'repositories#archive'
,
as:
'archive'
get
'archive/*id'
,
constraints:
{
format:
Gitlab
::
PathRegex
.
archive_formats_regex
,
id:
/.+?/
},
to:
'repositories#archive'
,
as:
'archive'
get
'
d
(/:dashboard_path)'
,
constraints:
{
dashboard_path:
/.+\.yml/
},
get
'
metrics
(/:dashboard_path)'
,
constraints:
{
dashboard_path:
/.+\.yml/
},
to:
'metrics_dashboard#show'
,
as: :metrics_dashboard
,
format:
false
to:
'metrics_dashboard#show'
,
as: :metrics_dashboard
,
format:
false
resources
:artifacts
,
only:
[
:index
,
:destroy
]
resources
:artifacts
,
only:
[
:index
,
:destroy
]
...
...
spec/requests/projects/metrics_dashboard_spec.rb
View file @
cd46f7f9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
require
'spec_helper'
require
'spec_helper'
describe
'metrics dashboard page'
do
RSpec
.
describe
'metrics dashboard page'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let_it_be
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let_it_be
(
:environment2
)
{
create
(
:environment
,
project:
project
)
}
let_it_be
(
:environment2
)
{
create
(
:environment
,
project:
project
)
}
...
@@ -13,7 +13,7 @@ describe 'metrics dashboard page' do
...
@@ -13,7 +13,7 @@ describe 'metrics dashboard page' do
login_as
(
user
)
login_as
(
user
)
end
end
describe
'GET /:namespace/:project/-/
d
'
do
describe
'GET /:namespace/:project/-/
metrics
'
do
it
'returns 200'
do
it
'returns 200'
do
send_request
send_request
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
@@ -25,7 +25,7 @@ describe 'metrics dashboard page' do
...
@@ -25,7 +25,7 @@ describe 'metrics dashboard page' do
end
end
end
end
describe
'GET /:namespace/:project/-/
d
?environment=:environment.id'
do
describe
'GET /:namespace/:project/-/
metrics
?environment=:environment.id'
do
it
'returns 200'
do
it
'returns 200'
do
send_request
(
environment:
environment2
.
id
)
send_request
(
environment:
environment2
.
id
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
@@ -44,7 +44,7 @@ describe 'metrics dashboard page' do
...
@@ -44,7 +44,7 @@ describe 'metrics dashboard page' do
end
end
end
end
describe
'GET /:namespace/:project/-/
d
/:dashboard_path'
do
describe
'GET /:namespace/:project/-/
metrics
/:dashboard_path'
do
let
(
:dashboard_path
)
{
'.gitlab/dashboards/dashboard_path.yml'
}
let
(
:dashboard_path
)
{
'.gitlab/dashboards/dashboard_path.yml'
}
it
'returns 200'
do
it
'returns 200'
do
...
@@ -58,7 +58,7 @@ describe 'metrics dashboard page' do
...
@@ -58,7 +58,7 @@ describe 'metrics dashboard page' do
end
end
end
end
describe
'GET :/namespace/:project/-/
d
/:dashboard_path?environment=:environment.id'
do
describe
'GET :/namespace/:project/-/
metrics
/:dashboard_path?environment=:environment.id'
do
let
(
:dashboard_path
)
{
'.gitlab/dashboards/dashboard_path.yml'
}
let
(
:dashboard_path
)
{
'.gitlab/dashboards/dashboard_path.yml'
}
it
'returns 200'
do
it
'returns 200'
do
...
...
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