diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /lib/sidebars/projects/menus | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'lib/sidebars/projects/menus')
-rw-r--r-- | lib/sidebars/projects/menus/analytics_menu.rb | 2 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/deployments_menu.rb | 2 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/infrastructure_menu.rb | 3 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/issues_menu.rb | 14 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/labels_menu.rb | 50 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/members_menu.rb | 43 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/monitor_menu.rb | 104 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/project_information_menu.rb | 57 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/scope_menu.rb | 4 | ||||
-rw-r--r-- | lib/sidebars/projects/menus/settings_menu.rb | 4 |
10 files changed, 12 insertions, 271 deletions
diff --git a/lib/sidebars/projects/menus/analytics_menu.rb b/lib/sidebars/projects/menus/analytics_menu.rb index 660965005c3..9f366a19e90 100644 --- a/lib/sidebars/projects/menus/analytics_menu.rb +++ b/lib/sidebars/projects/menus/analytics_menu.rb @@ -79,7 +79,7 @@ module Sidebars end ::Sidebars::MenuItem.new( - title: _('Value Stream'), + title: _('Value stream'), link: project_cycle_analytics_path(context.project), container_html_options: { class: 'shortcuts-project-cycle-analytics' }, active_routes: { path: 'cycle_analytics#show' }, diff --git a/lib/sidebars/projects/menus/deployments_menu.rb b/lib/sidebars/projects/menus/deployments_menu.rb index f3d13e12258..fa6482562e8 100644 --- a/lib/sidebars/projects/menus/deployments_menu.rb +++ b/lib/sidebars/projects/menus/deployments_menu.rb @@ -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) diff --git a/lib/sidebars/projects/menus/infrastructure_menu.rb b/lib/sidebars/projects/menus/infrastructure_menu.rb index 8cf7abc613c..aad1ce60d0e 100644 --- a/lib/sidebars/projects/menus/infrastructure_menu.rb +++ b/lib/sidebars/projects/menus/infrastructure_menu.rb @@ -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) @@ -18,7 +17,7 @@ module Sidebars override :link def link - project_clusters_path(context.project) + renderable_items.first.link end override :extra_container_html_options diff --git a/lib/sidebars/projects/menus/issues_menu.rb b/lib/sidebars/projects/menus/issues_menu.rb index 79603803b8f..fd57f21db88 100644 --- a/lib/sidebars/projects/menus/issues_menu.rb +++ b/lib/sidebars/projects/menus/issues_menu.rb @@ -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'), diff --git a/lib/sidebars/projects/menus/labels_menu.rb b/lib/sidebars/projects/menus/labels_menu.rb deleted file mode 100644 index 7cb28ababdb..00000000000 --- a/lib/sidebars/projects/menus/labels_menu.rb +++ /dev/null @@ -1,50 +0,0 @@ -# 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 diff --git a/lib/sidebars/projects/menus/members_menu.rb b/lib/sidebars/projects/menus/members_menu.rb deleted file mode 100644 index 498bfa74261..00000000000 --- a/lib/sidebars/projects/menus/members_menu.rb +++ /dev/null @@ -1,43 +0,0 @@ -# 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 diff --git a/lib/sidebars/projects/menus/monitor_menu.rb b/lib/sidebars/projects/menus/monitor_menu.rb index 8ebdacc7c7e..0d7e0776d5b 100644 --- a/lib/sidebars/projects/menus/monitor_menu.rb +++ b/lib/sidebars/projects/menus/monitor_menu.rb @@ -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 @@ -26,28 +21,24 @@ module Sidebars override :link def link - if can?(context.current_user, :read_environment, context.project) - metrics_project_environments_path(context.project) - else - project_feature_flags_path(context.project) - end + renderable_items.first&.link end 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 +129,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) diff --git a/lib/sidebars/projects/menus/project_information_menu.rb b/lib/sidebars/projects/menus/project_information_menu.rb index c148e7cf931..a5f06ebea20 100644 --- a/lib/sidebars/projects/menus/project_information_menu.rb +++ b/lib/sidebars/projects/menus/project_information_menu.rb @@ -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,26 +50,8 @@ 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) + unless can?(context.current_user, :read_label, context.project) return ::Sidebars::NilMenuItem.new(item_id: :labels) end @@ -111,7 +64,7 @@ module Sidebars end def members_menu_item - if Feature.disabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) + unless can?(context.current_user, :read_project_member, context.project) return ::Sidebars::NilMenuItem.new(item_id: :members) end diff --git a/lib/sidebars/projects/menus/scope_menu.rb b/lib/sidebars/projects/menus/scope_menu.rb index 1cd0218d4ac..539912aa77b 100644 --- a/lib/sidebars/projects/menus/scope_menu.rb +++ b/lib/sidebars/projects/menus/scope_menu.rb @@ -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 diff --git a/lib/sidebars/projects/menus/settings_menu.rb b/lib/sidebars/projects/menus/settings_menu.rb index c9d7e736b21..250143df649 100644 --- a/lib/sidebars/projects/menus/settings_menu.rb +++ b/lib/sidebars/projects/menus/settings_menu.rb @@ -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 |