diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /lib/sidebars/projects | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'lib/sidebars/projects')
-rw-r--r-- | lib/sidebars/projects/menus/infrastructure_menu.rb | 12 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/learn_gitlab_menu.rb | 4 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/merge_requests_menu.rb | 4 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/monitor_menu.rb | 10 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/packages_registries_menu.rb | 9 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/settings_menu.rb | 16 | ||||
-rw-r--r-- | lib/sidebars/projects/panel.rb | 3 |
7 files changed, 40 insertions, 18 deletions
diff --git a/lib/sidebars/projects/menus/infrastructure_menu.rb b/lib/sidebars/projects/menus/infrastructure_menu.rb index 1c04a7b117d..63eea0ea500 100644 --- a/lib/sidebars/projects/menus/infrastructure_menu.rb +++ b/lib/sidebars/projects/menus/infrastructure_menu.rb @@ -54,12 +54,12 @@ module Sidebars { disabled: true, data: { trigger: 'manual', - container: 'body', - placement: 'right', - highlight: Users::CalloutsHelper::GKE_CLUSTER_INTEGRATION, - highlight_priority: Users::Callout.feature_names[:GKE_CLUSTER_INTEGRATION], - dismiss_endpoint: callouts_path, - auto_devops_help_path: help_page_path('topics/autodevops/index.md') } } + container: 'body', + placement: 'right', + highlight: Users::CalloutsHelper::GKE_CLUSTER_INTEGRATION, + highlight_priority: Users::Callout.feature_names[:GKE_CLUSTER_INTEGRATION], + dismiss_endpoint: callouts_path, + auto_devops_help_path: help_page_path('topics/autodevops/index.md') } } end def terraform_menu_item diff --git a/lib/sidebars/projects/menus/learn_gitlab_menu.rb b/lib/sidebars/projects/menus/learn_gitlab_menu.rb index d2bc2fa0681..b6fae2af93d 100644 --- a/lib/sidebars/projects/menus/learn_gitlab_menu.rb +++ b/lib/sidebars/projects/menus/learn_gitlab_menu.rb @@ -29,10 +29,10 @@ module Sidebars override :pill_count def pill_count strong_memoize(:pill_count) do - percentage = LearnGitlab::Onboarding.new( + percentage = Onboarding::Completion.new( context.project.namespace, context.current_user - ).completed_percentage + ).percentage "#{percentage}%" end diff --git a/lib/sidebars/projects/menus/merge_requests_menu.rb b/lib/sidebars/projects/menus/merge_requests_menu.rb index fe501667d37..3e543872d36 100644 --- a/lib/sidebars/projects/menus/merge_requests_menu.rb +++ b/lib/sidebars/projects/menus/merge_requests_menu.rb @@ -59,9 +59,9 @@ module Sidebars override :active_routes def active_routes if context.project.issues_enabled? - { controller: :merge_requests } + { controller: 'projects/merge_requests' } else - { controller: [:merge_requests, :milestones] } + { controller: ['projects/merge_requests', :milestones] } end end end diff --git a/lib/sidebars/projects/menus/monitor_menu.rb b/lib/sidebars/projects/menus/monitor_menu.rb index 23e1a95c401..ecd062f333e 100644 --- a/lib/sidebars/projects/menus/monitor_menu.rb +++ b/lib/sidebars/projects/menus/monitor_menu.rb @@ -6,7 +6,7 @@ module Sidebars class MonitorMenu < ::Sidebars::Menu override :configure_menu_items def configure_menu_items - return false unless context.project.feature_available?(:operations, context.current_user) + return false unless feature_enabled? add_item(metrics_dashboard_menu_item) add_item(error_tracking_menu_item) @@ -41,6 +41,14 @@ module Sidebars private + def feature_enabled? + if ::Feature.enabled?(:split_operations_visibility_permissions, context.project) + context.project.feature_available?(:monitor, context.current_user) + else + context.project.feature_available?(:operations, context.current_user) + end + end + def metrics_dashboard_menu_item unless can?(context.current_user, :metrics_dashboard, context.project) return ::Sidebars::NilMenuItem.new(item_id: :metrics) diff --git a/lib/sidebars/projects/menus/packages_registries_menu.rb b/lib/sidebars/projects/menus/packages_registries_menu.rb index 914368e6fec..2ddffe42899 100644 --- a/lib/sidebars/projects/menus/packages_registries_menu.rb +++ b/lib/sidebars/projects/menus/packages_registries_menu.rb @@ -15,7 +15,7 @@ module Sidebars override :title def title - _('Packages & Registries') + _('Packages and registries') end override :sprite_icon @@ -66,7 +66,9 @@ module Sidebars end def harbor_registry__menu_item - return ::Sidebars::NilMenuItem.new(item_id: :harbor_registry) if Feature.disabled?(:harbor_registry_integration) + if Feature.disabled?(:harbor_registry_integration, context.project) || context.project.harbor_integration.nil? + return ::Sidebars::NilMenuItem.new(item_id: :harbor_registry) + end ::Sidebars::MenuItem.new( title: _('Harbor Registry'), @@ -77,7 +79,8 @@ module Sidebars end def packages_registry_disabled? - !::Gitlab.config.packages.enabled || !can?(context.current_user, :read_package, context.project) + !::Gitlab.config.packages.enabled || + !can?(context.current_user, :read_package, context.project&.packages_policy_subject) end end end diff --git a/lib/sidebars/projects/menus/settings_menu.rb b/lib/sidebars/projects/menus/settings_menu.rb index 85931e63ebc..11d5f4d59c7 100644 --- a/lib/sidebars/projects/menus/settings_menu.rb +++ b/lib/sidebars/projects/menus/settings_menu.rb @@ -13,6 +13,7 @@ module Sidebars add_item(webhooks_menu_item) add_item(access_tokens_menu_item) add_item(repository_menu_item) + add_item(merge_requests_menu_item) add_item(ci_cd_menu_item) add_item(packages_and_registries_menu_item) add_item(pages_menu_item) @@ -109,9 +110,9 @@ module Sidebars end ::Sidebars::MenuItem.new( - title: _('Packages & Registries'), + title: _('Packages and registries'), link: project_settings_packages_and_registries_path(context.project), - active_routes: { path: 'packages_and_registries#show' }, + active_routes: { controller: :packages_and_registries }, item_id: :packages_and_registries ) end @@ -150,6 +151,17 @@ module Sidebars item_id: :usage_quotas ) end + + def merge_requests_menu_item + return unless context.project.merge_requests_enabled? + + ::Sidebars::MenuItem.new( + title: _('Merge requests'), + link: project_settings_merge_requests_path(context.project), + active_routes: { path: 'projects/settings/merge_requests#show' }, + item_id: :merge_requests + ) + end end end end diff --git a/lib/sidebars/projects/panel.rb b/lib/sidebars/projects/panel.rb index 1af8e14f034..8ae8f931aab 100644 --- a/lib/sidebars/projects/panel.rb +++ b/lib/sidebars/projects/panel.rb @@ -51,8 +51,7 @@ module Sidebars end def third_party_wiki_menu - wiki_menu_list = [::Sidebars::Projects::Menus::ConfluenceMenu] - wiki_menu_list << ::Sidebars::Projects::Menus::ShimoMenu if Feature.enabled?(:shimo_integration, context.project) + wiki_menu_list = [::Sidebars::Projects::Menus::ConfluenceMenu, ::Sidebars::Projects::Menus::ShimoMenu] wiki_menu_list.find { |wiki_menu| wiki_menu.new(context).render? } end |