diff options
Diffstat (limited to 'lib/sidebars')
-rw-r--r-- | lib/sidebars/concerns/work_item_hierarchy.rb | 26 | ||||
-rw-r--r-- | lib/sidebars/groups/menus/ci_cd_menu.rb | 2 | ||||
-rw-r--r-- | lib/sidebars/groups/menus/customer_relations_menu.rb | 2 | ||||
-rw-r--r-- | lib/sidebars/groups/menus/kubernetes_menu.rb | 5 | ||||
-rw-r--r-- | lib/sidebars/groups/menus/packages_registries_menu.rb | 13 | ||||
-rw-r--r-- | lib/sidebars/groups/menus/settings_menu.rb | 8 | ||||
-rw-r--r-- | lib/sidebars/menu.rb | 1 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/infrastructure_menu.rb | 4 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/packages_registries_menu.rb | 13 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/project_information_menu.rb | 3 |
10 files changed, 41 insertions, 36 deletions
diff --git a/lib/sidebars/concerns/work_item_hierarchy.rb b/lib/sidebars/concerns/work_item_hierarchy.rb deleted file mode 100644 index a4153bb5120..00000000000 --- a/lib/sidebars/concerns/work_item_hierarchy.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -# This module has the necessary methods to render -# work items hierarchy menu -module Sidebars - module Concerns - module WorkItemHierarchy - def hierarchy_menu_item(container, url, path) - unless show_hierarachy_menu_item?(container) - return ::Sidebars::NilMenuItem.new(item_id: :hierarchy) - end - - ::Sidebars::MenuItem.new( - title: _('Planning hierarchy'), - link: url, - active_routes: { path: path }, - item_id: :hierarchy - ) - end - - def show_hierarachy_menu_item?(container) - can?(context.current_user, :read_planning_hierarchy, container) - end - end - end -end diff --git a/lib/sidebars/groups/menus/ci_cd_menu.rb b/lib/sidebars/groups/menus/ci_cd_menu.rb index a1f98b918e6..c1d80458f49 100644 --- a/lib/sidebars/groups/menus/ci_cd_menu.rb +++ b/lib/sidebars/groups/menus/ci_cd_menu.rb @@ -29,7 +29,7 @@ module Sidebars ::Sidebars::MenuItem.new( title: _('Runners'), link: group_runners_path(context.group), - active_routes: { path: 'groups/runners#index' }, + active_routes: { controller: 'groups/runners' }, item_id: :runners ) end diff --git a/lib/sidebars/groups/menus/customer_relations_menu.rb b/lib/sidebars/groups/menus/customer_relations_menu.rb index 002197965d1..0aaa6ec45f1 100644 --- a/lib/sidebars/groups/menus/customer_relations_menu.rb +++ b/lib/sidebars/groups/menus/customer_relations_menu.rb @@ -24,6 +24,8 @@ module Sidebars override :render? def render? + return false unless context.group.root? + can_read_contact? || can_read_organization? end diff --git a/lib/sidebars/groups/menus/kubernetes_menu.rb b/lib/sidebars/groups/menus/kubernetes_menu.rb index 4ea294a4837..98ca7865995 100644 --- a/lib/sidebars/groups/menus/kubernetes_menu.rb +++ b/lib/sidebars/groups/menus/kubernetes_menu.rb @@ -21,7 +21,10 @@ module Sidebars override :render? def render? - can?(context.current_user, :read_cluster, context.group) + clusterable = context.group + + Feature.enabled?(:certificate_based_clusters, clusterable, default_enabled: :yaml, type: :ops) && + can?(context.current_user, :read_cluster, clusterable) end override :extra_container_html_options diff --git a/lib/sidebars/groups/menus/packages_registries_menu.rb b/lib/sidebars/groups/menus/packages_registries_menu.rb index 60d91c8fd10..4c21845ef18 100644 --- a/lib/sidebars/groups/menus/packages_registries_menu.rb +++ b/lib/sidebars/groups/menus/packages_registries_menu.rb @@ -8,8 +8,8 @@ module Sidebars def configure_menu_items add_item(packages_registry_menu_item) add_item(container_registry_menu_item) + add_item(harbor_registry__menu_item) add_item(dependency_proxy_menu_item) - true end @@ -49,6 +49,17 @@ module Sidebars ) end + def harbor_registry__menu_item + return nil_menu_item(:harbor_registry) if Feature.disabled?(:harbor_registry_integration) + + ::Sidebars::MenuItem.new( + title: _('Harbor Registry'), + link: group_harbor_registries_path(context.group), + active_routes: { controller: 'groups/harbor/repositories' }, + item_id: :harbor_registry + ) + end + def dependency_proxy_menu_item setting_does_not_exist_or_is_enabled = !context.group.dependency_proxy_setting || context.group.dependency_proxy_setting.enabled diff --git a/lib/sidebars/groups/menus/settings_menu.rb b/lib/sidebars/groups/menus/settings_menu.rb index 810b467ed2d..09226256476 100644 --- a/lib/sidebars/groups/menus/settings_menu.rb +++ b/lib/sidebars/groups/menus/settings_menu.rb @@ -89,10 +89,16 @@ module Sidebars end def ci_cd_menu_item + active_routes_path = if Feature.enabled?(:runner_list_group_view_vue_ui, context.group, default_enabled: :yaml) + 'ci_cd#show' + else + %w[ci_cd#show groups/runners#show groups/runners#edit] + end + ::Sidebars::MenuItem.new( title: _('CI/CD'), link: group_settings_ci_cd_path(context.group), - active_routes: { path: %w[ci_cd#show groups/runners#show groups/runners#edit] }, + active_routes: { path: active_routes_path }, item_id: :ci_cd ) end diff --git a/lib/sidebars/menu.rb b/lib/sidebars/menu.rb index 1af3d024291..d9d294ff982 100644 --- a/lib/sidebars/menu.rb +++ b/lib/sidebars/menu.rb @@ -15,6 +15,7 @@ module Sidebars include ::Sidebars::Concerns::HasPartial attr_reader :context + delegate :current_user, :container, to: :@context def initialize(context) diff --git a/lib/sidebars/projects/menus/infrastructure_menu.rb b/lib/sidebars/projects/menus/infrastructure_menu.rb index 060a5be5f57..c012b3bb627 100644 --- a/lib/sidebars/projects/menus/infrastructure_menu.rb +++ b/lib/sidebars/projects/menus/infrastructure_menu.rb @@ -64,7 +64,7 @@ module Sidebars end def serverless_menu_item - unless can?(context.current_user, :read_cluster, context.project) + unless Feature.enabled?(:deprecated_serverless, context.project, default_enabled: :yaml, type: :ops) && can?(context.current_user, :read_cluster, context.project) return ::Sidebars::NilMenuItem.new(item_id: :serverless) end @@ -100,7 +100,7 @@ module Sidebars ::Sidebars::MenuItem.new( title: _('Google Cloud'), link: project_google_cloud_index_path(context.project), - active_routes: { controller: [:google_cloud, :service_accounts, :deployments] }, + active_routes: { controller: [:google_cloud, :service_accounts, :deployments, :gcp_regions] }, item_id: :google_cloud ) end diff --git a/lib/sidebars/projects/menus/packages_registries_menu.rb b/lib/sidebars/projects/menus/packages_registries_menu.rb index f5f0da2992e..77f09986b19 100644 --- a/lib/sidebars/projects/menus/packages_registries_menu.rb +++ b/lib/sidebars/projects/menus/packages_registries_menu.rb @@ -9,7 +9,7 @@ module Sidebars add_item(packages_registry_menu_item) add_item(container_registry_menu_item) add_item(infrastructure_registry_menu_item) - + add_item(harbor_registry__menu_item) true end @@ -65,6 +65,17 @@ module Sidebars ) end + def harbor_registry__menu_item + return ::Sidebars::NilMenuItem.new(item_id: :harbor_registry) if Feature.disabled?(:harbor_registry_integration) + + ::Sidebars::MenuItem.new( + title: _('Harbor Registry'), + link: project_harbor_registry_index_path(context.project), + active_routes: { controller: :harbor_registry }, + item_id: :harbor_registry + ) + end + def packages_registry_disabled? !::Gitlab.config.packages.enabled || !can?(context.current_user, :read_package, context.project) end diff --git a/lib/sidebars/projects/menus/project_information_menu.rb b/lib/sidebars/projects/menus/project_information_menu.rb index 4056d50d324..44b94ee3522 100644 --- a/lib/sidebars/projects/menus/project_information_menu.rb +++ b/lib/sidebars/projects/menus/project_information_menu.rb @@ -4,13 +4,10 @@ module Sidebars module Projects module Menus class ProjectInformationMenu < ::Sidebars::Menu - include ::Sidebars::Concerns::WorkItemHierarchy - override :configure_menu_items def configure_menu_items add_item(activity_menu_item) add_item(labels_menu_item) - add_item(hierarchy_menu_item(context.project, project_planning_hierarchy_path(context.project), 'projects#planning_hierarchy')) add_item(members_menu_item) true |