2022-10-11 01:57:18 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Sidebars
|
|
|
|
module Groups
|
|
|
|
module Menus
|
|
|
|
class ObservabilityMenu < ::Sidebars::Menu
|
2023-01-13 00:05:48 +05:30
|
|
|
override :configure_menu_items
|
|
|
|
def configure_menu_items
|
|
|
|
add_item(explore_menu_item)
|
2023-03-17 16:20:25 +05:30
|
|
|
add_item(datasources_menu_item)
|
2022-10-11 01:57:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
override :title
|
|
|
|
def title
|
|
|
|
_('Observability')
|
|
|
|
end
|
|
|
|
|
|
|
|
override :sprite_icon
|
|
|
|
def sprite_icon
|
|
|
|
'monitor'
|
|
|
|
end
|
|
|
|
|
|
|
|
override :render?
|
|
|
|
def render?
|
2023-03-17 16:20:25 +05:30
|
|
|
Gitlab::Observability.observability_enabled?(context.current_user, context.group)
|
2022-10-11 01:57:18 +05:30
|
|
|
end
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
private
|
|
|
|
|
|
|
|
def dashboards_menu_item
|
|
|
|
::Sidebars::MenuItem.new(
|
2023-03-17 16:20:25 +05:30
|
|
|
title: s_('Observability|Dashboards'),
|
2023-01-13 00:05:48 +05:30
|
|
|
link: group_observability_dashboards_path(context.group),
|
|
|
|
active_routes: { path: 'groups/observability#dashboards' },
|
|
|
|
item_id: :dashboards
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def explore_menu_item
|
|
|
|
::Sidebars::MenuItem.new(
|
2023-03-17 16:20:25 +05:30
|
|
|
title: s_('Observability|Explore telemetry data'),
|
2023-01-13 00:05:48 +05:30
|
|
|
link: group_observability_explore_path(context.group),
|
|
|
|
active_routes: { path: 'groups/observability#explore' },
|
|
|
|
item_id: :explore
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2023-03-17 16:20:25 +05:30
|
|
|
def datasources_menu_item
|
|
|
|
::Sidebars::MenuItem.new(
|
|
|
|
title: s_('Observability|Data sources'),
|
|
|
|
link: group_observability_datasources_path(context.group),
|
|
|
|
active_routes: { path: 'groups/observability#datasources' },
|
|
|
|
item_id: :datasources
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
def manage_menu_item
|
|
|
|
::Sidebars::MenuItem.new(
|
2023-03-17 16:20:25 +05:30
|
|
|
title: s_('Observability|Manage dashboards'),
|
2023-01-13 00:05:48 +05:30
|
|
|
link: group_observability_manage_path(context.group),
|
|
|
|
active_routes: { path: 'groups/observability#manage' },
|
|
|
|
item_id: :manage
|
|
|
|
)
|
2022-10-11 01:57:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|