2021-10-27 15:23:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Sidebars
|
|
|
|
module Groups
|
|
|
|
module Menus
|
|
|
|
class CiCdMenu < ::Sidebars::Menu
|
|
|
|
override :configure_menu_items
|
|
|
|
def configure_menu_items
|
|
|
|
add_item(runners_menu_item)
|
|
|
|
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
override :title
|
|
|
|
def title
|
|
|
|
_('CI/CD')
|
|
|
|
end
|
|
|
|
|
|
|
|
override :sprite_icon
|
|
|
|
def sprite_icon
|
|
|
|
'rocket'
|
|
|
|
end
|
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
override :serialize_as_menu_item_args
|
|
|
|
def serialize_as_menu_item_args
|
|
|
|
nil
|
2023-05-27 22:25:52 +05:30
|
|
|
end
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
private
|
|
|
|
|
|
|
|
def runners_menu_item
|
|
|
|
return ::Sidebars::NilMenuItem.new(item_id: :runners) unless show_runners?
|
|
|
|
|
|
|
|
::Sidebars::MenuItem.new(
|
|
|
|
title: _('Runners'),
|
|
|
|
link: group_runners_path(context.group),
|
2023-06-20 00:43:36 +05:30
|
|
|
super_sidebar_parent: ::Sidebars::Groups::SuperSidebarMenus::BuildMenu,
|
2022-05-07 20:08:51 +05:30
|
|
|
active_routes: { controller: 'groups/runners' },
|
2021-10-27 15:23:28 +05:30
|
|
|
item_id: :runners
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def show_runners?
|
2022-07-16 23:28:13 +05:30
|
|
|
can?(context.current_user, :read_group_runners, context.group)
|
2021-10-27 15:23:28 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|