diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /app/graphql/types | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) | |
download | gitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/graphql/types')
-rw-r--r-- | app/graphql/types/base_object.rb | 7 | ||||
-rw-r--r-- | app/graphql/types/ci/job_kind_enum.rb | 12 | ||||
-rw-r--r-- | app/graphql/types/ci/job_type.rb | 8 | ||||
-rw-r--r-- | app/graphql/types/ci/runner_upgrade_status_type_enum.rb | 21 | ||||
-rw-r--r-- | app/graphql/types/container_repository_type.rb | 1 | ||||
-rw-r--r-- | app/graphql/types/dependency_proxy/manifest_type.rb | 4 | ||||
-rw-r--r-- | app/graphql/types/dependency_proxy/manifest_type_enum.rb | 11 | ||||
-rw-r--r-- | app/graphql/types/issue_connection.rb | 15 | ||||
-rw-r--r-- | app/graphql/types/issue_sort_enum.rb | 2 | ||||
-rw-r--r-- | app/graphql/types/mutation_type.rb | 1 | ||||
-rw-r--r-- | app/graphql/types/repository/blob_type.rb | 4 | ||||
-rw-r--r-- | app/graphql/types/subscription_type.rb | 3 | ||||
-rw-r--r-- | app/graphql/types/user_interface.rb | 3 |
13 files changed, 87 insertions, 5 deletions
diff --git a/app/graphql/types/base_object.rb b/app/graphql/types/base_object.rb index b5797f07aa6..4ad88e43f52 100644 --- a/app/graphql/types/base_object.rb +++ b/app/graphql/types/base_object.rb @@ -9,6 +9,13 @@ module Types field_class Types::BaseField edge_type_class Types::BaseEdge + def self.authorize(*args) + raise 'Cannot redefine authorize' if @authorize_args && args.any? + + @authorize_args = args.freeze if args.any? + @authorize_args || (superclass.respond_to?(:authorize) ? superclass.authorize : nil) + end + def self.accepts(*types) @accepts ||= [] @accepts += types diff --git a/app/graphql/types/ci/job_kind_enum.rb b/app/graphql/types/ci/job_kind_enum.rb new file mode 100644 index 00000000000..dd1d80f806c --- /dev/null +++ b/app/graphql/types/ci/job_kind_enum.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Types + module Ci + class JobKindEnum < BaseEnum + graphql_name 'CiJobKind' + + value 'BUILD', value: ::Ci::Build, description: 'Standard CI job.' + value 'BRIDGE', value: ::Ci::Bridge, description: 'Bridge CI job connecting a parent and child pipeline.' + end + end +end diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 83054553bd8..f25fc56a588 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -17,6 +17,8 @@ module Types description: 'Duration of the job in seconds.' field :id, ::Types::GlobalIDType[::CommitStatus].as('JobID'), null: true, description: 'ID of the job.' + field :kind, type: ::Types::Ci::JobKindEnum, null: false, + description: 'Indicates the type of job.' field :name, GraphQL::Types::String, null: true, description: 'Name of the job.' field :needs, BuildNeedType.connection_type, null: true, @@ -87,6 +89,12 @@ module Types field :triggered, GraphQL::Types::Boolean, null: true, description: 'Whether the job was triggered.' + def kind + return ::Ci::Build unless [::Ci::Build, ::Ci::Bridge].include?(object.class) + + object.class + end + def pipeline Gitlab::Graphql::Loaders::BatchModelLoader.new(::Ci::Pipeline, object.pipeline_id).find end diff --git a/app/graphql/types/ci/runner_upgrade_status_type_enum.rb b/app/graphql/types/ci/runner_upgrade_status_type_enum.rb new file mode 100644 index 00000000000..e3d77e485bc --- /dev/null +++ b/app/graphql/types/ci/runner_upgrade_status_type_enum.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Types + module Ci + class RunnerUpgradeStatusTypeEnum < BaseEnum + graphql_name 'CiRunnerUpgradeStatusType' + + value 'NOT_AVAILABLE', + description: "An update is not available for the runner.", + value: :not_available + + value 'AVAILABLE', + description: "An update is available for the runner.", + value: :available + + value 'RECOMMENDED', + description: "An update is available and recommended for the runner.", + value: :recommended + end + end +end diff --git a/app/graphql/types/container_repository_type.rb b/app/graphql/types/container_repository_type.rb index 3cd3730010b..dddf9a3ee97 100644 --- a/app/graphql/types/container_repository_type.rb +++ b/app/graphql/types/container_repository_type.rb @@ -14,6 +14,7 @@ module Types field :expiration_policy_started_at, Types::TimeType, null: true, description: 'Timestamp when the cleanup done by the expiration policy was started on the container repository.' field :id, GraphQL::Types::ID, null: false, description: 'ID of the container repository.' field :location, GraphQL::Types::String, null: false, description: 'URL of the container repository.' + field :migration_state, GraphQL::Types::String, null: false, description: 'Migration state of the container repository.' field :name, GraphQL::Types::String, null: false, description: 'Name of the container repository.' field :path, GraphQL::Types::String, null: false, description: 'Path of the container repository.' field :project, Types::ProjectType, null: false, description: 'Project of the container registry.' diff --git a/app/graphql/types/dependency_proxy/manifest_type.rb b/app/graphql/types/dependency_proxy/manifest_type.rb index ab22f540f48..f7e751e30d3 100644 --- a/app/graphql/types/dependency_proxy/manifest_type.rb +++ b/app/graphql/types/dependency_proxy/manifest_type.rb @@ -15,6 +15,10 @@ module Types field :image_name, GraphQL::Types::String, null: false, description: 'Name of the image.' field :size, GraphQL::Types::String, null: false, description: 'Size of the manifest file.' field :updated_at, Types::TimeType, null: false, description: 'Date of most recent update.' + field :status, + Types::DependencyProxy::ManifestTypeEnum, + null: false, + description: "Status of the manifest (#{::DependencyProxy::Manifest.statuses.keys.join(', ')})" def image_name object.file_name.chomp(File.extname(object.file_name)) diff --git a/app/graphql/types/dependency_proxy/manifest_type_enum.rb b/app/graphql/types/dependency_proxy/manifest_type_enum.rb new file mode 100644 index 00000000000..ddd1652eeea --- /dev/null +++ b/app/graphql/types/dependency_proxy/manifest_type_enum.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Types + class DependencyProxy::ManifestTypeEnum < BaseEnum + graphql_name 'DependencyProxyManifestStatus' + + ::DependencyProxy::Manifest.statuses.keys.each do |status| + value status.upcase, description: "Dependency proxy manifest has a status of #{status}.", value: status + end + end +end diff --git a/app/graphql/types/issue_connection.rb b/app/graphql/types/issue_connection.rb new file mode 100644 index 00000000000..8e5c88648ea --- /dev/null +++ b/app/graphql/types/issue_connection.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# Normally this wouldn't be needed and we could use +# type Types::IssueType.connection_type, null: true +# in a resolver. However we can end up with cyclic definitions, +# which can result in errors like +# NameError: uninitialized constant Resolvers::GroupIssuesResolver +# +# Now we would use +# type "Types::IssueConnection", null: true +# which gives a delayed resolution, and the proper connection type. +# See app/graphql/resolvers/base_issues_resolver.rb +# Reference: https://github.com/rmosolgo/graphql-ruby/issues/3974#issuecomment-1084444214 + +Types::IssueConnection = Types::IssueType.connection_type diff --git a/app/graphql/types/issue_sort_enum.rb b/app/graphql/types/issue_sort_enum.rb index f8825ff6c46..db51e491d4e 100644 --- a/app/graphql/types/issue_sort_enum.rb +++ b/app/graphql/types/issue_sort_enum.rb @@ -14,6 +14,8 @@ module Types value 'TITLE_DESC', 'Title by descending order.', value: :title_desc value 'POPULARITY_ASC', 'Number of upvotes (awarded "thumbs up" emoji) by ascending order.', value: :popularity_asc value 'POPULARITY_DESC', 'Number of upvotes (awarded "thumbs up" emoji) by descending order.', value: :popularity_desc + value 'ESCALATION_STATUS_ASC', 'Status from triggered to resolved. Defaults to `CREATED_DESC` if `incident_escalations` feature flag is disabled.', value: :escalation_status_asc + value 'ESCALATION_STATUS_DESC', 'Status from resolved to triggered. Defaults to `CREATED_DESC` if `incident_escalations` feature flag is disabled.', value: :escalation_status_desc end end diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index e6072820eea..2297912ac35 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -131,6 +131,7 @@ module Types mount_mutation Mutations::WorkItems::Update mount_mutation Mutations::SavedReplies::Create mount_mutation Mutations::SavedReplies::Update + mount_mutation Mutations::SavedReplies::Destroy end end diff --git a/app/graphql/types/repository/blob_type.rb b/app/graphql/types/repository/blob_type.rb index 652e2882584..dd5c70887de 100644 --- a/app/graphql/types/repository/blob_type.rb +++ b/app/graphql/types/repository/blob_type.rb @@ -101,10 +101,6 @@ module Types description: 'Web path to blob on an environment.', calls_gitaly: true - field :code_owners, [Types::UserType], null: true, - description: 'List of code owners for the blob.', - calls_gitaly: true - field :file_type, GraphQL::Types::String, null: true, description: 'Expected format of the blob based on the extension.' diff --git a/app/graphql/types/subscription_type.rb b/app/graphql/types/subscription_type.rb index db6a247179d..de3f71090f6 100644 --- a/app/graphql/types/subscription_type.rb +++ b/app/graphql/types/subscription_type.rb @@ -12,5 +12,8 @@ module Types field :issuable_title_updated, subscription: Subscriptions::IssuableUpdated, null: true, description: 'Triggered when the title of an issuable is updated.' + + field :issuable_labels_updated, subscription: Subscriptions::IssuableUpdated, null: true, + description: 'Triggered when the labels of an issuable are updated.' end end diff --git a/app/graphql/types/user_interface.rb b/app/graphql/types/user_interface.rb index 2c9592a7f5a..1c8a1352c72 100644 --- a/app/graphql/types/user_interface.rb +++ b/app/graphql/types/user_interface.rb @@ -118,7 +118,8 @@ module Types field :saved_replies, Types::SavedReplyType.connection_type, null: true, - description: 'Saved replies authored by the user.' + description: 'Saved replies authored by the user. ' \ + 'Will not return saved replies if `saved_replies` feature flag is disabled.' field :gitpod_enabled, GraphQL::Types::Boolean, null: true, description: 'Whether Gitpod is enabled at the user level.' |