Commit 4ce38a79 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch '214062-move-alerts-endpoint-key-inside-presenter' into 'master'

Resolve "Follow-up from "Move cluster_health_data from helper to presenter""

Closes #214062

See merge request gitlab-org/gitlab!30053
parents db2d5289 830ed6e9
......@@ -15,7 +15,9 @@ module EE
'empty-unable-to-connect-svg-path': image_path('illustrations/monitoring/unable_to_connect.svg'),
'settings-path': '',
'project-path': '',
'tags-path': ''
'tags-path': '',
'alerts-endpoint': alerts_endpoint,
'prometheus-alerts-available': prometheus_alerts_available
}
end
......@@ -24,6 +26,14 @@ module EE
def image_path(path)
ActionController::Base.helpers.image_path(path)
end
def alerts_endpoint
'/' if ::Feature.enabled?(:prometheus_computed_alerts)
end
def prometheus_alerts_available
'true' if ::Feature.enabled?(:prometheus_computed_alerts)
end
end
end
end
%section.settings.no-animate.expanded.cluster-health-graphs.qa-cluster-health-section#cluster-health
- if @cluster&.application_prometheus_available?
#prometheus-graphs{ data: @cluster.health_data(clusterable).merge({ "alerts-endpoint" => ('/' if Feature.enabled?(:prometheus_computed_alerts)),
"prometheus-alerts-available" => ('true' if Feature.enabled?(:prometheus_computed_alerts)) }) }
#prometheus-graphs{ data: @cluster.health_data(clusterable) }
- else
%p.settings-message.text-center= s_("ClusterIntegration|In order to view the health of your cluster, you must first install Prometheus in the Applications tab.")
......@@ -28,9 +28,25 @@ describe Clusters::ClusterPresenter do
'empty-unable-to-connect-svg-path': match_asset_path('/assets/illustrations/monitoring/unable_to_connect.svg'),
'settings-path': '',
'project-path': '',
'tags-path': ''
'tags-path': '',
'alerts-endpoint': '/',
'prometheus-alerts-available': 'true'
)
end
context 'when prometheus_computed_alerts feature is disabled' do
before do
stub_feature_flags(prometheus_computed_alerts: false)
end
it 'alerts-endpoint is nil' do
expect(subject['alerts-endpoint']).to be_nil
end
it 'prometheus-alerts-available is nil' do
expect(subject['prometheus-alerts-available']).to be_nil
end
end
end
context 'with project cluster' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment