debian-mirror-gitlab/app/serializers/prometheus_alert_entity.rb

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

24 lines
460 B
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
class PrometheusAlertEntity < Grape::Entity
include RequestAwareEntity
expose :id
expose :title
expose :query
expose :threshold
2020-10-24 23:57:45 +05:30
expose :runbook_url
2020-04-22 19:07:51 +05:30
expose :operator do |prometheus_alert|
prometheus_alert.computed_operator
end
private
alias_method :prometheus_alert, :object
def can_read_prometheus_alerts?
can?(request.current_user, :read_prometheus_alerts, prometheus_alert.project)
end
end