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
9b7e934c
Commit
9b7e934c
authored
Jun 17, 2020
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow dashboard paths in route
parent
f2019576
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
assets-hash.txt
assets-hash.txt
+0
-1
config/routes/project.rb
config/routes/project.rb
+2
-1
spec/requests/projects/metrics_dashboard_spec.rb
spec/requests/projects/metrics_dashboard_spec.rb
+5
-5
No files found.
assets-hash.txt
deleted
100644 → 0
View file @
f2019576
c4a8f7e42201fe775340d0ace9316657
\ No newline at end of file
config/routes/project.rb
View file @
9b7e934c
...
@@ -25,7 +25,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
...
@@ -25,7 +25,8 @@ 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'
,
to:
'metrics_dashboard#metrics_dashboard_page'
,
as: :metrics_dashboard_page
get
'd(/:dashboard_path)'
,
constraints:
{
dashboard_path:
/.+\.yml/
},
to:
'metrics_dashboard#metrics_dashboard_page'
,
as: :metrics_dashboard_page
,
format:
false
resources
:artifacts
,
only:
[
:index
,
:destroy
]
resources
:artifacts
,
only:
[
:index
,
:destroy
]
...
...
spec/requests/projects/metrics_dashboard_spec.rb
View file @
9b7e934c
...
@@ -49,12 +49,12 @@ describe 'metrics dashboard page' do
...
@@ -49,12 +49,12 @@ describe 'metrics dashboard page' 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
send_request
(
dashboard:
dashboard_path
)
send_request
(
dashboard
_path
:
dashboard_path
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'assigns environment0'
do
it
'assigns environment0'
do
send_request
(
dashboard:
dashboard_path
)
send_request
(
dashboard
_path
:
dashboard_path
)
expect
(
assigns
(
:environment
).
id
).
to
eq
(
environment
.
id
)
expect
(
assigns
(
:environment
).
id
).
to
eq
(
environment
.
id
)
end
end
end
end
...
@@ -63,18 +63,18 @@ describe 'metrics dashboard page' do
...
@@ -63,18 +63,18 @@ describe 'metrics dashboard page' 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
send_request
(
dahboard:
dashboard_path
,
environment:
environment
.
id
)
send_request
(
dahboard
_path
:
dashboard_path
,
environment:
environment
.
id
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'assigns query param environment'
do
it
'assigns query param environment'
do
send_request
(
dashboard:
dashboard_path
,
environment:
environment2
.
id
)
send_request
(
dashboard
_path
:
dashboard_path
,
environment:
environment2
.
id
)
expect
(
assigns
(
:environment
).
id
).
to
eq
(
environment2
.
id
)
expect
(
assigns
(
:environment
).
id
).
to
eq
(
environment2
.
id
)
end
end
context
'when query param environment does not exist'
do
context
'when query param environment does not exist'
do
it
'responds with 404'
do
it
'responds with 404'
do
send_request
(
dashboard:
dashboard_path
,
environment:
99
)
send_request
(
dashboard
_path
:
dashboard_path
,
environment:
99
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
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