Welcome to mirror list, hosted at ThFree Co, Russian Federation.

annotation_resolver.rb « dashboards « metrics « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 068323a3073c00c363c5b160512790234ab7797b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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