debian-mirror-gitlab/app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb
2020-04-22 19:07:51 +05:30

28 lines
927 B
Ruby

# frozen_string_literal: true
module Resolvers
module Metrics
module Dashboards
class AnnotationResolver < Resolvers::BaseResolver
argument :from, Types::TimeType,
required: true,
description: "Timestamp marking date and time from which annotations need to be fetched"
argument :to, Types::TimeType,
required: false,
description: "Timestamp marking date and time to which annotations need to be fetched"
type Types::Metrics::Dashboards::AnnotationType, null: true
alias_method :dashboard, :object
def resolve(**args)
return [] unless dashboard
return [] unless Feature.enabled?(:metrics_dashboard_annotations, dashboard.environment&.project)
::Metrics::Dashboards::AnnotationsFinder.new(dashboard: dashboard, params: args).execute
end
end
end
end
end