2023-06-20 00:43:36 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Sidebars
|
|
|
|
module Admin
|
|
|
|
module Menus
|
|
|
|
class MonitoringMenu < ::Sidebars::Admin::BaseMenu
|
|
|
|
override :configure_menu_items
|
|
|
|
def configure_menu_items
|
|
|
|
add_item(system_info_menu_item)
|
|
|
|
add_item(background_migrations_menu_item)
|
|
|
|
add_item(background_jobs_menu_item)
|
|
|
|
add_item(health_check_menu_item)
|
2023-07-09 08:55:56 +05:30
|
|
|
add_item(metrics_dashboard_menu_item)
|
2023-06-20 00:43:36 +05:30
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
override :title
|
|
|
|
def title
|
|
|
|
s_('Admin|Monitoring')
|
|
|
|
end
|
|
|
|
|
|
|
|
override :sprite_icon
|
|
|
|
def sprite_icon
|
|
|
|
'monitor'
|
|
|
|
end
|
|
|
|
|
|
|
|
override :extra_container_html_options
|
|
|
|
def extra_container_html_options
|
|
|
|
{ 'data-qa-selector': 'admin_monitoring_menu_link' }
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def system_info_menu_item
|
|
|
|
::Sidebars::MenuItem.new(
|
|
|
|
title: _('System Info'),
|
|
|
|
link: admin_system_info_path,
|
|
|
|
active_routes: { controller: 'system_info' },
|
|
|
|
item_id: :system_info
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def background_migrations_menu_item
|
|
|
|
::Sidebars::MenuItem.new(
|
|
|
|
title: _('Background Migrations'),
|
|
|
|
link: admin_background_migrations_path,
|
|
|
|
active_routes: { controller: 'background_migrations' },
|
2023-07-09 08:55:56 +05:30
|
|
|
item_id: :background_migrations
|
2023-06-20 00:43:36 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def background_jobs_menu_item
|
|
|
|
::Sidebars::MenuItem.new(
|
|
|
|
title: _('Background Jobs'),
|
|
|
|
link: admin_background_jobs_path,
|
|
|
|
active_routes: { controller: 'background_jobs' },
|
|
|
|
item_id: :background_jobs
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def health_check_menu_item
|
|
|
|
::Sidebars::MenuItem.new(
|
|
|
|
title: _('Health Check'),
|
|
|
|
link: admin_health_check_path,
|
|
|
|
active_routes: { controller: 'health_check' },
|
|
|
|
item_id: :health_check
|
|
|
|
)
|
|
|
|
end
|
2023-07-09 08:55:56 +05:30
|
|
|
|
|
|
|
def metrics_dashboard_menu_item
|
|
|
|
return ::Sidebars::NilMenuItem.new(item_id: :metrics_dashboard) unless
|
|
|
|
Gitlab::CurrentSettings.current_application_settings.grafana_enabled?
|
|
|
|
|
|
|
|
::Sidebars::MenuItem.new(
|
|
|
|
title: _('Metrics Dashboard'),
|
|
|
|
link: Gitlab::CurrentSettings.current_application_settings.grafana_url,
|
|
|
|
active_routes: { path: Gitlab::CurrentSettings.current_application_settings.grafana_url },
|
|
|
|
item_id: :metrics_dashboard
|
|
|
|
)
|
|
|
|
end
|
2023-06-20 00:43:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Sidebars::Admin::Menus::MonitoringMenu.prepend_mod_with('Sidebars::Admin::Menus::MonitoringMenu')
|