Commit 83b69787 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'mw-move-vsa-menu-item-to-top' into 'master'

Move Value stream to top-level in analytics section of left sidebar nav

See merge request gitlab-org/gitlab!74686
parents faac2d38 14c1e9e9
......@@ -11,13 +11,13 @@ module EE
def configure_menu_items
return false unless can?(context.current_user, :read_analytics, context.project)
add_item(cycle_analytics_menu_item)
add_item(ci_cd_analytics_menu_item)
add_item(code_review_analytics_menu_item)
add_item(insights_menu_item)
add_item(issues_analytics_menu_item)
add_item(merge_request_analytics_menu_item)
add_item(repository_analytics_menu_item)
add_item(cycle_analytics_menu_item)
true
end
......
......@@ -8,6 +8,7 @@ module Sidebars
override :configure_menu_items
def configure_menu_items
add_item(cycle_analytics_menu_item)
add_item(ci_cd_analytics_menu_item)
add_item(contribution_analytics_menu_item)
add_item(devops_adoption_menu_item)
......@@ -16,7 +17,6 @@ module Sidebars
add_item(merge_request_analytics_menu_item)
add_item(productivity_analytics_menu_item)
add_item(repository_analytics_menu_item)
add_item(cycle_analytics_menu_item)
true
end
......
......@@ -58,7 +58,7 @@ RSpec.describe 'Group navbar' do
before do
stub_licensed_features(cycle_analytics_for_groups: true)
insert_after_sub_nav_item(
insert_before_sub_nav_item(
_('Contribution'),
within: _('Analytics'),
new_sub_nav_item_name: _('Value stream')
......
......@@ -24,6 +24,10 @@ RSpec.describe Sidebars::Groups::Menus::AnalyticsMenu do
end
context 'when Value Stream is not visible' do
before do
stub_licensed_features(cycle_analytics_for_groups: false, group_ci_cd_analytics: true)
end
it 'returns link to the the first visible menu item' do
allow(menu).to receive(:cycle_analytics_menu_item).and_return(double(render?: false))
......
......@@ -10,9 +10,9 @@ module Sidebars
def configure_menu_items
return false unless can?(context.current_user, :read_analytics, context.project)
add_item(cycle_analytics_menu_item)
add_item(ci_cd_analytics_menu_item)
add_item(repository_analytics_menu_item)
add_item(cycle_analytics_menu_item)
true
end
......
......@@ -19,6 +19,17 @@ module NavbarStructureHelper
hash[:nav_sub_items].insert(index + 1, new_sub_nav_item_name)
end
def insert_before_sub_nav_item(after_sub_nav_item_name, within:, new_sub_nav_item_name:)
expect(structure).to include(a_hash_including(nav_item: within))
hash = structure.find { |h| h[:nav_item] == within if h }
expect(hash).to have_key(:nav_sub_items)
expect(hash[:nav_sub_items]).to include(after_sub_nav_item_name)
index = hash[:nav_sub_items].find_index(after_sub_nav_item_name)
hash[:nav_sub_items].insert(index, new_sub_nav_item_name)
end
def insert_package_nav(within)
insert_after_nav_item(
within,
......
......@@ -94,11 +94,11 @@ RSpec.shared_context 'project navbar structure' do
{
nav_item: _('Analytics'),
nav_sub_items: [
_('Value stream'),
_('CI/CD'),
(_('Code review') if Gitlab.ee?),
(_('Merge request') if Gitlab.ee?),
_('Repository'),
_('Value stream')
_('Repository')
]
},
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment