2021-07-30 17:10:15 -04:00
|
|
|
# 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
|
|
|
|
|
|
|
|
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),
|
2022-02-20 22:18:12 -05:00
|
|
|
active_routes: { controller: 'groups/runners' },
|
2021-07-30 17:10:15 -04:00
|
|
|
item_id: :runners
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def show_runners?
|
2022-04-22 14:09:22 -04:00
|
|
|
can?(context.current_user, :read_group_runners, context.group)
|
2021-07-30 17:10:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|