2020-10-24 23:57:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class PrometheusAlertPresenter < Gitlab::View::Presenter::Delegated
|
|
|
|
include ActionView::Helpers::UrlHelper
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
presents ::PrometheusAlert, as: :prometheus_alert
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
def humanized_text
|
|
|
|
operator_text =
|
|
|
|
case prometheus_alert.operator
|
|
|
|
when 'lt' then s_('PrometheusAlerts|is less than')
|
|
|
|
when 'eq' then s_('PrometheusAlerts|is equal to')
|
|
|
|
when 'gt' then s_('PrometheusAlerts|exceeded')
|
|
|
|
end
|
|
|
|
|
|
|
|
"#{operator_text} #{prometheus_alert.threshold}#{prometheus_alert.prometheus_metric.unit}"
|
|
|
|
end
|
|
|
|
end
|