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/types')
-rw-r--r--app/graphql/types/base_enum.rb15
-rw-r--r--app/graphql/types/ci/ci_cd_setting_type.rb3
-rw-r--r--app/graphql/types/ci/runner_sort_enum.rb4
-rw-r--r--app/graphql/types/ci/runner_type.rb2
-rw-r--r--app/graphql/types/ci/runner_type_enum.rb8
-rw-r--r--app/graphql/types/deprecated_mutations.rb10
-rw-r--r--app/graphql/types/global_id_type.rb27
-rw-r--r--app/graphql/types/label_type.rb2
-rw-r--r--app/graphql/types/member_interface.rb2
-rw-r--r--app/graphql/types/merge_request_type.rb10
-rw-r--r--app/graphql/types/merge_requests/merge_status_enum.rb26
-rw-r--r--app/graphql/types/mutation_type.rb3
-rw-r--r--app/graphql/types/packages/metadata_type.rb4
-rw-r--r--app/graphql/types/packages/package_group_sort_enum.rb6
-rw-r--r--app/graphql/types/packages/package_type.rb2
-rw-r--r--app/graphql/types/packages/pypi/metadatum_type.rb17
-rw-r--r--app/graphql/types/project_type.rb4
-rw-r--r--app/graphql/types/projects/service_type.rb2
-rw-r--r--app/graphql/types/projects/service_type_enum.rb4
-rw-r--r--app/graphql/types/snippet_type.rb6
-rw-r--r--app/graphql/types/snippets/blob_action_enum.rb8
-rw-r--r--app/graphql/types/snippets/visibility_scopes_enum.rb6
-rw-r--r--app/graphql/types/timelog_type.rb2
23 files changed, 124 insertions, 49 deletions
diff --git a/app/graphql/types/base_enum.rb b/app/graphql/types/base_enum.rb
index 7ef1cbddbd9..d70236f16f9 100644
--- a/app/graphql/types/base_enum.rb
+++ b/app/graphql/types/base_enum.rb
@@ -2,7 +2,19 @@
module Types
class BaseEnum < GraphQL::Schema::Enum
- extend GitlabStyleDeprecations
+ class CustomValue < GraphQL::Schema::EnumValue
+ include ::GitlabStyleDeprecations
+
+ attr_reader :deprecation
+
+ def initialize(name, desc = nil, **kwargs)
+ @deprecation = gitlab_deprecation(kwargs)
+
+ super(name, desc, **kwargs)
+ end
+ end
+
+ enum_value_class(CustomValue)
class << self
# Registers enum definition by the given DeclarativeEnum module
@@ -41,7 +53,6 @@ module Types
def value(*args, **kwargs, &block)
enum[args[0].downcase] = kwargs[:value] || args[0]
- gitlab_deprecation(kwargs)
super(*args, **kwargs, &block)
end
diff --git a/app/graphql/types/ci/ci_cd_setting_type.rb b/app/graphql/types/ci/ci_cd_setting_type.rb
index b34a91446a2..f90c75454ba 100644
--- a/app/graphql/types/ci/ci_cd_setting_type.rb
+++ b/app/graphql/types/ci/ci_cd_setting_type.rb
@@ -16,6 +16,9 @@ module Types
field :keep_latest_artifact, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Whether to keep the latest builds artifacts.',
method: :keep_latest_artifacts_available?
+ field :job_token_scope_enabled, GraphQL::BOOLEAN_TYPE, null: true,
+ description: 'Indicates CI job tokens generated in this project have restricted access to resources.',
+ method: :job_token_scope_enabled?
field :project, Types::ProjectType, null: true,
description: 'Project the CI/CD settings belong to.'
end
diff --git a/app/graphql/types/ci/runner_sort_enum.rb b/app/graphql/types/ci/runner_sort_enum.rb
index 550e870316a..95ec1867fea 100644
--- a/app/graphql/types/ci/runner_sort_enum.rb
+++ b/app/graphql/types/ci/runner_sort_enum.rb
@@ -7,7 +7,9 @@ module Types
description 'Values for sorting runners'
value 'CONTACTED_ASC', 'Ordered by contacted_at in ascending order.', value: :contacted_asc
- value 'CREATED_DESC', 'Ordered by created_date in descending order.', value: :created_date
+ value 'CONTACTED_DESC', 'Ordered by contacted_at in descending order.', value: :contacted_desc
+ value 'CREATED_ASC', 'Ordered by created_at in ascending order.', value: :created_at_asc
+ value 'CREATED_DESC', 'Ordered by created_at in descending order.', value: :created_at_desc
end
end
end
diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb
index 3abed7289d5..837d91ef765 100644
--- a/app/graphql/types/ci/runner_type.rb
+++ b/app/graphql/types/ci/runner_type.rb
@@ -40,3 +40,5 @@ module Types
end
end
end
+
+Types::Ci::RunnerType.prepend_mod_with('Types::Ci::RunnerType')
diff --git a/app/graphql/types/ci/runner_type_enum.rb b/app/graphql/types/ci/runner_type_enum.rb
index f771635f4ed..12e87906179 100644
--- a/app/graphql/types/ci/runner_type_enum.rb
+++ b/app/graphql/types/ci/runner_type_enum.rb
@@ -5,10 +5,10 @@ module Types
class RunnerTypeEnum < BaseEnum
graphql_name 'CiRunnerType'
- ::Ci::Runner.runner_types.keys.each do |type|
- value type.upcase,
- description: "A runner that is #{type.tr('_', ' ')}.",
- value: type
+ ::Ci::Runner::AVAILABLE_TYPES.each do |runner_type|
+ value runner_type.upcase,
+ description: "A runner that is #{runner_type.tr('_', ' ')}.",
+ value: runner_type
end
end
end
diff --git a/app/graphql/types/deprecated_mutations.rb b/app/graphql/types/deprecated_mutations.rb
index a4336fa3ef3..49bad56b6f9 100644
--- a/app/graphql/types/deprecated_mutations.rb
+++ b/app/graphql/types/deprecated_mutations.rb
@@ -5,15 +5,7 @@ module Types
extend ActiveSupport::Concern
prepended do
- mount_aliased_mutation 'AddAwardEmoji',
- Mutations::AwardEmojis::Add,
- deprecated: { reason: 'Use awardEmojiAdd', milestone: '13.2' }
- mount_aliased_mutation 'RemoveAwardEmoji',
- Mutations::AwardEmojis::Remove,
- deprecated: { reason: 'Use awardEmojiRemove', milestone: '13.2' }
- mount_aliased_mutation 'ToggleAwardEmoji',
- Mutations::AwardEmojis::Toggle,
- deprecated: { reason: 'Use awardEmojiToggle', milestone: '13.2' }
+ # placeholder for any FOSS mutations to be deprecated
end
end
end
diff --git a/app/graphql/types/global_id_type.rb b/app/graphql/types/global_id_type.rb
index 79061df7282..c44c268b43f 100644
--- a/app/graphql/types/global_id_type.rb
+++ b/app/graphql/types/global_id_type.rb
@@ -52,11 +52,20 @@ module Types
@id_types ||= {}
@id_types[model_class] ||= Class.new(self) do
- graphql_name "#{model_class.name.gsub(/::/, '')}ID"
- description <<~MD
+ model_name = model_class.name
+
+ graphql_name model_name_to_graphql_name(model_name)
+ description <<~MD.strip
A `#{graphql_name}` is a global ID. It is encoded as a string.
- An example `#{graphql_name}` is: `"#{::Gitlab::GlobalId.build(model_name: model_class.name, id: 1)}"`.
+ An example `#{graphql_name}` is: `"#{::Gitlab::GlobalId.build(model_name: model_name, id: 1)}"`.
+ #{
+ if deprecation = Gitlab::GlobalId::Deprecations.deprecation_by(model_name)
+ 'The older format `"' +
+ ::Gitlab::GlobalId.build(model_name: deprecation.old_model_name, id: 1).to_s +
+ '"` was deprecated in ' + deprecation.milestone + '.'
+ end}
+
MD
define_singleton_method(:to_s) do
@@ -69,7 +78,7 @@ module Types
define_singleton_method(:as) do |new_name|
if @renamed && graphql_name != new_name
- raise "Conflicting names for ID of #{model_class.name}: " \
+ raise "Conflicting names for ID of #{model_name}: " \
"#{graphql_name} and #{new_name}"
end
@@ -79,11 +88,11 @@ module Types
end
define_singleton_method(:coerce_result) do |gid, ctx|
- global_id = ::Gitlab::GlobalId.as_global_id(gid, model_name: model_class.name)
+ global_id = ::Gitlab::GlobalId.as_global_id(gid, model_name: model_name)
next global_id.to_s if suitable?(global_id)
- raise GraphQL::CoercionError, "Expected a #{model_class.name} ID, got #{global_id}"
+ raise GraphQL::CoercionError, "Expected a #{model_name} ID, got #{global_id}"
end
define_singleton_method(:suitable?) do |gid|
@@ -97,9 +106,13 @@ module Types
gid = super(string, ctx)
next gid if suitable?(gid)
- raise GraphQL::CoercionError, "#{string.inspect} does not represent an instance of #{model_class.name}"
+ raise GraphQL::CoercionError, "#{string.inspect} does not represent an instance of #{model_name}"
end
end
end
+
+ def self.model_name_to_graphql_name(model_name)
+ "#{model_name.gsub(/::/, '')}ID"
+ end
end
end
diff --git a/app/graphql/types/label_type.rb b/app/graphql/types/label_type.rb
index cb6b0312aa3..4e8718a80da 100644
--- a/app/graphql/types/label_type.rb
+++ b/app/graphql/types/label_type.rb
@@ -23,7 +23,5 @@ module Types
description: 'When this label was created.'
field :updated_at, Types::TimeType, null: false,
description: 'When this label was last updated.'
- field :remove_on_close, GraphQL::BOOLEAN_TYPE, null: false,
- description: 'Whether the label should be removed from an issue when the issue is closed.'
end
end
diff --git a/app/graphql/types/member_interface.rb b/app/graphql/types/member_interface.rb
index 1c7257487d9..6a21e51fe28 100644
--- a/app/graphql/types/member_interface.rb
+++ b/app/graphql/types/member_interface.rb
@@ -22,7 +22,7 @@ module Types
field :expires_at, Types::TimeType, null: true,
description: 'Date and time the membership expires.'
- field :user, Types::UserType, null: false,
+ field :user, Types::UserType, null: true,
description: 'User that is associated with the member object.'
definition_methods do
diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb
index 4eeeaa4f5d0..338b70bb0c6 100644
--- a/app/graphql/types/merge_request_type.rb
+++ b/app/graphql/types/merge_request_type.rb
@@ -82,7 +82,11 @@ module Types
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, method: :public_merge_status, null: true,
- description: 'Status of the merge request.'
+ description: 'Status of the merge request.',
+ deprecated: { reason: :renamed, replacement: 'MergeRequest.mergeStatusEnum', milestone: '14.0' }
+ field :merge_status_enum, ::Types::MergeRequests::MergeStatusEnum,
+ method: :public_merge_status, null: true,
+ description: 'Merge 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.'
field :merge_error, GraphQL::STRING_TYPE, null: true,
@@ -158,6 +162,10 @@ module Types
description: 'Time estimate of the merge request.'
field :total_time_spent, GraphQL::INT_TYPE, null: false,
description: 'Total time reported as spent on the merge request.'
+ field :human_time_estimate, GraphQL::STRING_TYPE, null: true,
+ description: 'Human-readable time estimate of the merge request.'
+ field :human_total_time_spent, GraphQL::STRING_TYPE, null: true,
+ description: 'Human-readable total time reported as spent on the merge request.'
field :reference, GraphQL::STRING_TYPE, null: false, method: :to_reference,
description: 'Internal reference of the merge request. Returned in shortened format by default.' do
argument :full, GraphQL::BOOLEAN_TYPE, required: false, default_value: false,
diff --git a/app/graphql/types/merge_requests/merge_status_enum.rb b/app/graphql/types/merge_requests/merge_status_enum.rb
new file mode 100644
index 00000000000..bb3e0f1a0c0
--- /dev/null
+++ b/app/graphql/types/merge_requests/merge_status_enum.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module Types
+ module MergeRequests
+ class MergeStatusEnum < BaseEnum
+ graphql_name 'MergeStatus'
+ description 'Representation of whether a GitLab merge request can be merged.'
+
+ value 'UNCHECKED',
+ value: 'unchecked',
+ description: 'Merge status has not been checked.'
+ value 'CHECKING',
+ value: 'checking',
+ description: 'Currently checking for mergeability.'
+ value 'CAN_BE_MERGED',
+ value: 'can_be_merged',
+ description: 'There are no conflicts between the source and target branches.'
+ value 'CANNOT_BE_MERGED',
+ value: 'cannot_be_merged',
+ description: 'There are conflicts between the source and target branches.'
+ value 'CANNOT_BE_MERGED_RECHECK',
+ value: 'cannot_be_merged_recheck',
+ description: 'Currently unchecked. The previous state was `CANNOT_BE_MERGED`.'
+ end
+ end
+end
diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb
index 54a06ed5342..6b1146f8f09 100644
--- a/app/graphql/types/mutation_type.rb
+++ b/app/graphql/types/mutation_type.rb
@@ -99,6 +99,9 @@ module Types
mount_mutation Mutations::Ci::CiCdSettingsUpdate
mount_mutation Mutations::Ci::Job::Play
mount_mutation Mutations::Ci::Job::Retry
+ mount_mutation Mutations::Ci::Runner::Update, feature_flag: :runner_graphql_query
+ mount_mutation Mutations::Ci::Runner::Delete, feature_flag: :runner_graphql_query
+ mount_mutation Mutations::Ci::RunnersRegistrationToken::Reset, feature_flag: :runner_graphql_query
mount_mutation Mutations::Namespace::PackageSettings::Update
mount_mutation Mutations::UserCallouts::Create
end
diff --git a/app/graphql/types/packages/metadata_type.rb b/app/graphql/types/packages/metadata_type.rb
index 94880cb9b22..3b2257547b7 100644
--- a/app/graphql/types/packages/metadata_type.rb
+++ b/app/graphql/types/packages/metadata_type.rb
@@ -6,7 +6,7 @@ module Types
graphql_name 'PackageMetadata'
description 'Represents metadata associated with a Package'
- possible_types ::Types::Packages::Composer::MetadatumType, ::Types::Packages::Conan::MetadatumType, ::Types::Packages::Maven::MetadatumType, ::Types::Packages::Nuget::MetadatumType
+ possible_types ::Types::Packages::Composer::MetadatumType, ::Types::Packages::Conan::MetadatumType, ::Types::Packages::Maven::MetadatumType, ::Types::Packages::Nuget::MetadatumType, ::Types::Packages::Pypi::MetadatumType
def self.resolve_type(object, context)
case object
@@ -18,6 +18,8 @@ module Types
::Types::Packages::Maven::MetadatumType
when ::Packages::Nuget::Metadatum
::Types::Packages::Nuget::MetadatumType
+ when ::Packages::Pypi::Metadatum
+ ::Types::Packages::Pypi::MetadatumType
else
# NOTE: This method must be kept in sync with `PackageWithoutVersionsType#metadata`,
# which must never produce data that this discriminator cannot handle.
diff --git a/app/graphql/types/packages/package_group_sort_enum.rb b/app/graphql/types/packages/package_group_sort_enum.rb
index 70fb27ec0db..28a1bf85911 100644
--- a/app/graphql/types/packages/package_group_sort_enum.rb
+++ b/app/graphql/types/packages/package_group_sort_enum.rb
@@ -6,10 +6,8 @@ module Types
graphql_name 'PackageGroupSort'
description 'Values for sorting group packages'
- # The following enums are not available till we enable the new Arel node:
- # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58657#note_552632305
- # value 'PROJECT_PATH_DESC', 'Project by descending order.', value: :project_path_desc
- # value 'PROJECT_PATH_ASC', 'Project by ascending order.', value: :project_path_asc
+ value 'PROJECT_PATH_DESC', 'Ordered by project path in descending order.', value: :project_path_desc
+ value 'PROJECT_PATH_ASC', 'Ordered by project path in ascending order.', value: :project_path_asc
end
end
end
diff --git a/app/graphql/types/packages/package_type.rb b/app/graphql/types/packages/package_type.rb
index b349b655fa5..ee6785e3555 100644
--- a/app/graphql/types/packages/package_type.rb
+++ b/app/graphql/types/packages/package_type.rb
@@ -49,6 +49,8 @@ module Types
object.maven_metadatum
when 'nuget'
object.nuget_metadatum
+ when 'pypi'
+ object.pypi_metadatum
else
nil
end
diff --git a/app/graphql/types/packages/pypi/metadatum_type.rb b/app/graphql/types/packages/pypi/metadatum_type.rb
new file mode 100644
index 00000000000..031d3572197
--- /dev/null
+++ b/app/graphql/types/packages/pypi/metadatum_type.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module Types
+ module Packages
+ module Pypi
+ class MetadatumType < BaseObject
+ graphql_name 'PypiMetadata'
+ description 'Pypi metadata'
+
+ authorize :read_package
+
+ field :id, ::Types::GlobalIDType[::Packages::Pypi::Metadatum], null: false, description: 'ID of the metadatum.'
+ field :required_python, GraphQL::STRING_TYPE, null: true, description: 'Required Python version of the Pypi package.'
+ end
+ end
+ end
+end
diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb
index a2852588e89..55dc73d898d 100644
--- a/app/graphql/types/project_type.rb
+++ b/app/graphql/types/project_type.rb
@@ -387,6 +387,10 @@ module Types
::Security::CiConfiguration::SastParserService.new(object).configuration
end
+ def tag_list
+ object.topic_list
+ end
+
private
def project
diff --git a/app/graphql/types/projects/service_type.rb b/app/graphql/types/projects/service_type.rb
index 9ce325c4655..6f0dcd44cad 100644
--- a/app/graphql/types/projects/service_type.rb
+++ b/app/graphql/types/projects/service_type.rb
@@ -15,7 +15,7 @@ module Types
definition_methods do
def resolve_type(object, context)
- if object.is_a?(::JiraService)
+ if object.is_a?(::Integrations::Jira)
Types::Projects::Services::JiraServiceType
else
Types::Projects::Services::BaseServiceType
diff --git a/app/graphql/types/projects/service_type_enum.rb b/app/graphql/types/projects/service_type_enum.rb
index 0a57cd48df4..9948fa8bb69 100644
--- a/app/graphql/types/projects/service_type_enum.rb
+++ b/app/graphql/types/projects/service_type_enum.rb
@@ -5,8 +5,8 @@ module Types
class ServiceTypeEnum < BaseEnum
graphql_name 'ServiceType'
- ::Integration.available_services_types(include_dev: false).each do |service_type|
- value service_type.underscore.upcase, value: service_type, description: "#{service_type} type"
+ ::Integration.available_services_types(include_dev: false).each do |type|
+ value type.underscore.upcase, value: type, description: "#{type} type"
end
end
end
diff --git a/app/graphql/types/snippet_type.rb b/app/graphql/types/snippet_type.rb
index 2f79ec48c04..34357ead048 100644
--- a/app/graphql/types/snippet_type.rb
+++ b/app/graphql/types/snippet_type.rb
@@ -61,12 +61,6 @@ module Types
description: 'Raw URL of the snippet.',
null: false
- field :blob, type: Types::Snippets::BlobType,
- description: 'Snippet blob.',
- calls_gitaly: true,
- null: false,
- deprecated: { reason: 'Use `blobs`', milestone: '13.3' }
-
field :blobs, type: Types::Snippets::BlobType.connection_type,
description: 'Snippet blobs.',
calls_gitaly: true,
diff --git a/app/graphql/types/snippets/blob_action_enum.rb b/app/graphql/types/snippets/blob_action_enum.rb
index e3f89920f16..0defd521acb 100644
--- a/app/graphql/types/snippets/blob_action_enum.rb
+++ b/app/graphql/types/snippets/blob_action_enum.rb
@@ -6,10 +6,10 @@ module Types
graphql_name 'SnippetBlobActionEnum'
description 'Type of a snippet blob input action'
- value 'create', value: :create
- value 'update', value: :update
- value 'delete', value: :delete
- value 'move', value: :move
+ value 'create', description: 'Create a snippet blob.', value: :create
+ value 'update', description: 'Update a snippet blob.', value: :update
+ value 'delete', description: 'Delete a snippet blob.', value: :delete
+ value 'move', description: 'Move a snippet blob.', value: :move
end
end
end
diff --git a/app/graphql/types/snippets/visibility_scopes_enum.rb b/app/graphql/types/snippets/visibility_scopes_enum.rb
index 5488e05b95d..ddcc005eaf2 100644
--- a/app/graphql/types/snippets/visibility_scopes_enum.rb
+++ b/app/graphql/types/snippets/visibility_scopes_enum.rb
@@ -3,9 +3,9 @@
module Types
module Snippets
class VisibilityScopesEnum < BaseEnum
- value 'private', value: 'are_private'
- value 'internal', value: 'are_internal'
- value 'public', value: 'are_public'
+ value 'private', description: 'The snippet is visible only to the snippet creator.', value: 'are_private'
+ value 'internal', description: 'The snippet is visible for any logged in user except external users.', value: 'are_internal'
+ value 'public', description: 'The snippet can be accessed without any authentication.', value: 'are_public'
end
end
end
diff --git a/app/graphql/types/timelog_type.rb b/app/graphql/types/timelog_type.rb
index 99a619f1b1d..925a522629e 100644
--- a/app/graphql/types/timelog_type.rb
+++ b/app/graphql/types/timelog_type.rb
@@ -4,7 +4,7 @@ module Types
class TimelogType < BaseObject
graphql_name 'Timelog'
- authorize :read_group_timelogs
+ authorize :read_issue
field :spent_at,
Types::TimeType,