Commit 5d44287e authored by Imre Farkas's avatar Imre Farkas

Merge branch '326111-fj-remove-ff-sidebar-refactor' into 'master'

Remove ff sidebar_refactor from BE files

See merge request gitlab-org/gitlab!63850
parents f81cc1f1 8aafc4b1
...@@ -16,7 +16,12 @@ module Projects ...@@ -16,7 +16,12 @@ module Projects
private private
def packages_and_registries_settings_enabled! def packages_and_registries_settings_enabled!
render_404 unless settings_packages_and_registries_enabled?(project) render_404 unless can_destroy_container_registry_image?(project)
end
def can_destroy_container_registry_image?(project)
Gitlab.config.registry.enabled &&
can?(current_user, :destroy_container_image, project)
end end
end end
end end
......
...@@ -45,11 +45,7 @@ module GroupsHelper ...@@ -45,11 +45,7 @@ module GroupsHelper
end end
def group_information_title(group) def group_information_title(group)
if Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
group.subgroup? ? _('Subgroup information') : _('Group information') group.subgroup? ? _('Subgroup information') : _('Group information')
else
group.subgroup? ? _('Subgroup overview') : _('Group overview')
end
end end
def group_container_registry_nav? def group_container_registry_nav?
......
...@@ -73,9 +73,7 @@ module NavHelper ...@@ -73,9 +73,7 @@ module NavHelper
milestones#index milestones#index
boards#index boards#index
boards#show boards#show
].tap do |paths| ]
paths << 'labels#index' if Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
end
end end
private private
......
...@@ -611,21 +611,6 @@ module ProjectsHelper ...@@ -611,21 +611,6 @@ module ProjectsHelper
project.unlink_forks_upon_visibility_decrease_enabled? && project.visibility_level > Gitlab::VisibilityLevel::PRIVATE && project.forks_count > 0 project.unlink_forks_upon_visibility_decrease_enabled? && project.visibility_level > Gitlab::VisibilityLevel::PRIVATE && project.forks_count > 0
end end
def settings_container_registry_expiration_policy_available?(project)
Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml) &&
can_destroy_container_registry_image?(current_user, project)
end
def settings_packages_and_registries_enabled?(project)
Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml) &&
can_destroy_container_registry_image?(current_user, project)
end
def can_destroy_container_registry_image?(current_user, project)
Gitlab.config.registry.enabled &&
can?(current_user, :destroy_container_image, project)
end
def build_project_breadcrumb_link(project) def build_project_breadcrumb_link(project)
project_name = simple_sanitize(project.name) project_name = simple_sanitize(project.name)
......
#js-registry-settings{ data: { project_id: @project.id,
project_path: @project.full_path,
cadence_options: cadence_options.to_json,
keep_n_options: keep_n_options.to_json,
older_than_options: older_than_options.to_json,
is_admin: current_user&.admin.to_s,
admin_settings_path: ci_cd_admin_application_settings_path(anchor: 'js-registry-settings'),
enable_historic_entries: container_expiration_policies_historic_entry_enabled?(@project).to_s,
tags_regex_help_page_path: help_page_path('user/packages/container_registry/index', anchor: 'regex-pattern-examples') } }
...@@ -75,9 +75,6 @@ ...@@ -75,9 +75,6 @@
.settings-content .settings-content
= render 'projects/triggers/index' = render 'projects/triggers/index'
- if settings_container_registry_expiration_policy_available?(@project)
= render 'projects/registry/settings/index'
= render_if_exists 'projects/settings/ci_cd/auto_rollback', expanded: expanded = render_if_exists 'projects/settings/ci_cd/auto_rollback', expanded: expanded
- if can?(current_user, :create_freeze_period, @project) - if can?(current_user, :create_freeze_period, @project)
......
...@@ -9,11 +9,6 @@ module Sidebars ...@@ -9,11 +9,6 @@ module Sidebars
project_requirements_management_requirements_path(context.project) project_requirements_management_requirements_path(context.project)
end end
override :configure_menu_items
def configure_menu_items
add_item(list_menu_item)
end
override :render? override :render?
def render? def render?
can?(context.current_user, :read_requirement, context.project) can?(context.current_user, :read_requirement, context.project)
...@@ -33,21 +28,6 @@ module Sidebars ...@@ -33,21 +28,6 @@ module Sidebars
def active_routes def active_routes
{ path: 'requirements#index' } { path: 'requirements#index' }
end end
private
def list_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
return ::Sidebars::NilMenuItem.new(item_id: :requirements_list)
end
::Sidebars::MenuItem.new(
title: _('List'),
link: project_requirements_management_requirements_path(context.project),
active_routes: { path: 'requirements#index' },
item_id: :requirements_list
)
end
end end
end end
end end
......
...@@ -13,32 +13,9 @@ RSpec.describe 'Project navbar' do ...@@ -13,32 +13,9 @@ RSpec.describe 'Project navbar' do
before do before do
sign_in(user) sign_in(user)
end
context 'when sidebar refactor feature flag is disabled' do
let(:project_context_nav_item) do
nil
end
before do insert_package_nav(_('Infrastructure'))
stub_feature_flags(sidebar_refactor: false)
insert_package_nav(_('Operations'))
insert_infrastructure_registry_nav insert_infrastructure_registry_nav
stub_config(registry: { enabled: false })
insert_after_sub_nav_item(
_('Boards'),
within: _('Issues'),
new_sub_nav_item_name: _('Labels')
)
insert_after_nav_item(
_('Snippets'),
new_nav_item: {
nav_item: _('Members'),
nav_sub_items: []
}
)
end end
context 'when issue analytics is available' do context 'when issue analytics is available' do
...@@ -83,8 +60,6 @@ RSpec.describe 'Project navbar' do ...@@ -83,8 +60,6 @@ RSpec.describe 'Project navbar' do
context 'when packages are available' do context 'when packages are available' do
before do before do
stub_config(packages: { enabled: true }, registry: { enabled: false }) stub_config(packages: { enabled: true }, registry: { enabled: false })
visit project_path(project)
end end
context 'when container registry is available' do context 'when container registry is available' do
...@@ -93,22 +68,10 @@ RSpec.describe 'Project navbar' do ...@@ -93,22 +68,10 @@ RSpec.describe 'Project navbar' do
insert_container_nav insert_container_nav
visit project_path(project) insert_after_sub_nav_item(
end _('Monitor'),
within: _('Settings'),
it_behaves_like 'verified navigation bar' new_sub_nav_item_name: _('Packages & Registries')
end
end
context 'when requirements is available' do
before do
stub_licensed_features(requirements: true)
insert_after_nav_item(
_('Merge requests'),
new_nav_item: {
nav_item: _('Requirements'),
nav_sub_items: [_('List')]
}
) )
visit project_path(project) visit project_path(project)
...@@ -118,87 +81,9 @@ RSpec.describe 'Project navbar' do ...@@ -118,87 +81,9 @@ RSpec.describe 'Project navbar' do
end end
end end
context 'when sidebar refactor feature flag is enabled' do
let(:monitor_menu_items) do
[
_('Metrics'),
_('Logs'),
_('Tracing'),
_('Error Tracking'),
_('Alerts'),
_('Incidents'),
_('Product Analytics')
]
end
let(:monitor_nav_item) do
{
nav_item: _('Monitor'),
nav_sub_items: monitor_menu_items
}
end
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Labels'),
_('Members')
]
}
end
let(:settings_menu_items) do
[
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Monitor')
]
end
before do
stub_feature_flags(sidebar_refactor: true)
insert_package_nav(_('Monitor'))
insert_infrastructure_registry_nav
insert_after_nav_item(
_('Security & Compliance'),
new_nav_item: {
nav_item: _('Deployments'),
nav_sub_items: [
_('Feature Flags'),
_('Environments'),
_('Releases')
]
}
)
insert_after_nav_item(
_('Monitor'),
new_nav_item: {
nav_item: _('Infrastructure'),
nav_sub_items: [
_('Kubernetes clusters'),
_('Serverless platform'),
_('Terraform')
]
}
)
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
context 'when requirements is available' do context 'when requirements is available' do
before do before do
stub_licensed_features(requirements: true) stub_licensed_features(requirements: true)
insert_after_nav_item( insert_after_nav_item(
_('Merge requests'), _('Merge requests'),
new_nav_item: { new_nav_item: {
...@@ -212,5 +97,4 @@ RSpec.describe 'Project navbar' do ...@@ -212,5 +97,4 @@ RSpec.describe 'Project navbar' do
it_behaves_like 'verified navigation bar' it_behaves_like 'verified navigation bar'
end end
end
end end
...@@ -23,11 +23,6 @@ RSpec.describe Sidebars::Projects::Menus::RequirementsMenu do ...@@ -23,11 +23,6 @@ RSpec.describe Sidebars::Projects::Menus::RequirementsMenu do
end end
context 'when user can read requirements' do context 'when user can read requirements' do
context 'when feature flag :sidebar_refactor is enabled' do
before do
stub_feature_flags(sidebar_refactor: true)
end
it 'returns true' do it 'returns true' do
expect(subject.render?).to eq true expect(subject.render?).to eq true
end end
...@@ -36,20 +31,5 @@ RSpec.describe Sidebars::Projects::Menus::RequirementsMenu do ...@@ -36,20 +31,5 @@ RSpec.describe Sidebars::Projects::Menus::RequirementsMenu do
expect(subject.renderable_items).to be_empty expect(subject.renderable_items).to be_empty
end end
end end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it 'returns true' do
expect(subject.render?).to eq true
end
it 'contains list menu item' do
expect(subject.renderable_items[0].item_id).to eq :requirements_list
end
end
end
end end
end end
...@@ -89,39 +89,13 @@ RSpec.describe 'layouts/nav/sidebar/_project' do ...@@ -89,39 +89,13 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
allow(view).to receive(:current_user).and_return(user) allow(view).to receive(:current_user).and_return(user)
end end
shared_examples 'has a link to the requirements page' do it 'has a link to the requirements page' do
specify do
render render
expect(rendered).to have_link('Requirements', href: project_requirements_management_requirements_path(project)) expect(rendered).to have_link('Requirements', href: project_requirements_management_requirements_path(project))
end end
end end
context 'when feature flag :sidebar_refactor is enabled' do
it_behaves_like 'has a link to the requirements page'
it 'does not have a link to the requirement List' do
stub_feature_flags(sidebar_refactor: true)
render
expect(rendered).not_to have_link('List', href: project_requirements_management_requirements_path(project))
end
end
context 'when feature flag :sidebar_refactor is disabled' do
it_behaves_like 'has a link to the requirements page'
it 'has a link to the requirement List' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).to have_link('List', href: project_requirements_management_requirements_path(project))
end
end
end
describe 'CI/CD' do describe 'CI/CD' do
describe 'Test Cases' do describe 'Test Cases' do
let(:license_feature_status) { true } let(:license_feature_status) { true }
......
...@@ -6,8 +6,6 @@ module Sidebars ...@@ -6,8 +6,6 @@ module Sidebars
class DeploymentsMenu < ::Sidebars::Menu class DeploymentsMenu < ::Sidebars::Menu
override :configure_menu_items override :configure_menu_items
def configure_menu_items def configure_menu_items
return false if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
add_item(feature_flags_menu_item) add_item(feature_flags_menu_item)
add_item(environments_menu_item) add_item(environments_menu_item)
add_item(releases_menu_item) add_item(releases_menu_item)
......
...@@ -6,7 +6,6 @@ module Sidebars ...@@ -6,7 +6,6 @@ module Sidebars
class InfrastructureMenu < ::Sidebars::Menu class InfrastructureMenu < ::Sidebars::Menu
override :configure_menu_items override :configure_menu_items
def configure_menu_items def configure_menu_items
return false if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
return false unless context.project.feature_available?(:operations, context.current_user) return false unless context.project.feature_available?(:operations, context.current_user)
add_item(kubernetes_menu_item) add_item(kubernetes_menu_item)
......
...@@ -12,7 +12,6 @@ module Sidebars ...@@ -12,7 +12,6 @@ module Sidebars
add_item(list_menu_item) add_item(list_menu_item)
add_item(boards_menu_item) add_item(boards_menu_item)
add_item(labels_menu_item)
add_item(service_desk_menu_item) add_item(service_desk_menu_item)
add_item(milestones_menu_item) add_item(milestones_menu_item)
...@@ -97,19 +96,6 @@ module Sidebars ...@@ -97,19 +96,6 @@ module Sidebars
) )
end end
def labels_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
return ::Sidebars::NilMenuItem.new(item_id: :labels)
end
::Sidebars::MenuItem.new(
title: _('Labels'),
link: project_labels_path(context.project),
active_routes: { controller: :labels },
item_id: :labels
)
end
def service_desk_menu_item def service_desk_menu_item
::Sidebars::MenuItem.new( ::Sidebars::MenuItem.new(
title: _('Service Desk'), title: _('Service Desk'),
......
# frozen_string_literal: true
module Sidebars
module Projects
module Menus
class LabelsMenu < ::Sidebars::Menu
override :link
def link
project_labels_path(context.project)
end
override :extra_container_html_options
def extra_container_html_options
{
class: 'shortcuts-labels'
}
end
override :title
def title
_('Labels')
end
override :title_html_options
def title_html_options
{
id: 'js-onboarding-labels-link'
}
end
override :active_routes
def active_routes
{ controller: :labels }
end
override :sprite_icon
def sprite_icon
'label'
end
override :render?
def render?
return false if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
can?(context.current_user, :read_label, context.project) && !context.project.issues_enabled?
end
end
end
end
end
# frozen_string_literal: true
module Sidebars
module Projects
module Menus
class MembersMenu < ::Sidebars::Menu
override :link
def link
project_project_members_path(context.project)
end
override :extra_container_html_options
def extra_container_html_options
{
id: 'js-onboarding-members-link'
}
end
override :title
def title
_('Members')
end
override :sprite_icon
def sprite_icon
'users'
end
override :render?
def render?
return false if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
can?(context.current_user, :read_project_member, context.project)
end
override :active_routes
def active_routes
{ controller: :project_members }
end
end
end
end
end
...@@ -14,11 +14,6 @@ module Sidebars ...@@ -14,11 +14,6 @@ module Sidebars
add_item(error_tracking_menu_item) add_item(error_tracking_menu_item)
add_item(alert_management_menu_item) add_item(alert_management_menu_item)
add_item(incidents_menu_item) add_item(incidents_menu_item)
add_item(serverless_menu_item)
add_item(terraform_menu_item)
add_item(kubernetes_menu_item)
add_item(environments_menu_item)
add_item(feature_flags_menu_item)
add_item(product_analytics_menu_item) add_item(product_analytics_menu_item)
true true
...@@ -36,18 +31,18 @@ module Sidebars ...@@ -36,18 +31,18 @@ module Sidebars
override :extra_container_html_options override :extra_container_html_options
def extra_container_html_options def extra_container_html_options
{ {
class: Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? 'shortcuts-monitor' : 'shortcuts-operations' class: 'shortcuts-monitor'
} }
end end
override :title override :title
def title def title
Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? _('Monitor') : _('Operations') _('Monitor')
end end
override :sprite_icon override :sprite_icon
def sprite_icon def sprite_icon
Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? 'monitor' : 'cloud-gear' 'monitor'
end end
override :active_routes override :active_routes
...@@ -138,93 +133,6 @@ module Sidebars ...@@ -138,93 +133,6 @@ module Sidebars
) )
end end
def serverless_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :read_cluster, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :serverless)
end
::Sidebars::MenuItem.new(
title: _('Serverless'),
link: project_serverless_functions_path(context.project),
active_routes: { controller: :functions },
item_id: :serverless
)
end
def terraform_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :read_terraform_state, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :terraform)
end
::Sidebars::MenuItem.new(
title: _('Terraform'),
link: project_terraform_index_path(context.project),
active_routes: { controller: :terraform },
item_id: :terraform
)
end
def kubernetes_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :read_cluster, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :kubernetes)
end
::Sidebars::MenuItem.new(
title: _('Kubernetes'),
link: project_clusters_path(context.project),
active_routes: { controller: [:cluster_agents, :clusters] },
container_html_options: { class: 'shortcuts-kubernetes' },
hint_html_options: kubernetes_hint_html_options,
item_id: :kubernetes
)
end
def kubernetes_hint_html_options
return {} unless context.show_cluster_hint
{ disabled: true,
data: { trigger: 'manual',
container: 'body',
placement: 'right',
highlight: UserCalloutsHelper::GKE_CLUSTER_INTEGRATION,
highlight_priority: UserCallout.feature_names[:GKE_CLUSTER_INTEGRATION],
dismiss_endpoint: user_callouts_path,
auto_devops_help_path: help_page_path('topics/autodevops/index.md') } }
end
def environments_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :read_environment, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :environments)
end
::Sidebars::MenuItem.new(
title: _('Environments'),
link: project_environments_path(context.project),
active_routes: { controller: :environments },
container_html_options: { class: 'shortcuts-environments' },
item_id: :environments
)
end
def feature_flags_menu_item
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :read_feature_flag, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :feature_flags)
end
::Sidebars::MenuItem.new(
title: _('Feature Flags'),
link: project_feature_flags_path(context.project),
active_routes: { controller: :feature_flags },
container_html_options: { class: 'shortcuts-feature-flags' },
item_id: :feature_flags
)
end
def product_analytics_menu_item def product_analytics_menu_item
if Feature.disabled?(:product_analytics, context.project) || if Feature.disabled?(:product_analytics, context.project) ||
!can?(context.current_user, :read_product_analytics, context.project) !can?(context.current_user, :read_product_analytics, context.project)
......
...@@ -6,9 +6,7 @@ module Sidebars ...@@ -6,9 +6,7 @@ module Sidebars
class ProjectInformationMenu < ::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(activity_menu_item) add_item(activity_menu_item)
add_item(releases_menu_item)
add_item(labels_menu_item) add_item(labels_menu_item)
add_item(members_menu_item) add_item(members_menu_item)
...@@ -22,11 +20,7 @@ module Sidebars ...@@ -22,11 +20,7 @@ module Sidebars
override :extra_container_html_options override :extra_container_html_options
def extra_container_html_options def extra_container_html_options
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
{ class: 'shortcuts-project-information' } { class: 'shortcuts-project-information' }
else
{ class: 'shortcuts-project rspec-project-link' }
end
end end
override :extra_nav_link_html_options override :extra_nav_link_html_options
...@@ -36,39 +30,16 @@ module Sidebars ...@@ -36,39 +30,16 @@ module Sidebars
override :title override :title
def title def title
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
_('Project information') _('Project information')
else
_('Project overview')
end
end end
override :sprite_icon override :sprite_icon
def sprite_icon def sprite_icon
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
'project' 'project'
else
'home'
end
end end
private private
def details_menu_item
return if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
::Sidebars::MenuItem.new(
title: _('Details'),
link: project_path(context.project),
active_routes: { path: 'projects#show' },
item_id: :project_overview,
container_html_options: {
aria: { label: _('Project details') },
class: 'shortcuts-project'
}
)
end
def activity_menu_item def activity_menu_item
::Sidebars::MenuItem.new( ::Sidebars::MenuItem.new(
title: _('Activity'), title: _('Activity'),
...@@ -79,29 +50,7 @@ module Sidebars ...@@ -79,29 +50,7 @@ module Sidebars
) )
end end
def releases_menu_item
return ::Sidebars::NilMenuItem.new(item_id: :releases) unless show_releases?
::Sidebars::MenuItem.new(
title: _('Releases'),
link: project_releases_path(context.project),
item_id: :releases,
active_routes: { controller: :releases },
container_html_options: { class: 'shortcuts-project-releases' }
)
end
def show_releases?
Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) &&
can?(context.current_user, :read_release, context.project) &&
!context.project.empty_repo?
end
def labels_menu_item def labels_menu_item
if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
return ::Sidebars::NilMenuItem.new(item_id: :labels)
end
::Sidebars::MenuItem.new( ::Sidebars::MenuItem.new(
title: _('Labels'), title: _('Labels'),
link: project_labels_path(context.project), link: project_labels_path(context.project),
...@@ -111,10 +60,6 @@ module Sidebars ...@@ -111,10 +60,6 @@ module Sidebars
end end
def members_menu_item def members_menu_item
if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
return ::Sidebars::NilMenuItem.new(item_id: :members)
end
::Sidebars::MenuItem.new( ::Sidebars::MenuItem.new(
title: _('Members'), title: _('Members'),
link: project_project_members_path(context.project), link: project_project_members_path(context.project),
......
...@@ -21,8 +21,6 @@ module Sidebars ...@@ -21,8 +21,6 @@ module Sidebars
override :extra_container_html_options override :extra_container_html_options
def extra_container_html_options def extra_container_html_options
return {} if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
{ {
class: 'shortcuts-project rspec-project-link' class: 'shortcuts-project rspec-project-link'
} }
...@@ -30,8 +28,6 @@ module Sidebars ...@@ -30,8 +28,6 @@ module Sidebars
override :extra_nav_link_html_options override :extra_nav_link_html_options
def extra_nav_link_html_options def extra_nav_link_html_options
return {} if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
{ class: 'context-header' } { class: 'context-header' }
end end
......
...@@ -112,9 +112,8 @@ module Sidebars ...@@ -112,9 +112,8 @@ module Sidebars
return ::Sidebars::NilMenuItem.new(item_id: :monitor) return ::Sidebars::NilMenuItem.new(item_id: :monitor)
end end
title = Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? _('Monitor') : _('Operations')
::Sidebars::MenuItem.new( ::Sidebars::MenuItem.new(
title: title, title: _('Monitor'),
link: project_settings_operations_path(context.project), link: project_settings_operations_path(context.project),
active_routes: { path: 'operations#show' }, active_routes: { path: 'operations#show' },
item_id: :monitor item_id: :monitor
...@@ -136,7 +135,6 @@ module Sidebars ...@@ -136,7 +135,6 @@ module Sidebars
def packages_and_registries_menu_item def packages_and_registries_menu_item
if !Gitlab.config.registry.enabled || if !Gitlab.config.registry.enabled ||
Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :destroy_container_image, context.project) !can?(context.current_user, :destroy_container_image, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :packages_and_registries) return ::Sidebars::NilMenuItem.new(item_id: :packages_and_registries)
end end
......
...@@ -23,7 +23,6 @@ module Sidebars ...@@ -23,7 +23,6 @@ module Sidebars
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))
add_menu(Sidebars::Projects::Menus::ExternalIssueTrackerMenu.new(context)) add_menu(Sidebars::Projects::Menus::ExternalIssueTrackerMenu.new(context))
add_menu(Sidebars::Projects::Menus::LabelsMenu.new(context))
add_menu(Sidebars::Projects::Menus::MergeRequestsMenu.new(context)) add_menu(Sidebars::Projects::Menus::MergeRequestsMenu.new(context))
add_menu(Sidebars::Projects::Menus::CiCdMenu.new(context)) add_menu(Sidebars::Projects::Menus::CiCdMenu.new(context))
add_menu(Sidebars::Projects::Menus::SecurityComplianceMenu.new(context)) add_menu(Sidebars::Projects::Menus::SecurityComplianceMenu.new(context))
...@@ -35,7 +34,6 @@ module Sidebars ...@@ -35,7 +34,6 @@ module Sidebars
add_menu(confluence_or_wiki_menu) add_menu(confluence_or_wiki_menu)
add_menu(Sidebars::Projects::Menus::ExternalWikiMenu.new(context)) add_menu(Sidebars::Projects::Menus::ExternalWikiMenu.new(context))
add_menu(Sidebars::Projects::Menus::SnippetsMenu.new(context)) add_menu(Sidebars::Projects::Menus::SnippetsMenu.new(context))
add_menu(Sidebars::Projects::Menus::MembersMenu.new(context))
add_menu(Sidebars::Projects::Menus::SettingsMenu.new(context)) add_menu(Sidebars::Projects::Menus::SettingsMenu.new(context))
end end
......
...@@ -15376,9 +15376,6 @@ msgstr "" ...@@ -15376,9 +15376,6 @@ msgstr ""
msgid "Group navigation" msgid "Group navigation"
msgstr "" msgstr ""
msgid "Group overview"
msgstr ""
msgid "Group overview content" msgid "Group overview content"
msgstr "" msgstr ""
...@@ -25262,9 +25259,6 @@ msgstr "" ...@@ -25262,9 +25259,6 @@ msgstr ""
msgid "Project description (optional)" msgid "Project description (optional)"
msgstr "" msgstr ""
msgid "Project details"
msgstr ""
msgid "Project does not exist or you don't have permission to perform this action" msgid "Project does not exist or you don't have permission to perform this action"
msgstr "" msgstr ""
...@@ -25313,9 +25307,6 @@ msgstr "" ...@@ -25313,9 +25307,6 @@ msgstr ""
msgid "Project order will not be saved as local storage is not available." msgid "Project order will not be saved as local storage is not available."
msgstr "" msgstr ""
msgid "Project overview"
msgstr ""
msgid "Project path" msgid "Project path"
msgstr "" msgstr ""
...@@ -31071,9 +31062,6 @@ msgstr "" ...@@ -31071,9 +31062,6 @@ msgstr ""
msgid "Subgroup navigation" msgid "Subgroup navigation"
msgstr "" msgstr ""
msgid "Subgroup overview"
msgstr ""
msgid "SubgroupCreationLevel|Allowed to create subgroups" msgid "SubgroupCreationLevel|Allowed to create subgroups"
msgstr "" msgstr ""
......
...@@ -11,40 +11,6 @@ RSpec.describe 'Group navbar' do ...@@ -11,40 +11,6 @@ RSpec.describe 'Group navbar' do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) } let_it_be(:group) { create(:group) }
let(:structure) do
[
group_context_nav_item,
group_information_nav_item,
{
nav_item: _('Issues'),
nav_sub_items: issues_nav_items
},
{
nav_item: _('Merge requests'),
nav_sub_items: []
},
(security_and_compliance_nav_item if Gitlab.ee?),
(push_rules_nav_item if Gitlab.ee?),
{
nav_item: _('Kubernetes'),
nav_sub_items: []
},
(analytics_nav_item if Gitlab.ee?),
members_nav_item
].compact
end
let(:members_nav_item) do
nil
end
let(:group_context_nav_item) do
{
nav_item: "#{group.name[0, 1].upcase} #{group.name}",
nav_sub_items: []
}
end
before do before do
insert_package_nav(_('Kubernetes')) insert_package_nav(_('Kubernetes'))
...@@ -85,44 +51,4 @@ RSpec.describe 'Group navbar' do ...@@ -85,44 +51,4 @@ RSpec.describe 'Group navbar' do
it_behaves_like 'verified navigation bar' it_behaves_like 'verified navigation bar'
end end
context 'when feature flag :sidebar_refactor is disabled' do
let(:group_context_nav_item) do
nil
end
let(:group_information_nav_item) do
{
nav_item: _('Group overview'),
nav_sub_items: [
_('Details'),
_('Activity')
]
}
end
let(:members_nav_item) do
{
nav_item: _('Members'),
nav_sub_items: []
}
end
let(:issues_nav_items) do
[
_('List'),
_('Board'),
_('Labels'),
_('Milestones')
]
end
before do
stub_feature_flags(sidebar_refactor: false)
visit group_path(group)
end
it_behaves_like 'verified navigation bar'
end
end end
...@@ -24,17 +24,6 @@ RSpec.describe 'Project active tab' do ...@@ -24,17 +24,6 @@ RSpec.describe 'Project active tab' do
expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1) expect(page).to have_selector('.sidebar-top-level-items > li.active', count: 1)
expect(find('.sidebar-top-level-items > li.active')).to have_content(project.name) expect(find('.sidebar-top-level-items > li.active')).to have_content(project.name)
end end
context 'when feature flag :sidebar_refactor is disabled' do
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
end end
context 'on Project information' do context 'on Project information' do
...@@ -80,11 +69,7 @@ RSpec.describe 'Project active tab' do ...@@ -80,11 +69,7 @@ RSpec.describe 'Project active tab' do
end end
context 'on project Issues' do context 'on project Issues' do
let(:feature_flag_value) { true }
before do before do
stub_feature_flags(sidebar_refactor: feature_flag_value)
visit project_issues_path(project) visit project_issues_path(project)
end end
...@@ -98,21 +83,6 @@ RSpec.describe 'Project active tab' do ...@@ -98,21 +83,6 @@ RSpec.describe 'Project active tab' do
it_behaves_like 'page has active tab', 'Issues' it_behaves_like 'page has active tab', 'Issues'
it_behaves_like 'page has active sub tab', 'Milestones' it_behaves_like 'page has active sub tab', 'Milestones'
end end
context 'when feature flag is disabled' do
let(:feature_flag_value) { false }
%w(Milestones Labels).each do |sub_menu|
context "on project Issues/#{sub_menu}" do
before do
click_tab(sub_menu)
end
it_behaves_like 'page has active tab', 'Issues'
it_behaves_like 'page has active sub tab', sub_menu
end
end
end
end end
context 'on project Merge Requests' do context 'on project Merge Requests' do
......
...@@ -68,17 +68,6 @@ RSpec.describe 'Edit Project Settings' do ...@@ -68,17 +68,6 @@ RSpec.describe 'Edit Project Settings' do
expect(page).not_to have_selector('.shortcuts-issues') expect(page).not_to have_selector('.shortcuts-issues')
expect(page).not_to have_selector('.shortcuts-labels') expect(page).not_to have_selector('.shortcuts-labels')
end end
context 'when feature flag :sidebar_refactor is disabled' do
it 'hides issues tab and show labels tab' do
stub_feature_flags(sidebar_refactor: false)
visit project_path(project)
expect(page).not_to have_selector('.shortcuts-issues')
expect(page).to have_selector('.shortcuts-labels')
end
end
end end
context "pipelines subtabs" do context "pipelines subtabs" do
......
...@@ -14,33 +14,10 @@ RSpec.describe 'Project navbar' do ...@@ -14,33 +14,10 @@ RSpec.describe 'Project navbar' do
before do before do
sign_in(user) sign_in(user)
end
context 'when sidebar refactor feature flag is disabled' do
let(:project_context_nav_item) do
nil
end
before do
stub_feature_flags(sidebar_refactor: false)
insert_package_nav(_('Operations'))
insert_infrastructure_registry_nav
insert_after_sub_nav_item(
_('Boards'),
within: _('Issues'),
new_sub_nav_item_name: _('Labels')
)
insert_after_nav_item(
_('Snippets'),
new_nav_item: {
nav_item: _('Members'),
nav_sub_items: []
}
)
stub_config(registry: { enabled: false }) stub_config(registry: { enabled: false })
insert_package_nav(_('Infrastructure'))
insert_infrastructure_registry_nav
end end
it_behaves_like 'verified navigation bar' do it_behaves_like 'verified navigation bar' do
...@@ -70,7 +47,7 @@ RSpec.describe 'Project navbar' do ...@@ -70,7 +47,7 @@ RSpec.describe 'Project navbar' do
stub_config(pages: { enabled: true }) stub_config(pages: { enabled: true })
insert_after_sub_nav_item( insert_after_sub_nav_item(
_('Operations'), _('Monitor'),
within: _('Settings'), within: _('Settings'),
new_sub_nav_item_name: _('Pages') new_sub_nav_item_name: _('Pages')
) )
...@@ -87,93 +64,12 @@ RSpec.describe 'Project navbar' do ...@@ -87,93 +64,12 @@ RSpec.describe 'Project navbar' do
insert_container_nav insert_container_nav
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
end
end
context 'when sidebar refactor feature flag is enabled' do
let(:monitor_nav_item) do
{
nav_item: _('Monitor'),
nav_sub_items: monitor_menu_items
}
end
let(:monitor_menu_items) do
[
_('Metrics'),
_('Logs'),
_('Tracing'),
_('Error Tracking'),
_('Alerts'),
_('Incidents'),
_('Product Analytics')
]
end
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Labels'),
_('Members')
]
}
end
let(:settings_menu_items) do
[
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Monitor')
]
end
before do
stub_feature_flags(sidebar_refactor: true)
stub_config(registry: { enabled: true })
insert_package_nav(_('Monitor'))
insert_infrastructure_registry_nav
insert_container_nav
insert_after_sub_nav_item( insert_after_sub_nav_item(
_('Monitor'), _('Monitor'),
within: _('Settings'), within: _('Settings'),
new_sub_nav_item_name: _('Packages & Registries') new_sub_nav_item_name: _('Packages & Registries')
) )
insert_after_nav_item(
_('Monitor'),
new_nav_item: {
nav_item: _('Infrastructure'),
nav_sub_items: [
_('Kubernetes clusters'),
_('Serverless platform'),
_('Terraform')
]
}
)
insert_after_nav_item(
_('Security & Compliance'),
new_nav_item: {
nav_item: _('Deployments'),
nav_sub_items: [
_('Feature Flags'),
_('Environments'),
_('Releases')
]
}
)
visit project_path(project) visit project_path(project)
end end
......
...@@ -18,17 +18,6 @@ RSpec.describe 'Projects > Settings > For a forked project', :js do ...@@ -18,17 +18,6 @@ RSpec.describe 'Projects > Settings > For a forked project', :js do
expect(page).to have_selector('.sidebar-sub-level-items a[aria-label="Monitor"]', text: 'Monitor', visible: false) expect(page).to have_selector('.sidebar-sub-level-items a[aria-label="Monitor"]', text: 'Monitor', visible: false)
end end
context 'when feature flag sidebar_refactor is disabled' do
it 'renders the menu "Operations" in the sidebar' do
stub_feature_flags(sidebar_refactor: false)
visit project_path(project)
wait_for_requests
expect(page).to have_selector('.sidebar-sub-level-items a[aria-label="Operations"]', text: 'Operations', visible: false)
end
end
end end
describe 'Settings > Monitor' do describe 'Settings > Monitor' do
......
...@@ -11,7 +11,8 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p ...@@ -11,7 +11,8 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p
let(:container_registry_enabled) { true } let(:container_registry_enabled) { true }
let(:container_registry_enabled_on_project) { true } let(:container_registry_enabled_on_project) { true }
shared_examples 'an expiration policy form' do subject { visit project_settings_packages_and_registries_path(project) }
before do before do
project.update!(container_registry_enabled: container_registry_enabled_on_project) project.update!(container_registry_enabled: container_registry_enabled_on_project)
project.container_expiration_policy.update!(enabled: true) project.container_expiration_policy.update!(enabled: true)
...@@ -111,25 +112,4 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p ...@@ -111,25 +112,4 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p
expect(page).not_to have_selector('[data-testid="registry-settings-app"]') expect(page).not_to have_selector('[data-testid="registry-settings-app"]')
end end
end end
end
context 'with sidebar feature flag off' do
subject { visit project_settings_ci_cd_path(project) }
before do
stub_feature_flags(sidebar_refactor: false)
end
it_behaves_like 'an expiration policy form'
end
context 'with sidebar feature flag on' do
subject { visit project_settings_packages_and_registries_path(project) }
before do
stub_feature_flags(sidebar_refactor: true)
end
it_behaves_like 'an expiration policy form'
end
end end
...@@ -77,20 +77,6 @@ RSpec.describe 'User uses shortcuts', :js do ...@@ -77,20 +77,6 @@ RSpec.describe 'User uses shortcuts', :js do
expect(page).to have_active_navigation(project.name) expect(page).to have_active_navigation(project.name)
end 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
it 'redirects to the activity page' do it 'redirects to the activity page' do
find('body').native.send_key('g') find('body').native.send_key('g')
find('body').native.send_key('v') find('body').native.send_key('v')
...@@ -196,36 +182,6 @@ RSpec.describe 'User uses shortcuts', :js do ...@@ -196,36 +182,6 @@ RSpec.describe 'User uses shortcuts', :js do
expect(page).to have_active_navigation('Monitor') expect(page).to have_active_navigation('Monitor')
expect(page).to have_active_sub_navigation('Metrics') expect(page).to have_active_sub_navigation('Metrics')
end end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it 'redirects to the Operations page' do
find('body').native.send_key('g')
find('body').native.send_key('l')
expect(page).to have_active_navigation('Operations')
expect(page).to have_active_sub_navigation('Metrics')
end
it 'redirects to the Kubernetes page with active Operations' do
find('body').native.send_key('g')
find('body').native.send_key('k')
expect(page).to have_active_navigation('Operations')
expect(page).to have_active_sub_navigation('Kubernetes')
end
it 'redirects to the Environments page' do
find('body').native.send_key('g')
find('body').native.send_key('e')
expect(page).to have_active_navigation('Operations')
expect(page).to have_active_sub_navigation('Environments')
end
end
end end
context 'when navigating to the Infrastructure pages' do context 'when navigating to the Infrastructure pages' do
......
...@@ -39,33 +39,22 @@ RSpec.describe Sidebars::Projects::Menus::DeploymentsMenu do ...@@ -39,33 +39,22 @@ RSpec.describe Sidebars::Projects::Menus::DeploymentsMenu do
end end
end end
shared_examples 'feature flag :sidebar_refactor disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
specify { is_expected.to be_nil }
end
describe 'Feature Flags' do describe 'Feature Flags' do
let(:item_id) { :feature_flags } let(:item_id) { :feature_flags }
it_behaves_like 'access rights checks' it_behaves_like 'access rights checks'
it_behaves_like 'feature flag :sidebar_refactor disabled'
end end
describe 'Environments' do describe 'Environments' do
let(:item_id) { :environments } let(:item_id) { :environments }
it_behaves_like 'access rights checks' it_behaves_like 'access rights checks'
it_behaves_like 'feature flag :sidebar_refactor disabled'
end end
describe 'Releases' do describe 'Releases' do
let(:item_id) { :releases } let(:item_id) { :releases }
it_behaves_like 'access rights checks' it_behaves_like 'access rights checks'
it_behaves_like 'feature flag :sidebar_refactor disabled'
end end
end end
end end
...@@ -65,22 +65,4 @@ RSpec.describe Sidebars::Projects::Menus::IssuesMenu do ...@@ -65,22 +65,4 @@ RSpec.describe Sidebars::Projects::Menus::IssuesMenu do
end end
end end
end end
describe 'Menu Items' do
subject { described_class.new(context).renderable_items.index { |e| e.item_id == item_id } }
describe 'Labels' do
let(:item_id) { :labels }
specify { is_expected.to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
specify { is_expected.not_to be_nil }
end
end
end
end end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Sidebars::Projects::Menus::LabelsMenu do
let(:project) { build(:project) }
let(:user) { project.owner }
let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project) }
subject { described_class.new(context) }
it 'does not contain any sub menu' do
expect(subject.has_items?).to eq false
end
describe '#render?' do
let(:issues_enabled) { true }
before do
allow(project).to receive(:issues_enabled?).and_return(issues_enabled)
end
context 'when feature flag :sidebar_refactor is enabled' do
let(:issues_enabled) { false }
it 'returns false' do
expect(subject.render?).to be_falsey
end
end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
context 'when user can read labels' do
context 'when issues feature is enabled' do
it 'returns false' do
expect(subject.render?).to be_falsey
end
end
context 'when issues feature is disabled' do
let(:issues_enabled) { false }
it 'returns true' do
expect(subject.render?).to be_truthy
end
end
end
context 'when user cannot read labels' do
let(:user) { nil }
it 'returns false' do
expect(subject.render?).to be_falsey
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Sidebars::Projects::Menus::MembersMenu do
let(:project) { build(:project) }
let(:user) { project.owner }
let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project) }
subject { described_class.new(context) }
describe '#render?' do
it 'returns false' do
expect(subject.render?).to eq false
end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it 'returns true' do
expect(subject.render?).to eq true
end
context 'when user cannot access members' do
let(:user) { nil }
it 'returns false' do
expect(subject.render?).to eq false
end
end
end
end
end
...@@ -41,28 +41,12 @@ RSpec.describe Sidebars::Projects::Menus::MonitorMenu do ...@@ -41,28 +41,12 @@ RSpec.describe Sidebars::Projects::Menus::MonitorMenu do
it 'returns "Monitor"' do it 'returns "Monitor"' do
expect(subject.title).to eq 'Monitor' expect(subject.title).to eq 'Monitor'
end end
context 'when feature flag :sidebar_refactor is disabled' do
it 'returns "Operations"' do
stub_feature_flags(sidebar_refactor: false)
expect(subject.title).to eq 'Operations'
end
end
end end
describe '#extra_container_html_options' do describe '#extra_container_html_options' do
it 'returns "shortcuts-monitor"' do it 'returns "shortcuts-monitor"' do
expect(subject.extra_container_html_options).to eq(class: 'shortcuts-monitor') expect(subject.extra_container_html_options).to eq(class: 'shortcuts-monitor')
end end
context 'when feature flag :sidebar_refactor is disabled' do
it 'returns "shortcuts-operations"' do
stub_feature_flags(sidebar_refactor: false)
expect(subject.extra_container_html_options).to eq(class: 'shortcuts-operations')
end
end
end end
describe '#link' do describe '#link' do
...@@ -130,76 +114,6 @@ RSpec.describe Sidebars::Projects::Menus::MonitorMenu do ...@@ -130,76 +114,6 @@ RSpec.describe Sidebars::Projects::Menus::MonitorMenu do
it_behaves_like 'access rights checks' it_behaves_like 'access rights checks'
end end
describe 'Serverless' do
let(:item_id) { :serverless }
specify { is_expected.to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it_behaves_like 'access rights checks'
end
end
describe 'Terraform' do
let(:item_id) { :terraform }
specify { is_expected.to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it_behaves_like 'access rights checks'
end
end
describe 'Kubernetes' do
let(:item_id) { :kubernetes }
specify { is_expected.to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it_behaves_like 'access rights checks'
end
end
describe 'Environments' do
let(:item_id) { :environments }
specify { is_expected.to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it_behaves_like 'access rights checks'
end
end
describe 'Feature Flags' do
let(:item_id) { :feature_flags }
specify { is_expected.to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it_behaves_like 'access rights checks'
end
end
describe 'Product Analytics' do describe 'Product Analytics' do
let(:item_id) { :product_analytics } let(:item_id) { :product_analytics }
......
...@@ -12,77 +12,21 @@ RSpec.describe Sidebars::Projects::Menus::ProjectInformationMenu do ...@@ -12,77 +12,21 @@ RSpec.describe Sidebars::Projects::Menus::ProjectInformationMenu do
subject { described_class.new(context).container_html_options } subject { described_class.new(context).container_html_options }
specify { is_expected.to match(hash_including(class: 'shortcuts-project-information has-sub-items')) } specify { is_expected.to match(hash_including(class: 'shortcuts-project-information has-sub-items')) }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
specify { is_expected.to match(hash_including(class: 'shortcuts-project rspec-project-link has-sub-items')) }
end
end end
describe 'Menu Items' do describe 'Menu Items' do
subject { described_class.new(context).renderable_items.index { |e| e.item_id == item_id } } subject { described_class.new(context).renderable_items.index { |e| e.item_id == item_id } }
describe 'Releases' do
let(:item_id) { :releases }
specify { is_expected.to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
context 'when project repository is empty' do
it 'does not include releases menu item' do
allow(project).to receive(:empty_repo?).and_return(true)
is_expected.to be_nil
end
end
context 'when project repository is not empty' do
context 'when user can download code' do
specify { is_expected.not_to be_nil }
end
context 'when user cannot download code' do
let(:user) { nil }
specify { is_expected.to be_nil }
end
end
end
end
describe 'Labels' do describe 'Labels' do
let(:item_id) { :labels } let(:item_id) { :labels }
specify { is_expected.not_to be_nil } specify { is_expected.not_to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
specify { is_expected.to be_nil }
end
end end
describe 'Members' do describe 'Members' do
let(:item_id) { :members } let(:item_id) { :members }
specify { is_expected.not_to be_nil } specify { is_expected.not_to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
specify { is_expected.to be_nil }
end
end end
end end
end end
...@@ -11,13 +11,5 @@ RSpec.describe Sidebars::Projects::Menus::ScopeMenu do ...@@ -11,13 +11,5 @@ RSpec.describe Sidebars::Projects::Menus::ScopeMenu do
subject { described_class.new(context).container_html_options } subject { described_class.new(context).container_html_options }
specify { is_expected.to match(hash_including(class: 'shortcuts-project rspec-project-link')) } specify { is_expected.to match(hash_including(class: 'shortcuts-project rspec-project-link')) }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
specify { is_expected.to eq(aria: { label: project.name }) }
end
end end
end end
...@@ -99,14 +99,6 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do ...@@ -99,14 +99,6 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do
specify { expect(subject.title).to eq 'Monitor' } specify { expect(subject.title).to eq 'Monitor' }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
specify { expect(subject.title).to eq 'Operations' }
end
describe 'when the user does not have access' do describe 'when the user does not have access' do
let(:user) { nil } let(:user) { nil }
...@@ -159,14 +151,6 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do ...@@ -159,14 +151,6 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do
specify { is_expected.not_to be_nil } specify { is_expected.not_to be_nil }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
specify { is_expected.to be_nil }
end
describe 'when the user does not have access' do describe 'when the user does not have access' do
let(:user) { nil } let(:user) { nil }
......
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_context 'project navbar structure' do RSpec.shared_context 'project navbar structure' do
let(:analytics_nav_item) do
{
nav_item: _('Analytics'),
nav_sub_items: [
_('CI/CD'),
(_('Code Review') if Gitlab.ee?),
(_('Merge Request') if Gitlab.ee?),
_('Repository'),
_('Value Stream')
]
}
end
let(:security_and_compliance_nav_item) do let(:security_and_compliance_nav_item) do
{ {
nav_item: _('Security & Compliance'), nav_item: _('Security & Compliance'),
...@@ -24,64 +11,20 @@ RSpec.shared_context 'project navbar structure' do ...@@ -24,64 +11,20 @@ RSpec.shared_context 'project navbar structure' do
} }
end end
let(:monitor_nav_item) do let(:structure) do
{
nav_item: _('Operations'),
nav_sub_items: monitor_menu_items
}
end
let(:monitor_menu_items) do
[ [
_('Metrics'),
_('Logs'),
_('Tracing'),
_('Error Tracking'),
_('Alerts'),
_('Incidents'),
_('Serverless'),
_('Terraform'),
_('Kubernetes'),
_('Environments'),
_('Feature Flags'),
_('Product Analytics')
]
end
let(:project_information_nav_item) do
{ {
nav_item: _('Project overview'), nav_item: "#{project.name[0, 1].upcase} #{project.name}",
nav_sub_items: []
},
{
nav_item: _('Project information'),
nav_sub_items: [ nav_sub_items: [
_('Details'),
_('Activity'), _('Activity'),
_('Releases') _('Labels'),
] _('Members')
}
end
let(:settings_menu_items) do
[
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Operations')
] ]
end },
let(:project_context_nav_item) do
{
nav_item: "#{project.name[0, 1].upcase} #{project.name}",
nav_sub_items: []
}
end
let(:structure) do
[
project_context_nav_item,
project_information_nav_item,
{ {
nav_item: _('Repository'), nav_item: _('Repository'),
nav_sub_items: [ nav_sub_items: [
...@@ -120,8 +63,44 @@ RSpec.shared_context 'project navbar structure' do ...@@ -120,8 +63,44 @@ RSpec.shared_context 'project navbar structure' do
] ]
}, },
security_and_compliance_nav_item, security_and_compliance_nav_item,
monitor_nav_item, {
analytics_nav_item, nav_item: _('Deployments'),
nav_sub_items: [
_('Feature Flags'),
_('Environments'),
_('Releases')
]
},
{
nav_item: _('Monitor'),
nav_sub_items: [
_('Metrics'),
_('Logs'),
_('Tracing'),
_('Error Tracking'),
_('Alerts'),
_('Incidents'),
_('Product Analytics')
]
},
{
nav_item: _('Infrastructure'),
nav_sub_items: [
_('Kubernetes clusters'),
_('Serverless platform'),
_('Terraform')
]
},
{
nav_item: _('Analytics'),
nav_sub_items: [
_('CI/CD'),
(_('Code Review') if Gitlab.ee?),
(_('Merge Request') if Gitlab.ee?),
_('Repository'),
_('Value Stream')
]
},
{ {
nav_item: _('Wiki'), nav_item: _('Wiki'),
nav_sub_items: [] nav_sub_items: []
...@@ -132,7 +111,15 @@ RSpec.shared_context 'project navbar structure' do ...@@ -132,7 +111,15 @@ RSpec.shared_context 'project navbar structure' do
}, },
{ {
nav_item: _('Settings'), nav_item: _('Settings'),
nav_sub_items: settings_menu_items nav_sub_items: [
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Monitor')
]
} }
].compact ].compact
end end
...@@ -189,17 +176,6 @@ RSpec.shared_context 'group navbar structure' do ...@@ -189,17 +176,6 @@ RSpec.shared_context 'group navbar structure' do
} }
end end
let(:group_information_nav_item) do
{
nav_item: _('Group information'),
nav_sub_items: [
_('Activity'),
_('Labels'),
_('Members')
]
}
end
let(:issues_nav_items) do let(:issues_nav_items) do
[ [
_('List'), _('List'),
...@@ -208,17 +184,20 @@ RSpec.shared_context 'group navbar structure' do ...@@ -208,17 +184,20 @@ RSpec.shared_context 'group navbar structure' do
] ]
end end
let(:group_context_nav_item) do let(:structure) do
[
{ {
nav_item: "#{group.name[0, 1].upcase} #{group.name}", nav_item: "#{group.name[0, 1].upcase} #{group.name}",
nav_sub_items: [] nav_sub_items: []
} },
end {
nav_item: _('Group information'),
let(:structure) do nav_sub_items: [
[ _('Activity'),
group_context_nav_item, _('Labels'),
group_information_nav_item, _('Members')
]
},
{ {
nav_item: _('Issues'), nav_item: _('Issues'),
nav_sub_items: issues_nav_items nav_sub_items: issues_nav_items
...@@ -227,7 +206,7 @@ RSpec.shared_context 'group navbar structure' do ...@@ -227,7 +206,7 @@ RSpec.shared_context 'group navbar structure' do
nav_item: _('Merge requests'), nav_item: _('Merge requests'),
nav_sub_items: [] nav_sub_items: []
}, },
security_and_compliance_nav_item, (security_and_compliance_nav_item if Gitlab.ee?),
(push_rules_nav_item if Gitlab.ee?), (push_rules_nav_item if Gitlab.ee?),
{ {
nav_item: _('Kubernetes'), nav_item: _('Kubernetes'),
......
...@@ -27,62 +27,11 @@ RSpec.describe 'layouts/nav/sidebar/_group' do ...@@ -27,62 +27,11 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
expect(rendered).to have_link('Group information', href: activity_group_path(group)) expect(rendered).to have_link('Group information', href: activity_group_path(group))
end 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
it 'has a link to the members page' do it 'has a link to the members page' do
render render
expect(rendered).to have_selector('.sidebar-top-level-items > li.home a[title="Members"]') expect(rendered).to have_selector('.sidebar-top-level-items > li.home a[title="Members"]')
expect(rendered).to have_link('Members', href: group_group_members_path(group)) expect(rendered).to have_link('Members', href: group_group_members_path(group))
end 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
it 'does not have a link to the members page' do
render
expect(rendered).not_to have_selector('.sidebar-top-level-items > li.home a[title="Members"]')
end
end
end
describe 'Members' do
it 'does not have a Members menu' do
render
expect(rendered).not_to have_selector('.nav-item-name', text: 'Members')
end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it 'has a Member menu' do
render
expect(rendered).to have_selector('.nav-item-name', text: 'Members')
expect(rendered).to have_link('Members', href: group_group_members_path(group))
end
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