From 20608aae406091dfc7cd8304de7f0f7f1effd7dc Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 30 Jan 2025 12:16:51 -0700 Subject: [PATCH 1/2] Add import history to your work nav bar Changelog: changed --- .../your_work/menus/import_history_menu.rb | 36 +++++++++++++++++++ lib/sidebars/your_work/panel.rb | 1 + .../navbar_structure_context.rb | 4 +++ 3 files changed, 41 insertions(+) create mode 100644 lib/sidebars/your_work/menus/import_history_menu.rb diff --git a/lib/sidebars/your_work/menus/import_history_menu.rb b/lib/sidebars/your_work/menus/import_history_menu.rb new file mode 100644 index 00000000000000..92caee67a14a92 --- /dev/null +++ b/lib/sidebars/your_work/menus/import_history_menu.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# rubocop:disable Gitlab/BoundedContexts -- disabling this to match current structure of other sidebar menu items (.rubocop_todo/gitlab/bounded_contexts.yml) +module Sidebars + module YourWork + module Menus + class ImportHistoryMenu < ::Sidebars::Menu + override :link + def link + history_import_bulk_imports_path + end + + override :title + def title + _('Import history') + end + + override :sprite_icon + def sprite_icon + 'cloud-gear' + end + + override :render? + def render? + !!context.current_user + end + + override :active_routes + def active_routes + { controller: ['import/bulk_imports', 'import/history'] } + end + end + end + end +end +# rubocop:enable Gitlab/BoundedContexts diff --git a/lib/sidebars/your_work/panel.rb b/lib/sidebars/your_work/panel.rb index d1297fb439db9d..06c81c162818ce 100644 --- a/lib/sidebars/your_work/panel.rb +++ b/lib/sidebars/your_work/panel.rb @@ -32,6 +32,7 @@ def add_menus add_menu(Sidebars::YourWork::Menus::MilestonesMenu.new(context)) add_menu(Sidebars::YourWork::Menus::SnippetsMenu.new(context)) add_menu(Sidebars::YourWork::Menus::ActivityMenu.new(context)) + add_menu(Sidebars::YourWork::Menus::ImportHistoryMenu.new(context)) end end end diff --git a/spec/support/shared_contexts/navbar_structure_context.rb b/spec/support/shared_contexts/navbar_structure_context.rb index c5920d6e74ede5..15aa7db0045937 100644 --- a/spec/support/shared_contexts/navbar_structure_context.rb +++ b/spec/support/shared_contexts/navbar_structure_context.rb @@ -248,6 +248,10 @@ { nav_item: _("Activity"), nav_sub_items: [] + }, + { + nav_item: _("Import history"), + nav_sub_items: [] } ] end -- GitLab From 7c82f2436724753396277a9c5c143d40345fd87f Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 3 Feb 2025 10:18:10 -0700 Subject: [PATCH 2/2] Add github details path --- ee/spec/features/dashboard/navbar_spec.rb | 4 ++-- lib/sidebars/your_work/menus/import_history_menu.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ee/spec/features/dashboard/navbar_spec.rb b/ee/spec/features/dashboard/navbar_spec.rb index 2c476e736f38f4..a19c2865c7cb05 100644 --- a/ee/spec/features/dashboard/navbar_spec.rb +++ b/ee/spec/features/dashboard/navbar_spec.rb @@ -15,7 +15,7 @@ sign_in(user) insert_after_nav_item( - _('Activity'), + _('Import history'), new_nav_item: { nav_item: _("Environments"), nav_sub_items: [] @@ -41,7 +41,7 @@ sign_in(user) insert_after_nav_item( - _('Activity'), + _('Import history'), new_nav_item: { nav_item: _("Security"), nav_sub_items: [ diff --git a/lib/sidebars/your_work/menus/import_history_menu.rb b/lib/sidebars/your_work/menus/import_history_menu.rb index 92caee67a14a92..0e04be86d910c2 100644 --- a/lib/sidebars/your_work/menus/import_history_menu.rb +++ b/lib/sidebars/your_work/menus/import_history_menu.rb @@ -27,7 +27,7 @@ def render? override :active_routes def active_routes - { controller: ['import/bulk_imports', 'import/history'] } + { controller: ['import/bulk_imports', 'import/history'], path: 'import/github#details' } end end end -- GitLab