From 3cccd102ba543e02725d247893729e5c73b38295 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 20 Apr 2022 10:00:54 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-10-stable-ee --- app/graphql/graphql_triggers.rb | 4 + app/graphql/mutations/ci/job/retry.rb | 18 +++- app/graphql/mutations/ci/pipeline/cancel.rb | 2 + .../environments/canary_ingress/update.rb | 13 +++ app/graphql/mutations/notes/update/note.rb | 3 +- app/graphql/mutations/saved_replies/base.rb | 2 +- app/graphql/mutations/saved_replies/destroy.rb | 23 +++++ app/graphql/mutations/saved_replies/update.rb | 2 +- app/graphql/mutations/todos/mark_all_done.rb | 29 +++++- app/graphql/mutations/user_preferences/update.rb | 17 ++++ app/graphql/mutations/work_items/create.rb | 2 +- .../mutations/work_items/create_from_task.rb | 2 +- app/graphql/mutations/work_items/delete.rb | 2 +- app/graphql/mutations/work_items/update.rb | 2 +- .../get_container_repositories.query.graphql | 2 + .../queries/releases/all_releases.query.graphql | 109 --------------------- app/graphql/resolvers/base_issues_resolver.rb | 13 ++- app/graphql/resolvers/base_resolver.rb | 2 +- .../resolvers/concerns/issue_resolver_arguments.rb | 1 + app/graphql/resolvers/groups_resolver.rb | 2 +- app/graphql/resolvers/work_item_resolver.rb | 2 +- app/graphql/resolvers/work_items/types_resolver.rb | 10 +- app/graphql/types/base_object.rb | 7 ++ app/graphql/types/ci/job_kind_enum.rb | 12 +++ app/graphql/types/ci/job_type.rb | 8 ++ .../types/ci/runner_upgrade_status_type_enum.rb | 21 ++++ app/graphql/types/container_repository_type.rb | 1 + .../types/dependency_proxy/manifest_type.rb | 4 + .../types/dependency_proxy/manifest_type_enum.rb | 11 +++ app/graphql/types/issue_connection.rb | 15 +++ app/graphql/types/issue_sort_enum.rb | 2 + app/graphql/types/mutation_type.rb | 1 + app/graphql/types/repository/blob_type.rb | 4 - app/graphql/types/subscription_type.rb | 3 + app/graphql/types/user_interface.rb | 3 +- 35 files changed, 218 insertions(+), 136 deletions(-) create mode 100644 app/graphql/mutations/saved_replies/destroy.rb delete mode 100644 app/graphql/queries/releases/all_releases.query.graphql create mode 100644 app/graphql/types/ci/job_kind_enum.rb create mode 100644 app/graphql/types/ci/runner_upgrade_status_type_enum.rb create mode 100644 app/graphql/types/dependency_proxy/manifest_type_enum.rb create mode 100644 app/graphql/types/issue_connection.rb (limited to 'app/graphql') diff --git a/app/graphql/graphql_triggers.rb b/app/graphql/graphql_triggers.rb index ac1a4a6b9ef..342cff83e90 100644 --- a/app/graphql/graphql_triggers.rb +++ b/app/graphql/graphql_triggers.rb @@ -12,4 +12,8 @@ module GraphqlTriggers def self.issuable_title_updated(issuable) GitlabSchema.subscriptions.trigger('issuableTitleUpdated', { issuable_id: issuable.to_gid }, issuable) end + + def self.issuable_labels_updated(issuable) + GitlabSchema.subscriptions.trigger('issuableLabelsUpdated', { issuable_id: issuable.to_gid }, issuable) + end end diff --git a/app/graphql/mutations/ci/job/retry.rb b/app/graphql/mutations/ci/job/retry.rb index 9af357ab216..50e9c51c9e7 100644 --- a/app/graphql/mutations/ci/job/retry.rb +++ b/app/graphql/mutations/ci/job/retry.rb @@ -17,11 +17,19 @@ module Mutations job = authorized_find!(id: id) project = job.project - ::Ci::RetryBuildService.new(project, current_user).execute(job) - { - job: job, - errors: errors_on_object(job) - } + response = ::Ci::RetryJobService.new(project, current_user).execute(job) + + if response.success? + { + job: response[:job], + errors: [] + } + else + { + job: nil, + errors: [response.message] + } + end end end end diff --git a/app/graphql/mutations/ci/pipeline/cancel.rb b/app/graphql/mutations/ci/pipeline/cancel.rb index 3fb34a37cfc..3ec6eee9f54 100644 --- a/app/graphql/mutations/ci/pipeline/cancel.rb +++ b/app/graphql/mutations/ci/pipeline/cancel.rb @@ -13,6 +13,8 @@ module Mutations if pipeline.cancelable? pipeline.cancel_running + pipeline.cancel + { success: true, errors: [] } else { success: false, errors: ['Pipeline is not cancelable'] } diff --git a/app/graphql/mutations/environments/canary_ingress/update.rb b/app/graphql/mutations/environments/canary_ingress/update.rb index e4ba08e6dcc..ce24b8842c6 100644 --- a/app/graphql/mutations/environments/canary_ingress/update.rb +++ b/app/graphql/mutations/environments/canary_ingress/update.rb @@ -5,6 +5,7 @@ module Mutations module CanaryIngress class Update < ::Mutations::BaseMutation graphql_name 'EnvironmentsCanaryIngressUpdate' + description '**Deprecated** This endpoint is planned to be removed along with certificate-based clusters. [See this epic](https://gitlab.com/groups/gitlab-org/configure/-/epics/8) for more information.' authorize :update_environment @@ -18,7 +19,13 @@ module Mutations required: true, description: 'Weight of the Canary Ingress.' + REMOVAL_ERR_MSG = 'This endpoint was deactivated as part of the certificate-based' \ + 'kubernetes integration removal. See Epic:' \ + 'https://gitlab.com/groups/gitlab-org/configure/-/epics/8' + def resolve(id:, **kwargs) + return { errors: [REMOVAL_ERR_MSG] } if cert_based_clusters_ff_disabled? + environment = authorized_find!(id: id) result = ::Environments::CanaryIngress::UpdateService @@ -33,6 +40,12 @@ module Mutations id = ::Types::GlobalIDType[::Environment].coerce_isolated_input(id) GitlabSchema.find_by_gid(id) end + + private + + def cert_based_clusters_ff_disabled? + Feature.disabled?(:certificate_based_clusters, default_enabled: :yaml, type: :ops) + end end end end diff --git a/app/graphql/mutations/notes/update/note.rb b/app/graphql/mutations/notes/update/note.rb index c7ee0148f94..a483294169f 100644 --- a/app/graphql/mutations/notes/update/note.rb +++ b/app/graphql/mutations/notes/update/note.rb @@ -15,7 +15,8 @@ module Mutations argument :confidential, GraphQL::Types::Boolean, required: false, - description: 'Confidentiality flag of a note. Default is false.' + description: 'Confidentiality flag of a note. Default is false.', + deprecated: { reason: 'No longer allowed to update confidentiality of notes', milestone: '14.10' } private diff --git a/app/graphql/mutations/saved_replies/base.rb b/app/graphql/mutations/saved_replies/base.rb index 468263b0f9d..59871df687f 100644 --- a/app/graphql/mutations/saved_replies/base.rb +++ b/app/graphql/mutations/saved_replies/base.rb @@ -5,7 +5,7 @@ module Mutations class Base < BaseMutation field :saved_reply, Types::SavedReplyType, null: true, - description: 'Updated saved reply.' + description: 'Saved reply after mutation.' private diff --git a/app/graphql/mutations/saved_replies/destroy.rb b/app/graphql/mutations/saved_replies/destroy.rb new file mode 100644 index 00000000000..7cd0f21ad45 --- /dev/null +++ b/app/graphql/mutations/saved_replies/destroy.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Mutations + module SavedReplies + class Destroy < Base + graphql_name 'SavedReplyDestroy' + + authorize :destroy_saved_replies + + argument :id, Types::GlobalIDType[::Users::SavedReply], + required: true, + description: copy_field_description(Types::SavedReplyType, :id) + + def resolve(id:) + raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless feature_enabled? + + saved_reply = authorized_find!(id) + result = ::Users::SavedReplies::DestroyService.new(saved_reply: saved_reply).execute + present_result(result) + end + end + end +end diff --git a/app/graphql/mutations/saved_replies/update.rb b/app/graphql/mutations/saved_replies/update.rb index bacc6ceb39e..d9368de7547 100644 --- a/app/graphql/mutations/saved_replies/update.rb +++ b/app/graphql/mutations/saved_replies/update.rb @@ -23,7 +23,7 @@ module Mutations raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless feature_enabled? saved_reply = authorized_find!(id) - result = ::Users::SavedReplies::UpdateService.new(current_user: current_user, saved_reply: saved_reply, name: name, content: content).execute + result = ::Users::SavedReplies::UpdateService.new(saved_reply: saved_reply, name: name, content: content).execute present_result(result) end end diff --git a/app/graphql/mutations/todos/mark_all_done.rb b/app/graphql/mutations/todos/mark_all_done.rb index 7dd06cc8293..67a822c1067 100644 --- a/app/graphql/mutations/todos/mark_all_done.rb +++ b/app/graphql/mutations/todos/mark_all_done.rb @@ -7,14 +7,22 @@ module Mutations authorize :update_user + TodoableID = Types::GlobalIDType[Todoable] + + argument :target_id, + TodoableID, + required: false, + description: "Global ID of the to-do item's parent. Issues, merge requests, designs, and epics are supported. " \ + "If argument is omitted, all pending to-do items of the current user are marked as done." + field :todos, [::Types::TodoType], null: false, description: 'Updated to-do items.' - def resolve + def resolve(**args) authorize!(current_user) - updated_ids = mark_all_todos_done + updated_ids = mark_all_todos_done(**args) { todos: Todo.id_in(updated_ids), @@ -24,10 +32,23 @@ module Mutations private - def mark_all_todos_done + def mark_all_todos_done(**args) return [] unless current_user - todos = TodosFinder.new(current_user).execute + finder_params = { state: :pending } + + if args[:target_id].present? + target = Gitlab::Graphql::Lazy.force( + GitlabSchema.find_by_gid(TodoableID.coerce_isolated_input(args[:target_id])) + ) + + raise Gitlab::Graphql::Errors::ResourceNotAvailable, "Resource not available: #{args[:target_id]}" if target.nil? + + finder_params[:type] = target.class.name + finder_params[:target_id] = target.id + end + + todos = TodosFinder.new(current_user, finder_params).execute TodoService.new.resolve_todos(todos, current_user, resolved_by_action: :api_all_done) end diff --git a/app/graphql/mutations/user_preferences/update.rb b/app/graphql/mutations/user_preferences/update.rb index c92c6d725b7..eface536a87 100644 --- a/app/graphql/mutations/user_preferences/update.rb +++ b/app/graphql/mutations/user_preferences/update.rb @@ -14,6 +14,15 @@ module Mutations null: true, description: 'User preferences after mutation.' + def ready?(**args) + if disabled_sort_value?(args) + raise Gitlab::Graphql::Errors::ArgumentError, + 'Feature flag `incident_escalations` must be enabled to use this sort order.' + end + + super + end + def resolve(**attributes) user_preferences = current_user.user_preference user_preferences.update(attributes) @@ -23,6 +32,14 @@ module Mutations errors: errors_on_object(user_preferences) } end + + private + + def disabled_sort_value?(args) + return false unless [:escalation_status_asc, :escalation_status_desc].include?(args[:issues_sort]) + + Feature.disabled?(:incident_escalations, default_enabled: :yaml) + end end end end diff --git a/app/graphql/mutations/work_items/create.rb b/app/graphql/mutations/work_items/create.rb index 48f0f470988..c29dbb899b5 100644 --- a/app/graphql/mutations/work_items/create.rb +++ b/app/graphql/mutations/work_items/create.rb @@ -33,7 +33,7 @@ module Mutations def resolve(project_path:, **attributes) project = authorized_find!(project_path) - unless Feature.enabled?(:work_items, project, default_enabled: :yaml) + unless project.work_items_feature_flag_enabled? return { errors: ['`work_items` feature flag disabled for this project'] } end diff --git a/app/graphql/mutations/work_items/create_from_task.rb b/app/graphql/mutations/work_items/create_from_task.rb index 16d1e646167..278c1bc65a9 100644 --- a/app/graphql/mutations/work_items/create_from_task.rb +++ b/app/graphql/mutations/work_items/create_from_task.rb @@ -31,7 +31,7 @@ module Mutations def resolve(id:, work_item_data:) work_item = authorized_find!(id: id) - unless Feature.enabled?(:work_items, work_item.project, default_enabled: :yaml) + unless work_item.project.work_items_feature_flag_enabled? return { errors: ['`work_items` feature flag disabled for this project'] } end diff --git a/app/graphql/mutations/work_items/delete.rb b/app/graphql/mutations/work_items/delete.rb index f32354878ec..3d72ebbd95d 100644 --- a/app/graphql/mutations/work_items/delete.rb +++ b/app/graphql/mutations/work_items/delete.rb @@ -20,7 +20,7 @@ module Mutations def resolve(id:) work_item = authorized_find!(id: id) - unless Feature.enabled?(:work_items, work_item.project, default_enabled: :yaml) + unless work_item.project.work_items_feature_flag_enabled? return { errors: ['`work_items` feature flag disabled for this project'] } end diff --git a/app/graphql/mutations/work_items/update.rb b/app/graphql/mutations/work_items/update.rb index 2700cbdb709..091237d6fa0 100644 --- a/app/graphql/mutations/work_items/update.rb +++ b/app/graphql/mutations/work_items/update.rb @@ -28,7 +28,7 @@ module Mutations def resolve(id:, **attributes) work_item = authorized_find!(id: id) - unless Feature.enabled?(:work_items, work_item.project, default_enabled: :yaml) + unless work_item.project.work_items_feature_flag_enabled? return { errors: ['`work_items` feature flag disabled for this project'] } end diff --git a/app/graphql/queries/container_registry/get_container_repositories.query.graphql b/app/graphql/queries/container_registry/get_container_repositories.query.graphql index 40e2934a038..264878ccaa2 100644 --- a/app/graphql/queries/container_registry/get_container_repositories.query.graphql +++ b/app/graphql/queries/container_registry/get_container_repositories.query.graphql @@ -23,6 +23,7 @@ query getProjectContainerRepositories( __typename nodes { id + migrationState name path status @@ -57,6 +58,7 @@ query getProjectContainerRepositories( __typename nodes { id + migrationState name path status diff --git a/app/graphql/queries/releases/all_releases.query.graphql b/app/graphql/queries/releases/all_releases.query.graphql deleted file mode 100644 index 150f59832f3..00000000000 --- a/app/graphql/queries/releases/all_releases.query.graphql +++ /dev/null @@ -1,109 +0,0 @@ -# This query is identical to -# `app/assets/javascripts/releases/graphql/queries/all_releases.query.graphql`. -# These two queries should be kept in sync. -query allReleases( - $fullPath: ID! - $first: Int - $last: Int - $before: String - $after: String - $sort: ReleaseSort -) { - project(fullPath: $fullPath) { - __typename - id - releases(first: $first, last: $last, before: $before, after: $after, sort: $sort) { - __typename - nodes { - __typename - name - tagName - tagPath - descriptionHtml - releasedAt - createdAt - upcomingRelease - assets { - __typename - count - sources { - __typename - nodes { - __typename - format - url - } - } - links { - __typename - nodes { - __typename - id - name - url - directAssetUrl - linkType - external - } - } - } - evidences { - __typename - nodes { - __typename - id - filepath - collectedAt - sha - } - } - links { - __typename - editUrl - selfUrl - openedIssuesUrl - closedIssuesUrl - openedMergeRequestsUrl - mergedMergeRequestsUrl - closedMergeRequestsUrl - } - commit { - __typename - id - sha - webUrl - title - } - author { - __typename - id - webUrl - avatarUrl - username - } - milestones { - __typename - nodes { - __typename - id - title - description - webPath - stats { - __typename - totalIssuesCount - closedIssuesCount - } - } - } - } - pageInfo { - __typename - startCursor - hasPreviousPage - hasNextPage - endCursor - } - } - } -} diff --git a/app/graphql/resolvers/base_issues_resolver.rb b/app/graphql/resolvers/base_issues_resolver.rb index 3e7509b4068..4cae7866a49 100644 --- a/app/graphql/resolvers/base_issues_resolver.rb +++ b/app/graphql/resolvers/base_issues_resolver.rb @@ -12,12 +12,14 @@ module Resolvers required: false, description: 'Current state of this issue.' - type Types::IssueType.connection_type, null: true + # see app/graphql/types/issue_connection.rb + type 'Types::IssueConnection', null: true NON_STABLE_CURSOR_SORTS = %i[priority_asc priority_desc popularity_asc popularity_desc label_priority_asc label_priority_desc - milestone_due_asc milestone_due_desc].freeze + milestone_due_asc milestone_due_desc + escalation_status_asc escalation_status_desc].freeze def continue_issue_resolve(parent, finder, **args) issues = Gitlab::Graphql::Loaders::IssuableLoader.new(parent, finder).batching_find_all { |q| apply_lookahead(q) } @@ -31,6 +33,13 @@ module Resolvers end end + def prepare_params(args, parent) + return unless [:escalation_status_asc, :escalation_status_desc].include?(args[:sort]) + return if Feature.enabled?(:incident_escalations, parent, default_enabled: :yaml) + + args[:sort] = :created_desc # default for sort argument + end + private def unconditional_includes diff --git a/app/graphql/resolvers/base_resolver.rb b/app/graphql/resolvers/base_resolver.rb index 20ed089d159..dbded8f60a0 100644 --- a/app/graphql/resolvers/base_resolver.rb +++ b/app/graphql/resolvers/base_resolver.rb @@ -142,7 +142,7 @@ module Resolvers def object super.tap do |obj| # If the field this resolver is used in is wrapped in a presenter, unwrap its subject - break obj.subject if obj.is_a?(Gitlab::View::Presenter::Base) + break obj.__subject__ if obj.is_a?(Gitlab::View::Presenter::Base) end end diff --git a/app/graphql/resolvers/concerns/issue_resolver_arguments.rb b/app/graphql/resolvers/concerns/issue_resolver_arguments.rb index 38c79ff52ac..432d6f48607 100644 --- a/app/graphql/resolvers/concerns/issue_resolver_arguments.rb +++ b/app/graphql/resolvers/concerns/issue_resolver_arguments.rb @@ -84,6 +84,7 @@ module IssueResolverArguments prepare_assignee_username_params(args) prepare_release_tag_params(args) + prepare_params(args, parent) if defined?(prepare_params) finder = IssuesFinder.new(current_user, args) diff --git a/app/graphql/resolvers/groups_resolver.rb b/app/graphql/resolvers/groups_resolver.rb index abd3bf9e6e0..6cfdba240f0 100644 --- a/app/graphql/resolvers/groups_resolver.rb +++ b/app/graphql/resolvers/groups_resolver.rb @@ -30,7 +30,7 @@ module Resolvers GroupsFinder .new(context[:current_user], args.merge(parent: parent)) .execute - .reorder('name ASC') + .reorder(name: :asc) end # rubocop: enable CodeReuse/ActiveRecord end diff --git a/app/graphql/resolvers/work_item_resolver.rb b/app/graphql/resolvers/work_item_resolver.rb index 7cf52339815..ad510849f31 100644 --- a/app/graphql/resolvers/work_item_resolver.rb +++ b/app/graphql/resolvers/work_item_resolver.rb @@ -12,7 +12,7 @@ module Resolvers def resolve(id:) work_item = authorized_find!(id: id) - return unless Feature.enabled?(:work_items, work_item.project, default_enabled: :yaml) + return unless work_item.project.work_items_feature_flag_enabled? work_item end diff --git a/app/graphql/resolvers/work_items/types_resolver.rb b/app/graphql/resolvers/work_items/types_resolver.rb index 67a9d57d42f..5f9f8ab5572 100644 --- a/app/graphql/resolvers/work_items/types_resolver.rb +++ b/app/graphql/resolvers/work_items/types_resolver.rb @@ -11,7 +11,7 @@ module Resolvers ' Argument is experimental and can be removed in the future without notice.' def resolve(taskable: nil) - return unless Feature.enabled?(:work_items, object, default_enabled: :yaml) + return unless feature_flag_enabled_for_parent?(object) # This will require a finder in the future when groups/projects get their work item types # All groups/projects use the default types for now @@ -20,6 +20,14 @@ module Resolvers base_scope.order_by_name_asc end + + private + + def feature_flag_enabled_for_parent?(parent) + return false unless parent.is_a?(::Project) || parent.is_a?(::Group) + + parent.work_items_feature_flag_enabled? + end end end end 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.' -- cgit v1.2.1