diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /app/graphql/mutations/metrics/dashboard/annotations/create.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/graphql/mutations/metrics/dashboard/annotations/create.rb')
-rw-r--r-- | app/graphql/mutations/metrics/dashboard/annotations/create.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/app/graphql/mutations/metrics/dashboard/annotations/create.rb b/app/graphql/mutations/metrics/dashboard/annotations/create.rb index f99688aeac6..b064f55825f 100644 --- a/app/graphql/mutations/metrics/dashboard/annotations/create.rb +++ b/app/graphql/mutations/metrics/dashboard/annotations/create.rb @@ -18,12 +18,12 @@ module Mutations description: 'The created annotation' argument :environment_id, - GraphQL::ID_TYPE, + ::Types::GlobalIDType[::Environment], required: false, description: 'The global id of the environment to add an annotation to' argument :cluster_id, - GraphQL::ID_TYPE, + ::Types::GlobalIDType[::Clusters::Cluster], required: false, description: 'The global id of the cluster to add an annotation to' @@ -80,11 +80,11 @@ module Mutations raise Gitlab::Graphql::Errors::ArgumentError, ANNOTATION_SOURCE_ARGUMENT_ERROR end - super(args) + super(**args) end def find_object(id:) - GitlabSchema.object_from_id(id) + GitlabSchema.find_by_gid(id) end def annotation_create_params(args) @@ -96,7 +96,16 @@ module Mutations end def annotation_source(args) - annotation_source_id = args[:cluster_id] || args[:environment_id] + # TODO: remove these lines when the compatibility layer is removed + # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 + annotation_source_id = if args[:cluster_id] + ::Types::GlobalIDType[::Clusters::Cluster].coerce_isolated_input(args[:cluster_id]) + else + ::Types::GlobalIDType[::Environment].coerce_isolated_input(args[:environment_id]) + end + + # TODO: uncomment following line once lines above are removed + # annotation_source_id = args[:cluster_id] || args[:environment_id] authorized_find!(id: annotation_source_id) end end |