summaryrefslogtreecommitdiff
path: root/app/graphql
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
parenta2bddee2cdb38673df0e004d5b32d9f77797de64 (diff)
downloadgitlab-ce-983a0bba5d2a042c4a3bbb22432ec192c7501d82.tar.gz
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'app/graphql')
-rw-r--r--app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb28
-rw-r--r--app/graphql/types/merge_request_type.rb2
-rw-r--r--app/graphql/types/metrics/dashboard_type.rb5
-rw-r--r--app/graphql/types/metrics/dashboards/annotation_type.rb31
-rw-r--r--app/graphql/types/project_type.rb2
5 files changed, 66 insertions, 2 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
diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb
index 8f6b742a93c..cd4c6b4d46a 100644
--- a/app/graphql/types/merge_request_type.rb
+++ b/app/graphql/types/merge_request_type.rb
@@ -60,7 +60,7 @@ module Types
description: 'Indicates if the source branch of the merge request will be deleted after merge'
field :force_remove_source_branch, GraphQL::BOOLEAN_TYPE, method: :force_remove_source_branch?, null: true,
description: 'Indicates if the project settings will lead to source branch deletion after merge'
- field :merge_status, GraphQL::STRING_TYPE, null: true,
+ field :merge_status, GraphQL::STRING_TYPE, method: :public_merge_status, null: true,
description: 'Status of the merge request'
field :in_progress_merge_commit_sha, GraphQL::STRING_TYPE, null: true,
description: 'Commit SHA of the merge request if merge is in progress'
diff --git a/app/graphql/types/metrics/dashboard_type.rb b/app/graphql/types/metrics/dashboard_type.rb
index 11e834013ca..e7d09866bb5 100644
--- a/app/graphql/types/metrics/dashboard_type.rb
+++ b/app/graphql/types/metrics/dashboard_type.rb
@@ -9,6 +9,11 @@ module Types
field :path, GraphQL::STRING_TYPE, null: true,
description: 'Path to a file with the dashboard definition'
+
+ field :annotations, Types::Metrics::Dashboards::AnnotationType.connection_type, null: true,
+ description: 'Annotations added to the dashboard. Will always return `null` ' \
+ 'if `metrics_dashboard_annotations` feature flag is disabled',
+ resolver: Resolvers::Metrics::Dashboards::AnnotationResolver
end
# rubocop: enable Graphql/AuthorizeTypes
end
diff --git a/app/graphql/types/metrics/dashboards/annotation_type.rb b/app/graphql/types/metrics/dashboards/annotation_type.rb
new file mode 100644
index 00000000000..055d2544eff
--- /dev/null
+++ b/app/graphql/types/metrics/dashboards/annotation_type.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module Types
+ module Metrics
+ module Dashboards
+ class AnnotationType < ::Types::BaseObject
+ authorize :read_metrics_dashboard_annotation
+ graphql_name 'MetricsDashboardAnnotation'
+
+ field :description, GraphQL::STRING_TYPE, null: true,
+ description: 'Description of the annotation'
+
+ field :id, GraphQL::ID_TYPE, null: false,
+ description: 'ID of the annotation'
+
+ field :panel_id, GraphQL::STRING_TYPE, null: true,
+ description: 'ID of a dashboard panel to which the annotation should be scoped'
+
+ field :starting_at, GraphQL::STRING_TYPE, null: true,
+ description: 'Timestamp marking start of annotated time span'
+
+ field :ending_at, GraphQL::STRING_TYPE, null: true,
+ description: 'Timestamp marking end of annotated time span'
+
+ def panel_id
+ object.panel_xid
+ end
+ end
+ end
+ end
+end
diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb
index 3115a53e053..8356e763be9 100644
--- a/app/graphql/types/project_type.rb
+++ b/app/graphql/types/project_type.rb
@@ -26,7 +26,7 @@ module Types
markdown_field :description_html, null: true
field :tag_list, GraphQL::STRING_TYPE, null: true,
- description: 'List of project tags'
+ description: 'List of project topics (not Git tags)'
field :ssh_url_to_repo, GraphQL::STRING_TYPE, null: true,
description: 'URL to connect to the project via SSH'