2023-01-13 00:05:48 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Groups
|
|
|
|
module ObservabilityHelper
|
|
|
|
ACTION_TO_PATH = {
|
|
|
|
'dashboards' => {
|
|
|
|
path: '/',
|
2023-03-17 16:20:25 +05:30
|
|
|
title: -> { s_('Observability|Dashboards') }
|
2023-01-13 00:05:48 +05:30
|
|
|
},
|
|
|
|
'manage' => {
|
|
|
|
path: '/dashboards',
|
2023-03-17 16:20:25 +05:30
|
|
|
title: -> { s_('Observability|Manage dashboards') }
|
2023-01-13 00:05:48 +05:30
|
|
|
},
|
|
|
|
'explore' => {
|
|
|
|
path: '/explore',
|
2023-03-17 16:20:25 +05:30
|
|
|
title: -> { s_('Observability|Explore telemetry data') }
|
|
|
|
},
|
|
|
|
'datasources' => {
|
|
|
|
path: '/datasources',
|
|
|
|
title: -> { s_('Observability|Data sources') }
|
2023-01-13 00:05:48 +05:30
|
|
|
}
|
|
|
|
}.freeze
|
|
|
|
|
|
|
|
def observability_iframe_src(group)
|
2023-05-27 22:25:52 +05:30
|
|
|
Gitlab::Observability.build_full_url(group, params[:observability_path],
|
|
|
|
observability_config_for(params).fetch(:path))
|
2023-01-13 00:05:48 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def observability_page_title
|
|
|
|
observability_config_for(params).fetch(:title).call
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def observability_config_for(params)
|
|
|
|
ACTION_TO_PATH.fetch(params[:action], ACTION_TO_PATH['dashboards'])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|