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
9129adb3
Commit
9129adb3
authored
Jul 07, 2021
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix default url for Monitor sidebar menu
Changelog: fixed
parent
6eb99551
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
45 deletions
+13
-45
ee/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
ee/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
+0
-31
lib/sidebars/projects/menus/monitor_menu.rb
lib/sidebars/projects/menus/monitor_menu.rb
+1
-5
spec/lib/sidebars/projects/menus/monitor_menu_spec.rb
spec/lib/sidebars/projects/menus/monitor_menu_spec.rb
+12
-9
No files found.
ee/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
View file @
9129adb3
...
...
@@ -123,37 +123,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
describe
'Monitor main link'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
project
.
project_feature
.
update!
(
builds_access_level:
feature
)
project
.
team
.
add_developer
(
user
)
sign_in
(
user
)
end
context
'when ci/cd is disabled'
do
let
(
:feature
)
{
ProjectFeature
::
DISABLED
}
it
'links to feature flags page'
do
render
expect
(
rendered
).
to
have_link
(
'Monitor'
,
href:
project_feature_flags_path
(
project
))
end
end
context
'when ci/cd is enabled'
do
let
(
:feature
)
{
ProjectFeature
::
ENABLED
}
it
'links to metrics page'
do
render
expect
(
rendered
).
to
have_link
(
'Monitor'
,
href:
metrics_project_environments_path
(
project
))
end
end
end
describe
'Security and Compliance'
do
context
'when user does not have permissions'
do
before
do
...
...
lib/sidebars/projects/menus/monitor_menu.rb
View file @
9129adb3
...
...
@@ -21,11 +21,7 @@ module Sidebars
override
:link
def
link
if
can?
(
context
.
current_user
,
:read_environment
,
context
.
project
)
metrics_project_environments_path
(
context
.
project
)
else
project_feature_flags_path
(
context
.
project
)
end
renderable_items
.
first
&
.
link
end
override
:extra_container_html_options
...
...
spec/lib/sidebars/projects/menus/monitor_menu_spec.rb
View file @
9129adb3
...
...
@@ -50,18 +50,21 @@ RSpec.describe Sidebars::Projects::Menus::MonitorMenu do
end
describe
'#link'
do
context
'when metrics dashboard is visible'
do
it
'returns link to the metrics dashboard page'
do
expect
(
subject
.
link
).
to
include
(
'/-/environments/metrics'
)
end
let
(
:foo_path
)
{
'/foo_path'
}
let
(
:foo_menu
)
do
::
Sidebars
::
MenuItem
.
new
(
title:
'foo'
,
link:
foo_path
,
active_routes:
{},
item_id: :foo
)
end
context
'when metrics dashboard is not visible'
do
it
'returns link to the feature flags page'
do
project
.
project_feature
.
update!
(
operations_access_level:
Featurable
::
DISABLED
)
it
'returns first visible item link'
do
subject
.
insert_element_before
(
subject
.
renderable_items
,
subject
.
renderable_items
.
first
.
item_id
,
foo_menu
)
expect
(
subject
.
link
).
to
include
(
'/-/feature_flags'
)
end
expect
(
subject
.
link
).
to
eq
foo_path
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