Commit 004baec9 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '322687-fj-change-project-overview-details' into 'master'

Perform changes to Project Overview menu

See merge request gitlab-org/gitlab!60840
parents 2e6d3d9c 9e328c6d
...@@ -116,6 +116,16 @@ RSpec.describe 'Project navbar' do ...@@ -116,6 +116,16 @@ RSpec.describe 'Project navbar' do
] ]
end end
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Releases')
]
}
end
before do before do
stub_feature_flags(sidebar_refactor: true) stub_feature_flags(sidebar_refactor: true)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Sidebars module Sidebars
module Projects module Projects
module Menus module Menus
class ProjectOverviewMenu < ::Sidebars::Menu class ProjectInformationMenu < ::Sidebars::Menu
override :configure_menu_items override :configure_menu_items
def configure_menu_items def configure_menu_items
add_item(details_menu_item) add_item(details_menu_item)
...@@ -32,17 +32,34 @@ module Sidebars ...@@ -32,17 +32,34 @@ module Sidebars
override :title override :title
def title def title
_('Project overview') if Feature.enabled?(:sidebar_refactor, context.current_user)
_('Project information')
else
_('Project overview')
end
end end
override :sprite_icon override :sprite_icon
def sprite_icon def sprite_icon
'home' if Feature.enabled?(:sidebar_refactor, context.current_user)
'project'
else
'home'
end
end
override :active_routes
def active_routes
return {} if Feature.disabled?(:sidebar_refactor, context.current_user)
{ path: 'projects#show' }
end end
private private
def details_menu_item def details_menu_item
return if Feature.enabled?(:sidebar_refactor, context.current_user)
::Sidebars::MenuItem.new( ::Sidebars::MenuItem.new(
title: _('Details'), title: _('Details'),
link: project_path(context.project), link: project_path(context.project),
......
...@@ -7,7 +7,7 @@ module Sidebars ...@@ -7,7 +7,7 @@ module Sidebars
def configure_menus def configure_menus
set_scope_menu(Sidebars::Projects::Menus::ScopeMenu.new(context)) set_scope_menu(Sidebars::Projects::Menus::ScopeMenu.new(context))
add_menu(Sidebars::Projects::Menus::ProjectOverviewMenu.new(context)) add_menu(Sidebars::Projects::Menus::ProjectInformationMenu.new(context))
add_menu(Sidebars::Projects::Menus::LearnGitlabMenu.new(context)) add_menu(Sidebars::Projects::Menus::LearnGitlabMenu.new(context))
add_menu(Sidebars::Projects::Menus::RepositoryMenu.new(context)) add_menu(Sidebars::Projects::Menus::RepositoryMenu.new(context))
add_menu(Sidebars::Projects::Menus::IssuesMenu.new(context)) add_menu(Sidebars::Projects::Menus::IssuesMenu.new(context))
......
...@@ -25162,6 +25162,9 @@ msgstr "" ...@@ -25162,6 +25162,9 @@ msgstr ""
msgid "Project info:" msgid "Project info:"
msgstr "" msgstr ""
msgid "Project information"
msgstr ""
msgid "Project is required when cluster_type is :project" msgid "Project is required when cluster_type is :project"
msgstr "" msgstr ""
......
...@@ -378,11 +378,11 @@ RSpec.describe 'Group' do ...@@ -378,11 +378,11 @@ RSpec.describe 'Group' do
expect(page).to have_link('Subgroup information') 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 information"' do
visit project_path(project) visit project_path(project)
wait_for_requests wait_for_requests
expect(page).to have_link('Project overview') expect(page).to have_link('Project information')
end end
end end
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Project active tab' do RSpec.describe 'Project active tab' do
let(:user) { create :user } let_it_be(:project) { create(:project, :repository) }
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
before do before do
project.add_maintainer(user)
sign_in(user) sign_in(user)
end end
...@@ -18,15 +18,28 @@ RSpec.describe 'Project active tab' do ...@@ -18,15 +18,28 @@ RSpec.describe 'Project active tab' do
end end
context 'on project Home' do context 'on project Home' do
before do context 'when feature flag :sidebar_refactor is enabled' do
visit project_path(project) before do
visit project_path(project)
end
it_behaves_like 'page has active tab', 'Project'
end end
it_behaves_like 'page has active tab', 'Project' context 'when feature flag :sidebar_refactor is disabled' do
it_behaves_like 'page has active sub tab', 'Details' before do
stub_feature_flags(sidebar_refactor: false)
visit project_path(project)
end
it_behaves_like 'page has active tab', 'Project'
it_behaves_like 'page has active sub tab', 'Details'
end
context 'on project Home/Activity' do context 'on project Home/Activity' do
before do before do
visit project_path(project)
click_tab('Activity') click_tab('Activity')
end end
......
...@@ -86,6 +86,16 @@ RSpec.describe 'Project navbar' do ...@@ -86,6 +86,16 @@ RSpec.describe 'Project navbar' do
] ]
end end
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Releases')
]
}
end
before do before do
stub_feature_flags(sidebar_refactor: true) stub_feature_flags(sidebar_refactor: true)
stub_config(registry: { enabled: true }) stub_config(registry: { enabled: true })
......
...@@ -68,14 +68,27 @@ RSpec.describe 'User uses shortcuts', :js do ...@@ -68,14 +68,27 @@ RSpec.describe 'User uses shortcuts', :js do
end end
context 'when navigating to the Project pages' do context 'when navigating to the Project pages' do
it 'redirects to the details page' do it 'redirects to the project page' do
visit project_issues_path(project) visit project_issues_path(project)
find('body').native.send_key('g') find('body').native.send_key('g')
find('body').native.send_key('p') find('body').native.send_key('p')
expect(page).to have_active_navigation('Project') expect(page).to have_active_navigation('Project')
expect(page).to have_active_sub_navigation('Details') end
context 'when feature flag :sidebar_refactor is disabled' do
it 'redirects to the details page' do
stub_feature_flags(sidebar_refactor: false)
visit project_issues_path(project)
find('body').native.send_key('g')
find('body').native.send_key('p')
expect(page).to have_active_navigation('Project')
expect(page).to have_active_sub_navigation('Details')
end
end end
it 'redirects to the activity page' do it 'redirects to the activity page' do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Sidebars::Projects::Menus::ProjectOverviewMenu do RSpec.describe Sidebars::Projects::Menus::ProjectInformationMenu do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
......
...@@ -41,16 +41,20 @@ RSpec.shared_context 'project navbar structure' do ...@@ -41,16 +41,20 @@ RSpec.shared_context 'project navbar structure' do
] ]
end end
let(:project_information_nav_item) do
{
nav_item: _('Project overview'),
nav_sub_items: [
_('Details'),
_('Activity'),
_('Releases')
]
}
end
let(:structure) do let(:structure) do
[ [
{ project_information_nav_item,
nav_item: _('Project overview'),
nav_sub_items: [
_('Details'),
_('Activity'),
_('Releases')
]
},
{ {
nav_item: _('Repository'), nav_item: _('Repository'),
nav_sub_items: [ nav_sub_items: [
......
...@@ -19,20 +19,41 @@ RSpec.describe 'layouts/nav/sidebar/_project' do ...@@ -19,20 +19,41 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it_behaves_like 'has nav sidebar' it_behaves_like 'has nav sidebar'
describe 'Project Overview' do describe 'Project information' do
it 'has a link to the project path' do it 'has a link to the project path' do
render render
expect(rendered).to have_link('Project overview', href: project_path(project), class: %w(shortcuts-project rspec-project-link)) expect(rendered).to have_link('Project information', href: project_path(project), class: %w(shortcuts-project rspec-project-link))
expect(rendered).to have_selector('[aria-label="Project overview"]') expect(rendered).to have_selector('[aria-label="Project information"]')
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'has a link to the project path' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).to have_link('Project overview', href: project_path(project), class: %w(shortcuts-project rspec-project-link))
expect(rendered).to have_selector('[aria-label="Project overview"]')
end
end end
describe 'Details' do describe 'Details' do
it 'has a link to the projects path' do it 'does not have a link to the details menu' do
render render
expect(rendered).to have_link('Details', href: project_path(project), class: 'shortcuts-project') expect(rendered).not_to have_link('Details', href: project_path(project))
expect(rendered).to have_selector('[aria-label="Project details"]') end
context 'when feature flag :sidebar_refactor is disabled' do
it 'has a link to the projects path' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).to have_link('Details', href: project_path(project), class: 'shortcuts-project')
expect(rendered).to have_selector('[aria-label="Project details"]')
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