summaryrefslogtreecommitdiff
path: root/app/graphql/resolvers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 18:38:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-20 18:38:24 +0000
commit983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch)
treeb153cd387c14ba23bd5a07514c7c01fddf6a78a0 /app/graphql/resolvers
parenta2bddee2cdb38673df0e004d5b32d9f77797de64 (diff)
downloadgitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'app/graphql/resolvers')
-rw-r--r--app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb b/app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb
new file mode 100644
index 00000000000..068323a3073
--- /dev/null
+++ b/app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb
@@ -0,0 +1,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