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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/metrics')
-rw-r--r--app/graphql/mutations/metrics/dashboard/annotations/base.rb18
-rw-r--r--app/graphql/mutations/metrics/dashboard/annotations/create.rb24
-rw-r--r--app/graphql/mutations/metrics/dashboard/annotations/delete.rb4
3 files changed, 4 insertions, 42 deletions
diff --git a/app/graphql/mutations/metrics/dashboard/annotations/base.rb b/app/graphql/mutations/metrics/dashboard/annotations/base.rb
deleted file mode 100644
index ad52f84378d..00000000000
--- a/app/graphql/mutations/metrics/dashboard/annotations/base.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-module Mutations
- module Metrics
- module Dashboard
- module Annotations
- class Base < BaseMutation
- private
-
- # This method is defined here in order to be used by `authorized_find!` in the subclasses.
- def find_object(id:)
- GitlabSchema.object_from_id(id, expected_type: ::Metrics::Dashboard::Annotation)
- end
- end
- end
- end
- end
-end
diff --git a/app/graphql/mutations/metrics/dashboard/annotations/create.rb b/app/graphql/mutations/metrics/dashboard/annotations/create.rb
index 59ddffe3aad..e544b96f679 100644
--- a/app/graphql/mutations/metrics/dashboard/annotations/create.rb
+++ b/app/graphql/mutations/metrics/dashboard/annotations/create.rb
@@ -70,28 +70,8 @@ module Mutations
private
- def ready?(**args)
- raise_resource_not_available_error! if Feature.enabled?(:remove_monitor_metrics)
-
- # Raise error if both cluster_id and environment_id are present or neither is present
- unless args[:cluster_id].present? ^ args[:environment_id].present?
- raise Gitlab::Graphql::Errors::ArgumentError, ANNOTATION_SOURCE_ARGUMENT_ERROR
- end
-
- super(**args)
- end
-
- def annotation_create_params(args)
- annotation_source = AnnotationSource.new(object: annotation_source(args))
-
- args[annotation_source.type] = annotation_source.object
-
- args
- end
-
- def annotation_source(args)
- annotation_source_id = args[:cluster_id] || args[:environment_id]
- authorized_find!(id: annotation_source_id)
+ def ready?(**_args)
+ raise_resource_not_available_error!
end
end
end
diff --git a/app/graphql/mutations/metrics/dashboard/annotations/delete.rb b/app/graphql/mutations/metrics/dashboard/annotations/delete.rb
index 61fcf8e0b13..d2f2d9a0e32 100644
--- a/app/graphql/mutations/metrics/dashboard/annotations/delete.rb
+++ b/app/graphql/mutations/metrics/dashboard/annotations/delete.rb
@@ -4,12 +4,12 @@ module Mutations
module Metrics
module Dashboard
module Annotations
- class Delete < Base
+ class Delete < BaseMutation
graphql_name 'DeleteAnnotation'
authorize :admin_metrics_dashboard_annotation
- argument :id, ::Types::GlobalIDType[::Metrics::Dashboard::Annotation],
+ argument :id, GraphQL::Types::String,
required: true,
description: 'Global ID of the annotation to delete.'