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
private
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
......
......@@ -45,11 +45,7 @@ module GroupsHelper
end
def group_information_title(group)
if Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
group.subgroup? ? _('Subgroup information') : _('Group information')
else
group.subgroup? ? _('Subgroup overview') : _('Group overview')
end
group.subgroup? ? _('Subgroup information') : _('Group information')
end
def group_container_registry_nav?
......
......@@ -73,9 +73,7 @@ module NavHelper
milestones#index
boards#index
boards#show
].tap do |paths|
paths << 'labels#index' if Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
end
]
end
private
......
......@@ -611,21 +611,6 @@ module ProjectsHelper
project.unlink_forks_upon_visibility_decrease_enabled? && project.visibility_level > Gitlab::VisibilityLevel::PRIVATE && project.forks_count > 0
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)
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 @@
.settings-content
= 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
- if can?(current_user, :create_freeze_period, @project)
......
......@@ -9,11 +9,6 @@ module Sidebars
project_requirements_management_requirements_path(context.project)
end
override :configure_menu_items
def configure_menu_items
add_item(list_menu_item)
end
override :render?
def render?
can?(context.current_user, :read_requirement, context.project)
......@@ -33,21 +28,6 @@ module Sidebars
def active_routes
{ path: 'requirements#index' }
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
......
......@@ -13,102 +13,65 @@ RSpec.describe 'Project navbar' do
before do
sign_in(user)
end
context 'when sidebar refactor feature flag is disabled' do
let(:project_context_nav_item) do
nil
end
insert_package_nav(_('Infrastructure'))
insert_infrastructure_registry_nav
end
context 'when issue analytics is available' do
before do
stub_feature_flags(sidebar_refactor: false)
insert_package_nav(_('Operations'))
insert_infrastructure_registry_nav
stub_config(registry: { enabled: false })
stub_licensed_features(issues_analytics: true)
insert_after_sub_nav_item(
_('Boards'),
within: _('Issues'),
new_sub_nav_item_name: _('Labels')
_('Code Review'),
within: _('Analytics'),
new_sub_nav_item_name: _('Issue')
)
insert_after_nav_item(
_('Snippets'),
new_nav_item: {
nav_item: _('Members'),
nav_sub_items: []
}
)
visit project_path(project)
end
context 'when issue analytics is available' do
before do
stub_licensed_features(issues_analytics: true)
insert_after_sub_nav_item(
_('Code Review'),
within: _('Analytics'),
new_sub_nav_item_name: _('Issue')
)
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
end
it_behaves_like 'verified navigation bar'
context 'when security dashboard is available' do
let(:security_and_compliance_nav_item) do
{
nav_item: _('Security & Compliance'),
nav_sub_items: [
_('Security Dashboard'),
_('Vulnerability Report'),
s_('OnDemandScans|On-demand Scans'),
_('Audit Events'),
_('Configuration')
]
}
end
context 'when security dashboard is available' do
let(:security_and_compliance_nav_item) do
{
nav_item: _('Security & Compliance'),
nav_sub_items: [
_('Security Dashboard'),
_('Vulnerability Report'),
s_('OnDemandScans|On-demand Scans'),
_('Audit Events'),
_('Configuration')
]
}
end
before do
stub_licensed_features(security_dashboard: true, security_on_demand_scans: true)
before do
stub_licensed_features(security_dashboard: true, security_on_demand_scans: true)
visit project_path(project)
end
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
end
it_behaves_like 'verified navigation bar'
context 'when packages are available' do
before do
stub_config(packages: { enabled: true }, registry: { enabled: false })
end
context 'when packages are available' do
context 'when container registry is available' do
before do
stub_config(packages: { enabled: true }, registry: { enabled: false })
visit project_path(project)
end
stub_config(registry: { enabled: true })
context 'when container registry is available' do
before do
stub_config(registry: { enabled: true })
insert_container_nav
insert_container_nav
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
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')]
}
insert_after_sub_nav_item(
_('Monitor'),
within: _('Settings'),
new_sub_nav_item_name: _('Packages & Registries')
)
visit project_path(project)
......@@ -118,75 +81,14 @@ RSpec.describe 'Project navbar' do
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
context 'when requirements is available' do
before do
stub_feature_flags(sidebar_refactor: true)
insert_package_nav(_('Monitor'))
insert_infrastructure_registry_nav
stub_licensed_features(requirements: true)
insert_after_nav_item(
_('Security & Compliance'),
_('Merge requests'),
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')
]
nav_item: _('Requirements'),
nav_sub_items: []
}
)
......@@ -194,23 +96,5 @@ RSpec.describe 'Project navbar' do
end
it_behaves_like 'verified navigation bar'
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: []
}
)
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
end
end
end
......@@ -23,32 +23,12 @@ RSpec.describe Sidebars::Projects::Menus::RequirementsMenu do
end
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
expect(subject.render?).to eq true
end
it 'does not contain any menu item' do
expect(subject.renderable_items).to be_empty
end
it 'returns true' do
expect(subject.render?).to eq true
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
it 'does not contain any menu item' do
expect(subject.renderable_items).to be_empty
end
end
end
......
......@@ -89,36 +89,10 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
allow(view).to receive(:current_user).and_return(user)
end
shared_examples 'has a link to the requirements page' do
specify do
render
expect(rendered).to have_link('Requirements', href: project_requirements_management_requirements_path(project))
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
it 'has a link to the requirements page' do
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
expect(rendered).to have_link('Requirements', href: project_requirements_management_requirements_path(project))
end
end
......
......@@ -6,8 +6,6 @@ module Sidebars
class DeploymentsMenu < ::Sidebars::Menu
override :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(environments_menu_item)
add_item(releases_menu_item)
......
......@@ -6,7 +6,6 @@ module Sidebars
class InfrastructureMenu < ::Sidebars::Menu
override :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)
add_item(kubernetes_menu_item)
......
......@@ -12,7 +12,6 @@ module Sidebars
add_item(list_menu_item)
add_item(boards_menu_item)
add_item(labels_menu_item)
add_item(service_desk_menu_item)
add_item(milestones_menu_item)
......@@ -97,19 +96,6 @@ module Sidebars
)
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
::Sidebars::MenuItem.new(
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
add_item(error_tracking_menu_item)
add_item(alert_management_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)
true
......@@ -36,18 +31,18 @@ module Sidebars
override :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
override :title
def title
Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? _('Monitor') : _('Operations')
_('Monitor')
end
override :sprite_icon
def sprite_icon
Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? 'monitor' : 'cloud-gear'
'monitor'
end
override :active_routes
......@@ -138,93 +133,6 @@ module Sidebars
)
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
if Feature.disabled?(:product_analytics, context.project) ||
!can?(context.current_user, :read_product_analytics, context.project)
......
......@@ -6,9 +6,7 @@ module Sidebars
class ProjectInformationMenu < ::Sidebars::Menu
override :configure_menu_items
def configure_menu_items
add_item(details_menu_item)
add_item(activity_menu_item)
add_item(releases_menu_item)
add_item(labels_menu_item)
add_item(members_menu_item)
......@@ -22,11 +20,7 @@ module Sidebars
override :extra_container_html_options
def extra_container_html_options
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
{ class: 'shortcuts-project-information' }
else
{ class: 'shortcuts-project rspec-project-link' }
end
{ class: 'shortcuts-project-information' }
end
override :extra_nav_link_html_options
......@@ -36,39 +30,16 @@ module Sidebars
override :title
def title
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
_('Project information')
else
_('Project overview')
end
_('Project information')
end
override :sprite_icon
def sprite_icon
if Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml)
'project'
else
'home'
end
'project'
end
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
::Sidebars::MenuItem.new(
title: _('Activity'),
......@@ -79,29 +50,7 @@ module Sidebars
)
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
if Feature.disabled?(: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),
......@@ -111,10 +60,6 @@ module Sidebars
end
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(
title: _('Members'),
link: project_project_members_path(context.project),
......
......@@ -21,8 +21,6 @@ module Sidebars
override :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'
}
......@@ -30,8 +28,6 @@ module Sidebars
override :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' }
end
......
......@@ -112,9 +112,8 @@ module Sidebars
return ::Sidebars::NilMenuItem.new(item_id: :monitor)
end
title = Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? _('Monitor') : _('Operations')
::Sidebars::MenuItem.new(
title: title,
title: _('Monitor'),
link: project_settings_operations_path(context.project),
active_routes: { path: 'operations#show' },
item_id: :monitor
......@@ -136,7 +135,6 @@ module Sidebars
def packages_and_registries_menu_item
if !Gitlab.config.registry.enabled ||
Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ||
!can?(context.current_user, :destroy_container_image, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :packages_and_registries)
end
......
......@@ -23,7 +23,6 @@ module Sidebars
add_menu(Sidebars::Projects::Menus::RepositoryMenu.new(context))
add_menu(Sidebars::Projects::Menus::IssuesMenu.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::CiCdMenu.new(context))
add_menu(Sidebars::Projects::Menus::SecurityComplianceMenu.new(context))
......@@ -35,7 +34,6 @@ module Sidebars
add_menu(confluence_or_wiki_menu)
add_menu(Sidebars::Projects::Menus::ExternalWikiMenu.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))
end
......
......@@ -15376,9 +15376,6 @@ msgstr ""
msgid "Group navigation"
msgstr ""
msgid "Group overview"
msgstr ""
msgid "Group overview content"
msgstr ""
......@@ -25262,9 +25259,6 @@ msgstr ""
msgid "Project description (optional)"
msgstr ""
msgid "Project details"
msgstr ""
msgid "Project does not exist or you don't have permission to perform this action"
msgstr ""
......@@ -25313,9 +25307,6 @@ msgstr ""
msgid "Project order will not be saved as local storage is not available."
msgstr ""
msgid "Project overview"
msgstr ""
msgid "Project path"
msgstr ""
......@@ -31071,9 +31062,6 @@ msgstr ""
msgid "Subgroup navigation"
msgstr ""
msgid "Subgroup overview"
msgstr ""
msgid "SubgroupCreationLevel|Allowed to create subgroups"
msgstr ""
......
......@@ -11,40 +11,6 @@ RSpec.describe 'Group navbar' do
let_it_be(:user) { create(:user) }
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
insert_package_nav(_('Kubernetes'))
......@@ -85,44 +51,4 @@ RSpec.describe 'Group navbar' do
it_behaves_like 'verified navigation bar'
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
......@@ -24,17 +24,6 @@ RSpec.describe 'Project active tab' do
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)
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
context 'on Project information' do
......@@ -80,11 +69,7 @@ RSpec.describe 'Project active tab' do
end
context 'on project Issues' do
let(:feature_flag_value) { true }
before do
stub_feature_flags(sidebar_refactor: feature_flag_value)
visit project_issues_path(project)
end
......@@ -98,21 +83,6 @@ RSpec.describe 'Project active tab' do
it_behaves_like 'page has active tab', 'Issues'
it_behaves_like 'page has active sub tab', 'Milestones'
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
context 'on project Merge Requests' 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-labels')
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
context "pipelines subtabs" do
......
......@@ -14,134 +14,54 @@ RSpec.describe 'Project navbar' do
before do
sign_in(user)
end
context 'when sidebar refactor feature flag is disabled' do
let(:project_context_nav_item) do
nil
end
stub_config(registry: { enabled: false })
insert_package_nav(_('Infrastructure'))
insert_infrastructure_registry_nav
end
it_behaves_like 'verified navigation bar' do
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 })
visit project_path(project)
end
end
it_behaves_like 'verified navigation bar' do
before do
visit project_path(project)
end
context 'when value stream is available' do
before do
visit project_path(project)
end
context 'when value stream is available' do
before do
visit project_path(project)
it 'redirects to value stream when Analytics item is clicked' do
page.within('.sidebar-top-level-items') do
find('.shortcuts-analytics').click
end
it 'redirects to value stream when Analytics item is clicked' do
page.within('.sidebar-top-level-items') do
find('.shortcuts-analytics').click
end
wait_for_requests
wait_for_requests
expect(page).to have_current_path(project_cycle_analytics_path(project))
end
end
context 'when pages are available' do
before do
stub_config(pages: { enabled: true })
insert_after_sub_nav_item(
_('Operations'),
within: _('Settings'),
new_sub_nav_item_name: _('Pages')
)
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
end
context 'when container registry is available' do
before do
stub_config(registry: { enabled: true })
insert_container_nav
visit project_path(project)
end
it_behaves_like 'verified navigation bar'
expect(page).to have_current_path(project_cycle_analytics_path(project))
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
context 'when pages are available' do
before do
stub_config(pages: { enabled: true })
let(:monitor_menu_items) do
[
_('Metrics'),
_('Logs'),
_('Tracing'),
_('Error Tracking'),
_('Alerts'),
_('Incidents'),
_('Product Analytics')
]
end
insert_after_sub_nav_item(
_('Monitor'),
within: _('Settings'),
new_sub_nav_item_name: _('Pages')
)
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Labels'),
_('Members')
]
}
visit project_path(project)
end
let(:settings_menu_items) do
[
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Monitor')
]
end
it_behaves_like 'verified navigation bar'
end
context 'when container registry is available' do
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(
......@@ -150,30 +70,6 @@ RSpec.describe 'Project navbar' do
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)
end
......
......@@ -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)
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
describe 'Settings > Monitor' do
......
......@@ -11,125 +11,105 @@ RSpec.describe 'Project > Settings > CI/CD > Container registry tag expiration p
let(:container_registry_enabled) { true }
let(:container_registry_enabled_on_project) { true }
shared_examples 'an expiration policy form' do
before do
project.update!(container_registry_enabled: container_registry_enabled_on_project)
project.container_expiration_policy.update!(enabled: true)
subject { visit project_settings_packages_and_registries_path(project) }
sign_in(user)
stub_container_registry_config(enabled: container_registry_enabled)
end
context 'as owner' do
it 'shows available section' do
subject
settings_block = find('[data-testid="registry-settings-app"]')
expect(settings_block).to have_text 'Clean up image tags'
end
before do
project.update!(container_registry_enabled: container_registry_enabled_on_project)
project.container_expiration_policy.update!(enabled: true)
it 'saves cleanup policy submit the form' do
subject
within '[data-testid="registry-settings-app"]' do
select('Every day', from: 'Run cleanup')
select('50 tags per image name', from: 'Keep the most recent:')
fill_in('Keep tags matching:', with: 'stable')
select('7 days', from: 'Remove tags older than:')
fill_in('Remove tags matching:', with: '.*-production')
submit_button = find('[data-testid="save-button"')
expect(submit_button).not_to be_disabled
submit_button.click
end
sign_in(user)
stub_container_registry_config(enabled: container_registry_enabled)
end
expect(find('.gl-toast')).to have_content('Cleanup policy successfully saved.')
end
context 'as owner' do
it 'shows available section' do
subject
it 'does not save cleanup policy submit form with invalid regex' do
subject
settings_block = find('[data-testid="registry-settings-app"]')
expect(settings_block).to have_text 'Clean up image tags'
end
within '[data-testid="registry-settings-app"]' do
fill_in('Remove tags matching:', with: '*-production')
it 'saves cleanup policy submit the form' do
subject
submit_button = find('[data-testid="save-button"')
expect(submit_button).not_to be_disabled
submit_button.click
end
within '[data-testid="registry-settings-app"]' do
select('Every day', from: 'Run cleanup')
select('50 tags per image name', from: 'Keep the most recent:')
fill_in('Keep tags matching:', with: 'stable')
select('7 days', from: 'Remove tags older than:')
fill_in('Remove tags matching:', with: '.*-production')
expect(find('.gl-toast')).to have_content('Something went wrong while updating the cleanup policy.')
submit_button = find('[data-testid="save-button"')
expect(submit_button).not_to be_disabled
submit_button.click
end
expect(find('.gl-toast')).to have_content('Cleanup policy successfully saved.')
end
context 'with a project without expiration policy' do
where(:application_setting, :feature_flag, :result) do
true | true | :available_section
true | false | :available_section
false | true | :available_section
false | false | :disabled_message
end
it 'does not save cleanup policy submit form with invalid regex' do
subject
with_them do
before do
project.container_expiration_policy.destroy!
stub_feature_flags(container_expiration_policies_historic_entry: false)
stub_application_setting(container_expiration_policies_enable_historic_entries: application_setting)
stub_feature_flags(container_expiration_policies_historic_entry: project) if feature_flag
end
within '[data-testid="registry-settings-app"]' do
fill_in('Remove tags matching:', with: '*-production')
it 'displays the expected result' do
subject
within '[data-testid="registry-settings-app"]' do
case result
when :available_section
expect(find('[data-testid="enable-toggle"]')).to have_content('Disabled - Tags will not be automatically deleted.')
when :disabled_message
expect(find('.gl-alert-title')).to have_content('Cleanup policy for tags is disabled')
end
end
end
submit_button = find('[data-testid="save-button"')
expect(submit_button).not_to be_disabled
submit_button.click
end
end
context 'when registry is disabled' do
let(:container_registry_enabled) { false }
it 'does not exists' do
subject
expect(find('.gl-toast')).to have_content('Something went wrong while updating the cleanup policy.')
end
end
expect(page).not_to have_selector('[data-testid="registry-settings-app"]')
end
context 'with a project without expiration policy' do
where(:application_setting, :feature_flag, :result) do
true | true | :available_section
true | false | :available_section
false | true | :available_section
false | false | :disabled_message
end
context 'when container registry is disabled on project' do
let(:container_registry_enabled_on_project) { false }
with_them do
before do
project.container_expiration_policy.destroy!
stub_feature_flags(container_expiration_policies_historic_entry: false)
stub_application_setting(container_expiration_policies_enable_historic_entries: application_setting)
stub_feature_flags(container_expiration_policies_historic_entry: project) if feature_flag
end
it 'does not exists' do
it 'displays the expected result' do
subject
expect(page).not_to have_selector('[data-testid="registry-settings-app"]')
within '[data-testid="registry-settings-app"]' do
case result
when :available_section
expect(find('[data-testid="enable-toggle"]')).to have_content('Disabled - Tags will not be automatically deleted.')
when :disabled_message
expect(find('.gl-alert-title')).to have_content('Cleanup policy for tags is disabled')
end
end
end
end
end
context 'with sidebar feature flag off' do
subject { visit project_settings_ci_cd_path(project) }
context 'when registry is disabled' do
let(:container_registry_enabled) { false }
before do
stub_feature_flags(sidebar_refactor: false)
end
it 'does not exists' do
subject
it_behaves_like 'an expiration policy form'
expect(page).not_to have_selector('[data-testid="registry-settings-app"]')
end
end
context 'with sidebar feature flag on' do
subject { visit project_settings_packages_and_registries_path(project) }
context 'when container registry is disabled on project' do
let(:container_registry_enabled_on_project) { false }
before do
stub_feature_flags(sidebar_refactor: true)
end
it 'does not exists' do
subject
it_behaves_like 'an expiration policy form'
expect(page).not_to have_selector('[data-testid="registry-settings-app"]')
end
end
end
......@@ -77,20 +77,6 @@ RSpec.describe 'User uses shortcuts', :js do
expect(page).to have_active_navigation(project.name)
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
find('body').native.send_key('g')
find('body').native.send_key('v')
......@@ -196,36 +182,6 @@ RSpec.describe 'User uses shortcuts', :js do
expect(page).to have_active_navigation('Monitor')
expect(page).to have_active_sub_navigation('Metrics')
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
context 'when navigating to the Infrastructure pages' do
......
......@@ -39,33 +39,22 @@ RSpec.describe Sidebars::Projects::Menus::DeploymentsMenu do
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
let(:item_id) { :feature_flags }
it_behaves_like 'access rights checks'
it_behaves_like 'feature flag :sidebar_refactor disabled'
end
describe 'Environments' do
let(:item_id) { :environments }
it_behaves_like 'access rights checks'
it_behaves_like 'feature flag :sidebar_refactor disabled'
end
describe 'Releases' do
let(:item_id) { :releases }
it_behaves_like 'access rights checks'
it_behaves_like 'feature flag :sidebar_refactor disabled'
end
end
end
......@@ -65,22 +65,4 @@ RSpec.describe Sidebars::Projects::Menus::IssuesMenu do
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
# 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
it 'returns "Monitor"' do
expect(subject.title).to eq 'Monitor'
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
describe '#extra_container_html_options' do
it 'returns "shortcuts-monitor"' do
expect(subject.extra_container_html_options).to eq(class: 'shortcuts-monitor')
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
describe '#link' do
......@@ -130,76 +114,6 @@ RSpec.describe Sidebars::Projects::Menus::MonitorMenu do
it_behaves_like 'access rights checks'
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
let(:item_id) { :product_analytics }
......
......@@ -12,77 +12,21 @@ RSpec.describe Sidebars::Projects::Menus::ProjectInformationMenu do
subject { described_class.new(context).container_html_options }
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
describe 'Menu Items' do
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
let(:item_id) { :labels }
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
describe 'Members' do
let(:item_id) { :members }
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
......@@ -11,13 +11,5 @@ RSpec.describe Sidebars::Projects::Menus::ScopeMenu do
subject { described_class.new(context).container_html_options }
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
......@@ -99,14 +99,6 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do
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
let(:user) { nil }
......@@ -159,14 +151,6 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do
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
let(:user) { nil }
......
# frozen_string_literal: true
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
{
nav_item: _('Security & Compliance'),
......@@ -24,64 +11,20 @@ RSpec.shared_context 'project navbar structure' do
}
end
let(:monitor_nav_item) 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_sub_items: [
_('Details'),
_('Activity'),
_('Releases')
]
}
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: "#{project.name[0, 1].upcase} #{project.name}",
nav_sub_items: []
},
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Labels'),
_('Members')
]
},
{
nav_item: _('Repository'),
nav_sub_items: [
......@@ -120,8 +63,44 @@ RSpec.shared_context 'project navbar structure' do
]
},
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_sub_items: []
......@@ -132,7 +111,15 @@ RSpec.shared_context 'project navbar structure' do
},
{
nav_item: _('Settings'),
nav_sub_items: settings_menu_items
nav_sub_items: [
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Monitor')
]
}
].compact
end
......@@ -189,17 +176,6 @@ RSpec.shared_context 'group navbar structure' do
}
end
let(:group_information_nav_item) do
{
nav_item: _('Group information'),
nav_sub_items: [
_('Activity'),
_('Labels'),
_('Members')
]
}
end
let(:issues_nav_items) do
[
_('List'),
......@@ -208,17 +184,20 @@ RSpec.shared_context 'group navbar structure' do
]
end
let(:group_context_nav_item) do
{
nav_item: "#{group.name[0, 1].upcase} #{group.name}",
nav_sub_items: []
}
end
let(:structure) do
[
group_context_nav_item,
group_information_nav_item,
{
nav_item: "#{group.name[0, 1].upcase} #{group.name}",
nav_sub_items: []
},
{
nav_item: _('Group information'),
nav_sub_items: [
_('Activity'),
_('Labels'),
_('Members')
]
},
{
nav_item: _('Issues'),
nav_sub_items: issues_nav_items
......@@ -227,7 +206,7 @@ RSpec.shared_context 'group navbar structure' do
nav_item: _('Merge requests'),
nav_sub_items: []
},
security_and_compliance_nav_item,
(security_and_compliance_nav_item if Gitlab.ee?),
(push_rules_nav_item if Gitlab.ee?),
{
nav_item: _('Kubernetes'),
......
......@@ -27,62 +27,11 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
expect(rendered).to have_link('Group information', href: activity_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
it 'has a link to the members page' do
render
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))
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
......@@ -36,38 +36,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
expect(rendered).to have_selector('[aria-label="Project information"]')
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 project path' do
render
expect(rendered).to have_link('Project overview', href: project_path(project), class: %w(shortcuts-project))
expect(rendered).to have_selector('[aria-label="Project overview"]')
end
end
describe 'Details' do
it 'does not have a link to the details menu' do
render
expect(rendered).not_to have_link('Details', href: project_path(project))
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
describe 'Activity' do
it 'has a link to the project activity path' do
render
......@@ -76,24 +44,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
describe 'Releases' do
it 'does not have a link to the project releases path' do
render
expect(rendered).not_to have_link('Releases', href: project_releases_path(project), class: 'shortcuts-project-releases')
end
context 'when feature flag :sidebar refactor is disabled' do
it 'has a link to the project releases path' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).to have_link('Releases', href: project_releases_path(project), class: 'shortcuts-project-releases')
end
end
end
describe 'Labels' do
let(:page) { Nokogiri::HTML.parse(rendered) }
......@@ -103,16 +53,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
expect(page.at_css('.shortcuts-project-information').parent.css('[aria-label="Labels"]')).not_to be_empty
expect(rendered).to have_link('Labels', href: project_labels_path(project))
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'does not have the labels menu item' do
stub_feature_flags(sidebar_refactor: false)
render
expect(page.at_css('.shortcuts-project').parent.css('[aria-label="Labels"]')).to be_empty
end
end
end
describe 'Members' do
......@@ -124,16 +64,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
expect(page.at_css('.shortcuts-project-information').parent.css('[aria-label="Members"]')).not_to be_empty
expect(rendered).to have_link('Members', href: project_project_members_path(project))
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'does not have a link to the members page' do
stub_feature_flags(sidebar_refactor: false)
render
expect(page.at_css('.shortcuts-project').parent.css('[aria-label="Members"]')).to be_empty
end
end
end
end
......@@ -243,27 +173,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
describe 'Labels' do
let(:page) { Nokogiri::HTML.parse(rendered) }
it 'does not have a link to the labels page' do
render
expect(page.at_css('.shortcuts-issues').parent.css('[aria-label="Labels"]')).to be_empty
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'has a link to the labels page' do
stub_feature_flags(sidebar_refactor: false)
render
expect(page.at_css('.shortcuts-issues').parent.css('[aria-label="Labels"]')).not_to be_empty
expect(rendered).to have_link('Labels', href: project_labels_path(project))
end
end
end
describe 'Service Desk' do
it 'has a link to the service desk path' do
render
......@@ -323,40 +232,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
describe 'Labels' do
it 'does not show the labels menu' do
project.project_feature.update!(issues_access_level: ProjectFeature::DISABLED)
render
expect(rendered).not_to have_link('Labels', href: project_labels_path(project), class: 'shortcuts-labels')
end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
context 'when issues are not enabled' do
it 'has a link to the labels path' do
project.project_feature.update!(issues_access_level: ProjectFeature::DISABLED)
render
expect(rendered).to have_link('Labels', href: project_labels_path(project), class: 'shortcuts-labels')
end
end
context 'when issues are enabled' do
it 'does not have a link to the labels path' do
render
expect(rendered).not_to have_link('Labels', href: project_labels_path(project), class: 'shortcuts-labels')
end
end
end
end
describe 'Merge Requests' do
it 'has a link to the merge request list path' do
render
......@@ -479,16 +354,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
expect(rendered).not_to have_link('Feature Flags')
end
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'does not have a Feature Flags menu item' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).not_to have_selector('.shortcuts-deployments')
end
end
end
describe 'Environments' do
......@@ -508,16 +373,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
expect(rendered).not_to have_link('Environments')
end
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'does not have a Environments menu item' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).not_to have_selector('.shortcuts-deployments')
end
end
end
describe 'Releases' do
......@@ -526,16 +381,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
expect(rendered).to have_link('Releases', href: project_releases_path(project), class: 'shortcuts-deployments-releases')
end
context 'when feature flag :sidebar refactor is disabled' do
it 'does not have a link to the project releases path' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).not_to have_link('Releases', href: project_releases_path(project), class: 'shortcuts-deployments-releases')
end
end
end
end
......@@ -662,141 +507,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
describe 'Serverless' do
it 'has a link to the serverless page' do
render
page = Nokogiri::HTML.parse(rendered)
expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Serverless"]')).not_to be_empty
expect(rendered).to have_link('Serverless', href: project_serverless_functions_path(project))
end
describe 'when the user does not have access' do
let(:user) { nil }
it 'does not have a link to the serverless page' do
render
expect(rendered).not_to have_link('Serverless')
end
end
end
describe 'Terraform' do
it 'has a link to the terraform page' do
render
page = Nokogiri::HTML.parse(rendered)
expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Terraform"]')).not_to be_empty
expect(rendered).to have_link('Terraform', href: project_terraform_index_path(project))
end
describe 'when the user does not have access' do
let(:user) { nil }
it 'does not have a link to the terraform page' do
render
expect(rendered).not_to have_link('Terraform')
end
end
end
describe 'Kubernetes' do
it 'has a link to the kubernetes page' do
render
page = Nokogiri::HTML.parse(rendered)
expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Kubernetes"]')).not_to be_empty
expect(rendered).to have_link('Kubernetes', href: project_clusters_path(project))
end
describe 'when the user does not have access' do
let(:user) { nil }
it 'does not have a link to the kubernetes page' do
render
expect(rendered).not_to have_link('Kubernetes')
end
end
end
end
describe 'Environments' do
let(:page) { Nokogiri::HTML.parse(rendered) }
it 'does not have a link to the environments page' do
render
expect(page.at_css('.shortcuts-monitor').parent.css('[aria-label="Environments"]')).to be_empty
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 environments page' do
render
expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Environments"]')).not_to be_empty
expect(rendered).to have_link('Environments', href: project_environments_path(project))
end
describe 'when the user does not have access' do
let(:user) { nil }
it 'does not have a link to the environments page' do
render
expect(rendered).not_to have_link('Environments')
end
end
end
end
describe 'Feature Flags' do
let(:page) { Nokogiri::HTML.parse(rendered) }
it 'does not have a link to the feature flags page' do
render
expect(page.at_css('.shortcuts-monitor').parent.css('[aria-label="Feature Flags"]')).to be_empty
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 feature flags page' do
render
expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Feature Flags"]')).not_to be_empty
expect(rendered).to have_link('Feature Flags', href: project_feature_flags_path(project))
end
describe 'when the user does not have access' do
let(:user) { nil }
it 'does not have a link to the feature flags page' do
render
expect(rendered).not_to have_link('Feature Flags')
end
end
end
end
describe 'Product Analytics' do
it 'has a link to the product analytics page' do
render
......@@ -1104,35 +814,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
describe 'Members' do
it 'does not show the Member menu item' do
expect(rendered).not_to have_selector('.sidebar-top-level-items > li > a[aria-label="Members"]')
end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
render
end
context 'when user can access members' do
it 'show Members link' do
expect(rendered).to have_selector('.sidebar-top-level-items > li > a[aria-label="Members"]')
expect(rendered).to have_link('Members', href: project_project_members_path(project))
end
end
context 'when user cannot access members' do
let(:user) { nil }
it 'show Members link' do
expect(rendered).not_to have_link('Members')
end
end
end
end
describe 'Settings' do
describe 'General' do
it 'has a link to the General settings' do
......@@ -1275,16 +956,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
expect(rendered).to have_link('Packages & Registries', href: project_settings_packages_and_registries_path(project))
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'does not have a link to the Packages & Registries settings' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).not_to have_link('Packages & Registries', href: project_settings_packages_and_registries_path(project))
end
end
end
context 'when registry is not enabled' do
......@@ -1345,15 +1016,5 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
expect(rendered).not_to have_selector('.sidebar-sub-level-items > li.fly-out-top-item > a')
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'renders the collapsed top menu as a link' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).to have_selector('.sidebar-sub-level-items > li.fly-out-top-item > a')
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