Commit 5831cc16 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '322687-fj-change-group-overview-menu' into 'master'

Perform changes to Group Overview menu

See merge request gitlab-org/gitlab!60845
parents a3614c36 03e6e3dd
...@@ -38,6 +38,14 @@ module GroupsHelper ...@@ -38,6 +38,14 @@ module GroupsHelper
] ]
end end
def group_information_title(group)
if Feature.enabled?(:sidebar_refactor, current_user)
group.subgroup? ? _('Subgroup information') : _('Group information')
else
group.subgroup? ? _('Subgroup overview') : _('Group overview')
end
end
def group_container_registry_nav? def group_container_registry_nav?
Gitlab.config.registry.enabled && Gitlab.config.registry.enabled &&
can?(current_user, :read_container_image, @group) can?(current_user, :read_container_image, @group)
......
- issues_count = cached_issuables_count(@group, type: :issues) - issues_count = cached_issuables_count(@group, type: :issues)
- merge_requests_count = group_open_merge_requests_count(@group) - merge_requests_count = group_open_merge_requests_count(@group)
- aside_title = @group.subgroup? ? _('Subgroup navigation') : _('Group navigation') - aside_title = @group.subgroup? ? _('Subgroup navigation') : _('Group navigation')
- overview_title = @group.subgroup? ? _('Subgroup overview') : _('Group overview')
%aside.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), **sidebar_tracking_attributes_by_object(@group), 'aria-label': aside_title } %aside.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), **sidebar_tracking_attributes_by_object(@group), 'aria-label': aside_title }
.nav-sidebar-inner-scroll .nav-sidebar-inner-scroll
...@@ -19,21 +18,23 @@ ...@@ -19,21 +18,23 @@
= nav_link(path: paths, unless: -> { current_path?('groups/contribution_analytics#show') }, html_options: { class: 'home' }) do = nav_link(path: paths, unless: -> { current_path?('groups/contribution_analytics#show') }, html_options: { class: 'home' }) do
= link_to group_path(@group) do = link_to group_path(@group) do
.nav-icon-container .nav-icon-container
= sprite_icon('home') - sprite = Feature.enabled?(:sidebar_refactor, current_user) ? 'group' : 'home'
= sprite_icon(sprite)
%span.nav-item-name %span.nav-item-name
= overview_title = group_information_title(@group)
%ul.sidebar-sub-level-items %ul.sidebar-sub-level-items
= nav_link(path: ['groups#show', 'groups#details', 'groups#activity', 'groups#subgroups'], html_options: { class: "fly-out-top-item" } ) do = nav_link(path: ['groups#show', 'groups#details', 'groups#activity', 'groups#subgroups'], html_options: { class: "fly-out-top-item" } ) do
= link_to group_path(@group) do = link_to group_path(@group) do
%strong.fly-out-top-item-name %strong.fly-out-top-item-name
= overview_title = group_information_title(@group)
%li.divider.fly-out-top-item %li.divider.fly-out-top-item
= nav_link(path: ['groups#show', 'groups#details', 'groups#subgroups'], html_options: { class: 'home' }) do - if Feature.disabled?(:sidebar_refactor, current_user)
= link_to details_group_path(@group), title: _('Group details') do = nav_link(path: ['groups#show', 'groups#details', 'groups#subgroups'], html_options: { class: 'home' }) do
%span = link_to details_group_path(@group), title: _('Group details') do
= _('Details') %span
= _('Details')
- if group_sidebar_link?(:activity) - if group_sidebar_link?(:activity)
= nav_link(path: 'groups#activity') do = nav_link(path: 'groups#activity') do
......
...@@ -109,7 +109,7 @@ RSpec.describe GroupsController do ...@@ -109,7 +109,7 @@ RSpec.describe GroupsController do
end end
end end
describe '"group overview content" preference behaviour' do describe '"group information content" preference behaviour' do
describe 'GET #show' do describe 'GET #show' do
subject { get :show, params: { id: group.to_param }, format: format } subject { get :show, params: { id: group.to_param }, format: format }
......
...@@ -128,7 +128,7 @@ RSpec.describe 'CI shared runner limits' do ...@@ -128,7 +128,7 @@ RSpec.describe 'CI shared runner limits' do
allow_any_instance_of(EE::Namespace).to receive(:shared_runners_seconds).and_return(minutes_used.minutes) allow_any_instance_of(EE::Namespace).to receive(:shared_runners_seconds).and_return(minutes_used.minutes)
end end
it 'displays a warning message on group overview page' do it 'displays a warning message on group information page' do
visit group_path(group) visit group_path(group)
expect_quota_exceeded_alert(message) expect_quota_exceeded_alert(message)
...@@ -143,7 +143,7 @@ RSpec.describe 'CI shared runner limits' do ...@@ -143,7 +143,7 @@ RSpec.describe 'CI shared runner limits' do
"Unless you buy additional pipeline minutes, no new jobs or pipelines in its projects will run." "Unless you buy additional pipeline minutes, no new jobs or pipelines in its projects will run."
end end
it 'displays a warning message on group overview page' do it 'displays a warning message on group information page' do
visit group_path(group) visit group_path(group)
expect_quota_exceeded_alert(message) expect_quota_exceeded_alert(message)
...@@ -153,7 +153,7 @@ RSpec.describe 'CI shared runner limits' do ...@@ -153,7 +153,7 @@ RSpec.describe 'CI shared runner limits' do
context 'when limit not yet exceeded' do context 'when limit not yet exceeded' do
let(:group) { create(:group, :with_not_used_build_minutes_limit) } let(:group) { create(:group, :with_not_used_build_minutes_limit) }
it 'does not display a warning message on group overview page' do it 'does not display a warning message on group information page' do
visit group_path(group) visit group_path(group)
expect_no_quota_exceeded_alert expect_no_quota_exceeded_alert
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Group overview', :js, :aggregate_failures do RSpec.describe 'Group information', :js, :aggregate_failures do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:empty_project) { create(:project, namespace: group) } let(:empty_project) { create(:project, namespace: group) }
...@@ -14,7 +14,7 @@ RSpec.describe 'Group overview', :js, :aggregate_failures do ...@@ -14,7 +14,7 @@ RSpec.describe 'Group overview', :js, :aggregate_failures do
sign_in(user) sign_in(user)
end end
context 'when the default value of "Group Overview content" preference is used' do context 'when the default value of "Group information content" preference is used' do
it 'displays the Details view' do it 'displays the Details view' do
visit_page visit_page
......
...@@ -85,7 +85,7 @@ RSpec.describe 'Group navbar' do ...@@ -85,7 +85,7 @@ RSpec.describe 'Group navbar' do
stub_feature_flags(epic_boards: false) stub_feature_flags(epic_boards: false)
insert_after_nav_item( insert_after_nav_item(
_('Group overview'), _('Group information'),
new_nav_item: { new_nav_item: {
nav_item: _('Epics'), nav_item: _('Epics'),
nav_sub_items: [ nav_sub_items: [
...@@ -106,7 +106,7 @@ RSpec.describe 'Group navbar' do ...@@ -106,7 +106,7 @@ RSpec.describe 'Group navbar' do
stub_licensed_features(epics: true) stub_licensed_features(epics: true)
insert_after_nav_item( insert_after_nav_item(
_('Group overview'), _('Group information'),
new_nav_item: { new_nav_item: {
nav_item: _('Epics'), nav_item: _('Epics'),
nav_sub_items: [ nav_sub_items: [
......
...@@ -15477,6 +15477,9 @@ msgstr "" ...@@ -15477,6 +15477,9 @@ msgstr ""
msgid "Group info:" msgid "Group info:"
msgstr "" msgstr ""
msgid "Group information"
msgstr ""
msgid "Group is required when cluster_type is :group" msgid "Group is required when cluster_type is :group"
msgstr "" msgstr ""
...@@ -30725,6 +30728,9 @@ msgstr "" ...@@ -30725,6 +30728,9 @@ msgstr ""
msgid "StorageSize|Unknown" msgid "StorageSize|Unknown"
msgstr "" msgstr ""
msgid "Subgroup information"
msgstr ""
msgid "Subgroup milestone" msgid "Subgroup milestone"
msgstr "" msgstr ""
......
...@@ -15,8 +15,7 @@ RSpec.describe 'The group page' do ...@@ -15,8 +15,7 @@ RSpec.describe 'The group page' do
def expect_all_sidebar_links def expect_all_sidebar_links
within('.nav-sidebar') do within('.nav-sidebar') do
expect(page).to have_link('Group overview') expect(page).to have_link('Group information')
expect(page).to have_link('Details')
expect(page).to have_link('Activity') expect(page).to have_link('Activity')
expect(page).to have_link('Issues') expect(page).to have_link('Issues')
expect(page).to have_link('Merge requests') expect(page).to have_link('Merge requests')
...@@ -44,8 +43,7 @@ RSpec.describe 'The group page' do ...@@ -44,8 +43,7 @@ RSpec.describe 'The group page' do
visit group_path(group) visit group_path(group)
within('.nav-sidebar') do within('.nav-sidebar') do
expect(page).to have_link('Group overview') expect(page).to have_link('Group information')
expect(page).to have_link('Details')
expect(page).not_to have_link('Activity') expect(page).not_to have_link('Activity')
expect(page).not_to have_link('Contribution') expect(page).not_to have_link('Contribution')
......
...@@ -14,9 +14,8 @@ RSpec.describe 'Group navbar' do ...@@ -14,9 +14,8 @@ RSpec.describe 'Group navbar' do
let(:structure) do let(:structure) do
[ [
{ {
nav_item: _('Group overview'), nav_item: _('Group information'),
nav_sub_items: [ nav_sub_items: [
_('Details'),
_('Activity') _('Activity')
] ]
}, },
......
...@@ -368,14 +368,14 @@ RSpec.describe 'Group' do ...@@ -368,14 +368,14 @@ RSpec.describe 'Group' do
expect(page).to have_content(nested_group.name) expect(page).to have_content(nested_group.name)
expect(page).to have_content(project.name) expect(page).to have_content(project.name)
expect(page).to have_link('Group overview') expect(page).to have_link('Group information')
end end
it 'renders subgroup page with the text "Subgroup overview"' do it 'renders subgroup page with the text "Subgroup information"' do
visit group_path(nested_group) visit group_path(nested_group)
wait_for_requests wait_for_requests
expect(page).to have_link('Subgroup overview') expect(page).to have_link('Subgroup information')
end end
it 'renders project page with the text "Project overview"' do it 'renders project page with the text "Project overview"' do
......
...@@ -170,15 +170,18 @@ RSpec.shared_context 'group navbar structure' do ...@@ -170,15 +170,18 @@ RSpec.shared_context 'group navbar structure' do
} }
end end
let(:group_information_nav_item) do
{
nav_item: _('Group information'),
nav_sub_items: [
_('Activity')
]
}
end
let(:structure) do let(:structure) do
[ [
{ group_information_nav_item,
nav_item: _('Group overview'),
nav_sub_items: [
_('Details'),
_('Activity')
]
},
{ {
nav_item: _('Issues'), nav_item: _('Issues'),
nav_sub_items: [ nav_sub_items: [
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'layouts/nav/sidebar/_group' do RSpec.describe 'layouts/nav/sidebar/_group' do
let(:group) { create(:group) } let_it_be(:group) { create(:group) }
before do before do
assign(:group, group) assign(:group, group)
...@@ -11,4 +11,36 @@ RSpec.describe 'layouts/nav/sidebar/_group' do ...@@ -11,4 +11,36 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
it_behaves_like 'has nav sidebar' it_behaves_like 'has nav sidebar'
it_behaves_like 'sidebar includes snowplow attributes', 'render', 'groups_side_navigation', 'groups_side_navigation' it_behaves_like 'sidebar includes snowplow attributes', 'render', 'groups_side_navigation', 'groups_side_navigation'
describe 'Group information' do
it 'has a link to the group path' do
render
expect(rendered).to have_link('Group information', href: group_path(group))
end
it 'does not have a link to the details menu item' do
render
expect(rendered).not_to have_link('Details', href: details_group_path(group))
end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it 'has a link to the group path with the "Group overview" title' do
render
expect(rendered).to have_link('Group overview', href: group_path(group))
end
it 'has a link to the details menu item' do
render
expect(rendered).to have_link('Details', href: details_group_path(group))
end
end
end
end end
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