debian-mirror-gitlab/app/helpers/groups/observability_helper.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
1,002 B
Ruby
Raw Normal View History

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