diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/graphql | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/graphql')
176 files changed, 1125 insertions, 503 deletions
diff --git a/app/graphql/mutations/admin/sidekiq_queues/delete_jobs.rb b/app/graphql/mutations/admin/sidekiq_queues/delete_jobs.rb index 17f9b5b5637..32ca6de9b96 100644 --- a/app/graphql/mutations/admin/sidekiq_queues/delete_jobs.rb +++ b/app/graphql/mutations/admin/sidekiq_queues/delete_jobs.rb @@ -18,12 +18,12 @@ module Mutations argument :queue_name, GraphQL::STRING_TYPE, required: true, - description: 'The name of the queue to delete jobs from' + description: 'The name of the queue to delete jobs from.' field :result, Types::Admin::SidekiqQueues::DeleteJobsResponseType, null: true, - description: 'Information about the status of the deletion request' + description: 'Information about the status of the deletion request.' def ready?(**args) unless current_user&.admin? diff --git a/app/graphql/mutations/alert_management/base.rb b/app/graphql/mutations/alert_management/base.rb index 8c6b4005cf8..3a57cb9670d 100644 --- a/app/graphql/mutations/alert_management/base.rb +++ b/app/graphql/mutations/alert_management/base.rb @@ -7,26 +7,26 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: "The project the alert to mutate is in" + description: "The project the alert to mutate is in." argument :iid, GraphQL::STRING_TYPE, required: true, - description: "The IID of the alert to mutate" + description: "The IID of the alert to mutate." field :alert, Types::AlertManagement::AlertType, null: true, - description: "The alert after mutation" + description: "The alert after mutation." field :todo, Types::TodoType, null: true, - description: "The todo after mutation" + description: "The todo after mutation." field :issue, Types::IssueType, null: true, - description: "The issue created after mutation" + description: "The issue created after mutation." authorize :update_alert_management_alert diff --git a/app/graphql/mutations/alert_management/http_integration/create.rb b/app/graphql/mutations/alert_management/http_integration/create.rb index ddb75e66bb4..ff165d7f302 100644 --- a/app/graphql/mutations/alert_management/http_integration/create.rb +++ b/app/graphql/mutations/alert_management/http_integration/create.rb @@ -10,32 +10,41 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'The project to create the integration in' + description: 'The project to create the integration in.' argument :name, GraphQL::STRING_TYPE, required: true, - description: 'The name of the integration' + description: 'The name of the integration.' argument :active, GraphQL::BOOLEAN_TYPE, required: true, - description: 'Whether the integration is receiving alerts' + description: 'Whether the integration is receiving alerts.' def resolve(args) - project = authorized_find!(full_path: args[:project_path]) + @project = authorized_find!(full_path: args[:project_path]) response ::AlertManagement::HttpIntegrations::CreateService.new( project, current_user, - args.slice(:name, :active) + http_integration_params(args) ).execute end private + attr_reader :project + def find_object(full_path:) resolve_project(full_path: full_path) end + + # overriden in EE + def http_integration_params(args) + args.slice(:name, :active) + end end end end end + +Mutations::AlertManagement::HttpIntegration::Create.prepend_if_ee('::EE::Mutations::AlertManagement::HttpIntegration::Create') diff --git a/app/graphql/mutations/alert_management/http_integration/destroy.rb b/app/graphql/mutations/alert_management/http_integration/destroy.rb index 45d4bd778da..d0420e2bcb5 100644 --- a/app/graphql/mutations/alert_management/http_integration/destroy.rb +++ b/app/graphql/mutations/alert_management/http_integration/destroy.rb @@ -8,7 +8,7 @@ module Mutations argument :id, Types::GlobalIDType[::AlertManagement::HttpIntegration], required: true, - description: "The ID of the integration to remove" + description: "The ID of the integration to remove." def resolve(id:) integration = authorized_find!(id: id) diff --git a/app/graphql/mutations/alert_management/http_integration/http_integration_base.rb b/app/graphql/mutations/alert_management/http_integration/http_integration_base.rb index d328eabf244..147df982bec 100644 --- a/app/graphql/mutations/alert_management/http_integration/http_integration_base.rb +++ b/app/graphql/mutations/alert_management/http_integration/http_integration_base.rb @@ -7,7 +7,7 @@ module Mutations field :integration, Types::AlertManagement::HttpIntegrationType, null: true, - description: "The HTTP integration" + description: "The HTTP integration." authorize :admin_operations diff --git a/app/graphql/mutations/alert_management/http_integration/reset_token.rb b/app/graphql/mutations/alert_management/http_integration/reset_token.rb index 3938b38260e..bf73a9eaae7 100644 --- a/app/graphql/mutations/alert_management/http_integration/reset_token.rb +++ b/app/graphql/mutations/alert_management/http_integration/reset_token.rb @@ -8,7 +8,7 @@ module Mutations argument :id, Types::GlobalIDType[::AlertManagement::HttpIntegration], required: true, - description: "The ID of the integration to mutate" + description: "The ID of the integration to mutate." def resolve(id:) integration = authorized_find!(id: id) diff --git a/app/graphql/mutations/alert_management/http_integration/update.rb b/app/graphql/mutations/alert_management/http_integration/update.rb index 98e0f7eb14f..431fccaa5e5 100644 --- a/app/graphql/mutations/alert_management/http_integration/update.rb +++ b/app/graphql/mutations/alert_management/http_integration/update.rb @@ -8,15 +8,15 @@ module Mutations argument :id, Types::GlobalIDType[::AlertManagement::HttpIntegration], required: true, - description: "The ID of the integration to mutate" + description: "The ID of the integration to mutate." argument :name, GraphQL::STRING_TYPE, required: false, - description: "The name of the integration" + description: "The name of the integration." argument :active, GraphQL::BOOLEAN_TYPE, required: false, - description: "Whether the integration is receiving alerts" + description: "Whether the integration is receiving alerts." def resolve(args) integration = authorized_find!(id: args[:id]) diff --git a/app/graphql/mutations/alert_management/prometheus_integration/create.rb b/app/graphql/mutations/alert_management/prometheus_integration/create.rb index 935ec53795c..c676cde90b4 100644 --- a/app/graphql/mutations/alert_management/prometheus_integration/create.rb +++ b/app/graphql/mutations/alert_management/prometheus_integration/create.rb @@ -10,15 +10,15 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'The project to create the integration in' + description: 'The project to create the integration in.' argument :active, GraphQL::BOOLEAN_TYPE, required: true, - description: 'Whether the integration is receiving alerts' + description: 'Whether the integration is receiving alerts.' argument :api_url, GraphQL::STRING_TYPE, required: true, - description: 'Endpoint at which prometheus can be queried' + description: 'Endpoint at which prometheus can be queried.' def resolve(args) project = authorized_find!(full_path: args[:project_path]) diff --git a/app/graphql/mutations/alert_management/prometheus_integration/prometheus_integration_base.rb b/app/graphql/mutations/alert_management/prometheus_integration/prometheus_integration_base.rb index 6b690ac239a..cb243f49b33 100644 --- a/app/graphql/mutations/alert_management/prometheus_integration/prometheus_integration_base.rb +++ b/app/graphql/mutations/alert_management/prometheus_integration/prometheus_integration_base.rb @@ -7,7 +7,7 @@ module Mutations field :integration, Types::AlertManagement::PrometheusIntegrationType, null: true, - description: "The newly created integration" + description: "The newly created integration." authorize :admin_project diff --git a/app/graphql/mutations/alert_management/prometheus_integration/reset_token.rb b/app/graphql/mutations/alert_management/prometheus_integration/reset_token.rb index effecd8364d..428be091436 100644 --- a/app/graphql/mutations/alert_management/prometheus_integration/reset_token.rb +++ b/app/graphql/mutations/alert_management/prometheus_integration/reset_token.rb @@ -8,7 +8,7 @@ module Mutations argument :id, Types::GlobalIDType[::PrometheusService], required: true, - description: "The ID of the integration to mutate" + description: "The ID of the integration to mutate." def resolve(id:) integration = authorized_find!(id: id) diff --git a/app/graphql/mutations/alert_management/prometheus_integration/update.rb b/app/graphql/mutations/alert_management/prometheus_integration/update.rb index 46f4c23b739..62fb81bca5a 100644 --- a/app/graphql/mutations/alert_management/prometheus_integration/update.rb +++ b/app/graphql/mutations/alert_management/prometheus_integration/update.rb @@ -8,15 +8,15 @@ module Mutations argument :id, Types::GlobalIDType[::PrometheusService], required: true, - description: "The ID of the integration to mutate" + description: "The ID of the integration to mutate." argument :active, GraphQL::BOOLEAN_TYPE, required: false, - description: "Whether the integration is receiving alerts" + description: "Whether the integration is receiving alerts." argument :api_url, GraphQL::STRING_TYPE, required: false, - description: "Endpoint at which prometheus can be queried" + description: "Endpoint at which prometheus can be queried." def resolve(args) integration = authorized_find!(id: args[:id]) diff --git a/app/graphql/mutations/alert_management/update_alert_status.rb b/app/graphql/mutations/alert_management/update_alert_status.rb index 74185dca529..67f8ba9118f 100644 --- a/app/graphql/mutations/alert_management/update_alert_status.rb +++ b/app/graphql/mutations/alert_management/update_alert_status.rb @@ -7,7 +7,7 @@ module Mutations argument :status, Types::AlertManagement::StatusEnum, required: true, - description: 'The status to set the alert' + description: 'The status to set the alert.' def resolve(project_path:, iid:, status:) alert = authorized_find!(project_path: project_path, iid: iid) diff --git a/app/graphql/mutations/award_emojis/base.rb b/app/graphql/mutations/award_emojis/base.rb index 4bd8304c3fc..4f41a9cafd8 100644 --- a/app/graphql/mutations/award_emojis/base.rb +++ b/app/graphql/mutations/award_emojis/base.rb @@ -12,7 +12,7 @@ module Mutations argument :awardable_id, ::Types::GlobalIDType[::Awardable], required: true, - description: 'The global ID of the awardable resource' + description: 'The global ID of the awardable resource.' argument :name, GraphQL::STRING_TYPE, @@ -22,7 +22,7 @@ module Mutations field :award_emoji, Types::AwardEmojis::AwardEmojiType, null: true, - description: 'The award emoji after mutation' + description: 'The award emoji after mutation.' private diff --git a/app/graphql/mutations/boards/destroy.rb b/app/graphql/mutations/boards/destroy.rb index 7c381113d38..8ec13b885d5 100644 --- a/app/graphql/mutations/boards/destroy.rb +++ b/app/graphql/mutations/boards/destroy.rb @@ -8,11 +8,11 @@ module Mutations field :board, Types::BoardType, null: true, - description: 'The board after mutation' + description: 'The board after mutation.' argument :id, ::Types::GlobalIDType[::Board], required: true, - description: 'The global ID of the board to destroy' + description: 'The global ID of the board to destroy.' authorize :admin_board diff --git a/app/graphql/mutations/boards/issues/issue_move_list.rb b/app/graphql/mutations/boards/issues/issue_move_list.rb index 813b6d3cb2a..91dfd9fc3e9 100644 --- a/app/graphql/mutations/boards/issues/issue_move_list.rb +++ b/app/graphql/mutations/boards/issues/issue_move_list.rb @@ -9,31 +9,31 @@ module Mutations argument :board_id, GraphQL::ID_TYPE, required: true, loads: Types::BoardType, - description: 'Global ID of the board that the issue is in' + description: 'Global ID of the board that the issue is in.' argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'Project the issue to mutate is in' + description: 'Project the issue to mutate is in.' argument :iid, GraphQL::STRING_TYPE, required: true, - description: 'IID of the issue to mutate' + description: 'IID of the issue to mutate.' argument :from_list_id, GraphQL::ID_TYPE, required: false, - description: 'ID of the board list that the issue will be moved from' + description: 'ID of the board list that the issue will be moved from.' argument :to_list_id, GraphQL::ID_TYPE, required: false, - description: 'ID of the board list that the issue will be moved to' + description: 'ID of the board list that the issue will be moved to.' argument :move_before_id, GraphQL::ID_TYPE, required: false, - description: 'ID of issue that should be placed before the current issue' + description: 'ID of issue that should be placed before the current issue.' argument :move_after_id, GraphQL::ID_TYPE, required: false, - description: 'ID of issue that should be placed after the current issue' + description: 'ID of issue that should be placed after the current issue.' def ready?(**args) if move_arguments(args).blank? diff --git a/app/graphql/mutations/boards/lists/base.rb b/app/graphql/mutations/boards/lists/base.rb index d244d6bf8dd..34c138bddc9 100644 --- a/app/graphql/mutations/boards/lists/base.rb +++ b/app/graphql/mutations/boards/lists/base.rb @@ -8,12 +8,12 @@ module Mutations argument :board_id, ::Types::GlobalIDType[::Board], required: true, - description: 'Global ID of the issue board to mutate' + description: 'Global ID of the issue board to mutate.' field :list, Types::BoardListType, null: true, - description: 'List of the issue board' + description: 'List of the issue board.' authorize :admin_list diff --git a/app/graphql/mutations/boards/lists/create.rb b/app/graphql/mutations/boards/lists/create.rb index f6df63365b2..9eb9a4d4b87 100644 --- a/app/graphql/mutations/boards/lists/create.rb +++ b/app/graphql/mutations/boards/lists/create.rb @@ -8,11 +8,11 @@ module Mutations argument :backlog, GraphQL::BOOLEAN_TYPE, required: false, - description: 'Create the backlog list' + description: 'Create the backlog list.' argument :label_id, ::Types::GlobalIDType[::Label], required: false, - description: 'Global ID of an existing label' + description: 'Global ID of an existing label.' def ready?(**args) if args.slice(*mutually_exclusive_args).size != 1 diff --git a/app/graphql/mutations/boards/lists/update.rb b/app/graphql/mutations/boards/lists/update.rb index 14502b5174f..d30d1d89bb2 100644 --- a/app/graphql/mutations/boards/lists/update.rb +++ b/app/graphql/mutations/boards/lists/update.rb @@ -13,16 +13,16 @@ module Mutations argument :position, GraphQL::INT_TYPE, required: false, - description: 'Position of list within the board' + description: 'Position of list within the board.' argument :collapsed, GraphQL::BOOLEAN_TYPE, required: false, - description: 'Indicates if list is collapsed for this user' + description: 'Indicates if list is collapsed for this user.' field :list, Types::BoardListType, null: true, - description: 'Mutated list' + description: 'Mutated list.' def resolve(list: nil, **args) raise_resource_not_available_error! unless can_read_list?(list) diff --git a/app/graphql/mutations/boards/update.rb b/app/graphql/mutations/boards/update.rb index 5cb434e41fd..b4f8179829e 100644 --- a/app/graphql/mutations/boards/update.rb +++ b/app/graphql/mutations/boards/update.rb @@ -30,6 +30,8 @@ module Mutations } end + private + def find_object(id:) # TODO: remove this line when the compatibility layer is removed # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 diff --git a/app/graphql/mutations/branches/create.rb b/app/graphql/mutations/branches/create.rb index 214fead2e80..9fe9bef5403 100644 --- a/app/graphql/mutations/branches/create.rb +++ b/app/graphql/mutations/branches/create.rb @@ -9,21 +9,21 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'Project full path the branch is associated with' + description: 'Project full path the branch is associated with.' argument :name, GraphQL::STRING_TYPE, required: true, - description: 'Name of the branch' + description: 'Name of the branch.' argument :ref, GraphQL::STRING_TYPE, required: true, - description: 'Branch name or commit SHA to create branch from' + description: 'Branch name or commit SHA to create branch from.' field :branch, Types::BranchType, null: true, - description: 'Branch after mutation' + description: 'Branch after mutation.' authorize :push_code diff --git a/app/graphql/mutations/ci/base.rb b/app/graphql/mutations/ci/base.rb deleted file mode 100644 index 0ccee5661b7..00000000000 --- a/app/graphql/mutations/ci/base.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module Ci - class Base < BaseMutation - PipelineID = ::Types::GlobalIDType[::Ci::Pipeline] - - argument :id, PipelineID, - required: true, - description: 'The ID of the pipeline to mutate' - - private - - def find_object(id:) - # TODO: remove this line when the compatibility layer is removed - # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 - id = PipelineID.coerce_isolated_input(id) - GlobalID::Locator.locate(id) - end - end - end -end diff --git a/app/graphql/mutations/ci/ci_cd_settings_update.rb b/app/graphql/mutations/ci/ci_cd_settings_update.rb new file mode 100644 index 00000000000..6b7750ee860 --- /dev/null +++ b/app/graphql/mutations/ci/ci_cd_settings_update.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Mutations + module Ci + class CiCdSettingsUpdate < BaseMutation + include FindsProject + + graphql_name 'CiCdSettingsUpdate' + + authorize :admin_project + + argument :full_path, GraphQL::ID_TYPE, + required: true, + description: 'Full Path of the project the settings belong to.' + + argument :keep_latest_artifact, GraphQL::BOOLEAN_TYPE, + required: false, + description: 'Indicates if the latest artifact should be kept for this project.' + + def resolve(full_path:, **args) + project = authorized_find!(full_path) + settings = project.ci_cd_settings + settings.update(args) + + { errors: errors_on_object(settings) } + end + end + end +end diff --git a/app/graphql/mutations/ci/pipeline/base.rb b/app/graphql/mutations/ci/pipeline/base.rb new file mode 100644 index 00000000000..ebfab56e743 --- /dev/null +++ b/app/graphql/mutations/ci/pipeline/base.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Mutations + module Ci + module Pipeline + class Base < BaseMutation + PipelineID = ::Types::GlobalIDType[::Ci::Pipeline] + + argument :id, PipelineID, + required: true, + description: 'The ID of the pipeline to mutate.' + + private + + def find_object(id:) + # TODO: remove this line when the compatibility layer is removed + # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 + id = PipelineID.coerce_isolated_input(id) + GlobalID::Locator.locate(id) + end + end + end + end +end diff --git a/app/graphql/mutations/ci/pipeline/cancel.rb b/app/graphql/mutations/ci/pipeline/cancel.rb new file mode 100644 index 00000000000..3fb34a37cfc --- /dev/null +++ b/app/graphql/mutations/ci/pipeline/cancel.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Mutations + module Ci + module Pipeline + class Cancel < Base + graphql_name 'PipelineCancel' + + authorize :update_pipeline + + def resolve(id:) + pipeline = authorized_find!(id: id) + + if pipeline.cancelable? + pipeline.cancel_running + { success: true, errors: [] } + else + { success: false, errors: ['Pipeline is not cancelable'] } + end + end + end + end + end +end diff --git a/app/graphql/mutations/ci/pipeline/destroy.rb b/app/graphql/mutations/ci/pipeline/destroy.rb new file mode 100644 index 00000000000..3f933818ce1 --- /dev/null +++ b/app/graphql/mutations/ci/pipeline/destroy.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Mutations + module Ci + module Pipeline + class Destroy < Base + graphql_name 'PipelineDestroy' + + authorize :destroy_pipeline + + def resolve(id:) + pipeline = authorized_find!(id: id) + project = pipeline.project + + result = ::Ci::DestroyPipelineService.new(project, current_user).execute(pipeline) + { + success: result.success?, + errors: result.errors + } + end + end + end + end +end diff --git a/app/graphql/mutations/ci/pipeline/retry.rb b/app/graphql/mutations/ci/pipeline/retry.rb new file mode 100644 index 00000000000..a12330470f0 --- /dev/null +++ b/app/graphql/mutations/ci/pipeline/retry.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Mutations + module Ci + module Pipeline + class Retry < Base + graphql_name 'PipelineRetry' + + field :pipeline, + Types::Ci::PipelineType, + null: true, + description: 'The pipeline after mutation.' + + authorize :update_pipeline + + def resolve(id:) + pipeline = authorized_find!(id: id) + project = pipeline.project + + ::Ci::RetryPipelineService.new(project, current_user).execute(pipeline) + { + pipeline: pipeline, + errors: errors_on_object(pipeline) + } + end + end + end + end +end diff --git a/app/graphql/mutations/ci/pipeline_cancel.rb b/app/graphql/mutations/ci/pipeline_cancel.rb deleted file mode 100644 index bc881e2ac02..00000000000 --- a/app/graphql/mutations/ci/pipeline_cancel.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module Ci - class PipelineCancel < Base - graphql_name 'PipelineCancel' - - authorize :update_pipeline - - def resolve(id:) - pipeline = authorized_find!(id: id) - - if pipeline.cancelable? - pipeline.cancel_running - { success: true, errors: [] } - else - { success: false, errors: ['Pipeline is not cancelable'] } - end - end - end - end -end diff --git a/app/graphql/mutations/ci/pipeline_destroy.rb b/app/graphql/mutations/ci/pipeline_destroy.rb deleted file mode 100644 index bb24d416583..00000000000 --- a/app/graphql/mutations/ci/pipeline_destroy.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module Ci - class PipelineDestroy < Base - graphql_name 'PipelineDestroy' - - authorize :destroy_pipeline - - def resolve(id:) - pipeline = authorized_find!(id: id) - project = pipeline.project - - result = ::Ci::DestroyPipelineService.new(project, current_user).execute(pipeline) - { - success: result.success?, - errors: result.errors - } - end - end - end -end diff --git a/app/graphql/mutations/ci/pipeline_retry.rb b/app/graphql/mutations/ci/pipeline_retry.rb deleted file mode 100644 index 0669bfc449c..00000000000 --- a/app/graphql/mutations/ci/pipeline_retry.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module Ci - class PipelineRetry < Base - graphql_name 'PipelineRetry' - - field :pipeline, - Types::Ci::PipelineType, - null: true, - description: 'The pipeline after mutation' - - authorize :update_pipeline - - def resolve(id:) - pipeline = authorized_find!(id: id) - project = pipeline.project - - ::Ci::RetryPipelineService.new(project, current_user).execute(pipeline) - { - pipeline: pipeline, - errors: errors_on_object(pipeline) - } - end - end - end -end diff --git a/app/graphql/mutations/commits/create.rb b/app/graphql/mutations/commits/create.rb index 2b9107350fd..ae14401558b 100644 --- a/app/graphql/mutations/commits/create.rb +++ b/app/graphql/mutations/commits/create.rb @@ -9,15 +9,15 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'Project full path the branch is associated with' + description: 'Project full path the branch is associated with.' argument :branch, GraphQL::STRING_TYPE, required: true, - description: 'Name of the branch to commit into, it can be a new branch' + description: 'Name of the branch to commit into, it can be a new branch.' argument :start_branch, GraphQL::STRING_TYPE, required: false, - description: 'If on a new branch, name of the original branch' + description: 'If on a new branch, name of the original branch.' argument :message, GraphQL::STRING_TYPE, @@ -27,12 +27,12 @@ module Mutations argument :actions, [Types::CommitActionType], required: true, - description: 'Array of action hashes to commit as a batch' + description: 'Array of action hashes to commit as a batch.' field :commit, Types::CommitType, null: true, - description: 'The commit after mutation' + description: 'The commit after mutation.' authorize :push_code diff --git a/app/graphql/mutations/concerns/mutations/authorizes_project.rb b/app/graphql/mutations/concerns/mutations/authorizes_project.rb deleted file mode 100644 index 87341525d6c..00000000000 --- a/app/graphql/mutations/concerns/mutations/authorizes_project.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module AuthorizesProject - include ResolvesProject - - def authorized_find_project!(full_path:) - authorized_find!(full_path: full_path) - end - - private - - def find_object(full_path:) - resolve_project(full_path: full_path) - end - end -end diff --git a/app/graphql/mutations/concerns/mutations/finds_project.rb b/app/graphql/mutations/concerns/mutations/finds_project.rb new file mode 100644 index 00000000000..577f9dc90f8 --- /dev/null +++ b/app/graphql/mutations/concerns/mutations/finds_project.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Mutations + module FindsProject + private + + def find_object(full_path) + Project.find_by_full_path(full_path) + end + end +end diff --git a/app/graphql/mutations/concerns/mutations/resolves_namespace.rb b/app/graphql/mutations/concerns/mutations/resolves_namespace.rb new file mode 100644 index 00000000000..35009623c69 --- /dev/null +++ b/app/graphql/mutations/concerns/mutations/resolves_namespace.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Mutations + module ResolvesNamespace + extend ActiveSupport::Concern + + def resolve_namespace(full_path:) + namespace_resolver.resolve(full_path: full_path) + end + + def namespace_resolver + Resolvers::NamespaceResolver.new(object: nil, context: context, field: nil) + end + end +end diff --git a/app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb b/app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb index 04a9abf9529..e2b3f4b046f 100644 --- a/app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb +++ b/app/graphql/mutations/concerns/mutations/resolves_resource_parent.rb @@ -9,11 +9,11 @@ module Mutations included do argument :project_path, GraphQL::ID_TYPE, required: false, - description: 'The project full path the resource is associated with' + description: 'The project full path the resource is associated with.' argument :group_path, GraphQL::ID_TYPE, required: false, - description: 'The group full path the resource is associated with' + description: 'The group full path the resource is associated with.' end def ready?(**args) diff --git a/app/graphql/mutations/concerns/mutations/resolves_subscription.rb b/app/graphql/mutations/concerns/mutations/resolves_subscription.rb index e8c5d0d404d..e26ae7d228c 100644 --- a/app/graphql/mutations/concerns/mutations/resolves_subscription.rb +++ b/app/graphql/mutations/concerns/mutations/resolves_subscription.rb @@ -7,7 +7,7 @@ module Mutations argument :subscribed_state, GraphQL::BOOLEAN_TYPE, required: true, - description: 'The desired state of the subscription' + description: 'The desired state of the subscription.' end def resolve(project_path:, iid:, subscribed_state:) diff --git a/app/graphql/mutations/concerns/mutations/spammable_mutation_fields.rb b/app/graphql/mutations/concerns/mutations/spammable_mutation_fields.rb index 7aef55f8011..e5df8565618 100644 --- a/app/graphql/mutations/concerns/mutations/spammable_mutation_fields.rb +++ b/app/graphql/mutations/concerns/mutations/spammable_mutation_fields.rb @@ -8,7 +8,7 @@ module Mutations field :spam, GraphQL::BOOLEAN_TYPE, null: true, - description: 'Indicates whether the operation returns a record detected as spam' + description: 'Indicates whether the operation returns a record detected as spam.' end def with_spam_params(&block) diff --git a/app/graphql/mutations/container_expiration_policies/update.rb b/app/graphql/mutations/container_expiration_policies/update.rb index 4bff04bb705..37cf2fa6bf3 100644 --- a/app/graphql/mutations/container_expiration_policies/update.rb +++ b/app/graphql/mutations/container_expiration_policies/update.rb @@ -12,7 +12,7 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'The project path where the container expiration policy is located' + description: 'The project path where the container expiration policy is located.' argument :enabled, GraphQL::BOOLEAN_TYPE, @@ -47,7 +47,7 @@ module Mutations field :container_expiration_policy, Types::ContainerExpirationPolicyType, null: true, - description: 'The container expiration policy after mutation' + description: 'The container expiration policy after mutation.' def resolve(project_path:, **args) project = authorized_find!(full_path: project_path) diff --git a/app/graphql/mutations/container_repositories/destroy_tags.rb b/app/graphql/mutations/container_repositories/destroy_tags.rb index ca6a67867c3..636ceccee04 100644 --- a/app/graphql/mutations/container_repositories/destroy_tags.rb +++ b/app/graphql/mutations/container_repositories/destroy_tags.rb @@ -28,7 +28,7 @@ module Mutations field :deleted_tag_names, [GraphQL::STRING_TYPE], - description: 'Deleted container repository tags', + description: 'Deleted container repository tags.', null: false def resolve(id:, tag_names:) diff --git a/app/graphql/mutations/custom_emoji/create.rb b/app/graphql/mutations/custom_emoji/create.rb index d912a29d12e..9ec96be0f26 100644 --- a/app/graphql/mutations/custom_emoji/create.rb +++ b/app/graphql/mutations/custom_emoji/create.rb @@ -12,20 +12,20 @@ module Mutations field :custom_emoji, Types::CustomEmojiType, null: true, - description: 'The new custom emoji' + description: 'The new custom emoji.' argument :group_path, GraphQL::ID_TYPE, required: true, - description: 'Namespace full path the emoji is associated with' + description: 'Namespace full path the emoji is associated with.' argument :name, GraphQL::STRING_TYPE, required: true, - description: 'Name of the emoji' + description: 'Name of the emoji.' argument :url, GraphQL::STRING_TYPE, required: true, as: :file, - description: 'Location of the emoji file' + description: 'Location of the emoji file.' def resolve(group_path:, **args) group = authorized_find!(group_path: group_path) diff --git a/app/graphql/mutations/design_management/base.rb b/app/graphql/mutations/design_management/base.rb index 69fd22e46cd..14d85885793 100644 --- a/app/graphql/mutations/design_management/base.rb +++ b/app/graphql/mutations/design_management/base.rb @@ -7,11 +7,11 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: "The project where the issue is to upload designs for" + description: "The project where the issue is to upload designs for." argument :iid, GraphQL::ID_TYPE, required: true, - description: "The IID of the issue to modify designs for" + description: "The IID of the issue to modify designs for." private diff --git a/app/graphql/mutations/design_management/delete.rb b/app/graphql/mutations/design_management/delete.rb index d2ef2c9bcca..f604542edef 100644 --- a/app/graphql/mutations/design_management/delete.rb +++ b/app/graphql/mutations/design_management/delete.rb @@ -9,14 +9,14 @@ module Mutations argument :filenames, [GraphQL::STRING_TYPE], required: true, - description: "The filenames of the designs to delete", + description: "The filenames of the designs to delete.", prepare: ->(names, _ctx) do names.presence || (raise Errors::ArgumentError, 'no filenames') end field :version, Types::DesignManagement::VersionType, null: true, # null on error - description: 'The new version in which the designs are deleted' + description: 'The new version in which the designs are deleted.' authorize :destroy_design diff --git a/app/graphql/mutations/design_management/move.rb b/app/graphql/mutations/design_management/move.rb index aed4cfec0fd..fe280e926d2 100644 --- a/app/graphql/mutations/design_management/move.rb +++ b/app/graphql/mutations/design_management/move.rb @@ -8,17 +8,17 @@ module Mutations DesignID = ::Types::GlobalIDType[::DesignManagement::Design] argument :id, DesignID, required: true, as: :current_design, - description: "ID of the design to move" + description: "ID of the design to move." argument :previous, DesignID, required: false, as: :previous_design, - description: "ID of the immediately preceding design" + description: "ID of the immediately preceding design." argument :next, DesignID, required: false, as: :next_design, - description: "ID of the immediately following design" + description: "ID of the immediately following design." field :design_collection, Types::DesignManagement::DesignCollectionType, null: true, - description: "The current state of the collection" + description: "The current state of the collection." def resolve(**args) service = ::DesignManagement::MoveDesignsService.new(current_user, parameters(**args)) diff --git a/app/graphql/mutations/design_management/upload.rb b/app/graphql/mutations/design_management/upload.rb index 1ed7f8e49e6..2ccf2ef8ff5 100644 --- a/app/graphql/mutations/design_management/upload.rb +++ b/app/graphql/mutations/design_management/upload.rb @@ -7,13 +7,13 @@ module Mutations argument :files, [ApolloUploadServer::Upload], required: true, - description: "The files to upload" + description: "The files to upload." authorize :create_design field :designs, [Types::DesignManagement::DesignType], null: false, - description: "The designs that were uploaded by the mutation" + description: "The designs that were uploaded by the mutation." field :skipped_designs, [Types::DesignManagement::DesignType], null: false, diff --git a/app/graphql/mutations/discussions/toggle_resolve.rb b/app/graphql/mutations/discussions/toggle_resolve.rb index 0e3baf8d548..c9834c946b2 100644 --- a/app/graphql/mutations/discussions/toggle_resolve.rb +++ b/app/graphql/mutations/discussions/toggle_resolve.rb @@ -10,17 +10,17 @@ module Mutations argument :id, Types::GlobalIDType[Discussion], required: true, - description: 'The global ID of the discussion' + description: 'The global ID of the discussion.' argument :resolve, GraphQL::BOOLEAN_TYPE, required: true, - description: 'Will resolve the discussion when true, and unresolve the discussion when false' + description: 'Will resolve the discussion when true, and unresolve the discussion when false.' field :discussion, Types::Notes::DiscussionType, null: true, - description: 'The discussion after mutation' + description: 'The discussion after mutation.' def resolve(id:, resolve:) discussion = authorized_find_discussion!(id: id) diff --git a/app/graphql/mutations/environments/canary_ingress/update.rb b/app/graphql/mutations/environments/canary_ingress/update.rb index 1798143053a..45dcc8314a0 100644 --- a/app/graphql/mutations/environments/canary_ingress/update.rb +++ b/app/graphql/mutations/environments/canary_ingress/update.rb @@ -11,12 +11,12 @@ module Mutations argument :id, ::Types::GlobalIDType[::Environment], required: true, - description: 'The global ID of the environment to update' + description: 'The global ID of the environment to update.' argument :weight, GraphQL::INT_TYPE, required: true, - description: 'The weight of the Canary Ingress' + description: 'The weight of the Canary Ingress.' def resolve(id:, **kwargs) environment = authorized_find!(id: id) diff --git a/app/graphql/mutations/issues/base.rb b/app/graphql/mutations/issues/base.rb index 529d48f3cd0..b25987a43f6 100644 --- a/app/graphql/mutations/issues/base.rb +++ b/app/graphql/mutations/issues/base.rb @@ -7,16 +7,16 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: "The project the issue to mutate is in" + description: "The project the issue to mutate is in." argument :iid, GraphQL::STRING_TYPE, required: true, - description: "The IID of the issue to mutate" + description: "The IID of the issue to mutate." field :issue, Types::IssueType, null: true, - description: "The issue after mutation" + description: "The issue after mutation." authorize :update_issue diff --git a/app/graphql/mutations/issues/create.rb b/app/graphql/mutations/issues/create.rb index 1454916bc77..18b80ff1736 100644 --- a/app/graphql/mutations/issues/create.rb +++ b/app/graphql/mutations/issues/create.rb @@ -12,11 +12,11 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'Project full path the issue is associated with' + description: 'Project full path the issue is associated with.' argument :iid, GraphQL::INT_TYPE, required: false, - description: 'The IID (internal ID) of a project issue. Only admins and project owners can modify' + description: 'The IID (internal ID) of a project issue. Only admins and project owners can modify.' argument :title, GraphQL::STRING_TYPE, required: true, @@ -24,7 +24,7 @@ module Mutations argument :milestone_id, ::Types::GlobalIDType[::Milestone], required: false, - description: 'The ID of the milestone to assign to the issue. On update milestone will be removed if set to null' + description: 'The ID of the milestone to assign to the issue. On update milestone will be removed if set to null.' argument :labels, [GraphQL::STRING_TYPE], required: false, @@ -32,28 +32,28 @@ module Mutations argument :label_ids, [::Types::GlobalIDType[::Label]], required: false, - description: 'The IDs of labels to be added to the issue' + description: 'The IDs of labels to be added to the issue.' argument :created_at, Types::TimeType, required: false, - description: 'Timestamp when the issue was created. Available only for admins and project owners' + description: 'Timestamp when the issue was created. Available only for admins and project owners.' argument :merge_request_to_resolve_discussions_of, ::Types::GlobalIDType[::MergeRequest], required: false, - description: 'The IID of a merge request for which to resolve discussions' + description: 'The IID of a merge request for which to resolve discussions.' argument :discussion_to_resolve, GraphQL::STRING_TYPE, required: false, - description: 'The ID of a discussion to resolve. Also pass `merge_request_to_resolve_discussions_of`' + description: 'The ID of a discussion to resolve. Also pass `merge_request_to_resolve_discussions_of`.' argument :assignee_ids, [::Types::GlobalIDType[::User]], required: false, - description: 'The array of user IDs to assign to the issue' + description: 'The array of user IDs to assign to the issue.' field :issue, Types::IssueType, null: true, - description: 'The issue after mutation' + description: 'The issue after mutation.' def ready?(**args) if args.slice(*mutually_exclusive_label_args).size > 1 diff --git a/app/graphql/mutations/issues/move.rb b/app/graphql/mutations/issues/move.rb index e6971c9df8c..3f97325c921 100644 --- a/app/graphql/mutations/issues/move.rb +++ b/app/graphql/mutations/issues/move.rb @@ -8,7 +8,7 @@ module Mutations argument :target_project_path, GraphQL::ID_TYPE, required: true, - description: 'The project to move the issue to' + description: 'The project to move the issue to.' def resolve(project_path:, iid:, target_project_path:) Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab/-/issues/267762') diff --git a/app/graphql/mutations/issues/set_due_date.rb b/app/graphql/mutations/issues/set_due_date.rb index effd863c541..da7892f4ed4 100644 --- a/app/graphql/mutations/issues/set_due_date.rb +++ b/app/graphql/mutations/issues/set_due_date.rb @@ -8,7 +8,7 @@ module Mutations argument :due_date, Types::TimeType, required: true, - description: 'The desired due date for the issue' + description: 'The desired due date for the issue.' def resolve(project_path:, iid:, due_date:) issue = authorized_find!(project_path: project_path, iid: iid) diff --git a/app/graphql/mutations/issues/set_locked.rb b/app/graphql/mutations/issues/set_locked.rb index 63a8483067a..611226e48ad 100644 --- a/app/graphql/mutations/issues/set_locked.rb +++ b/app/graphql/mutations/issues/set_locked.rb @@ -8,7 +8,7 @@ module Mutations argument :locked, GraphQL::BOOLEAN_TYPE, required: true, - description: 'Whether or not to lock discussion on the issue' + description: 'Whether or not to lock discussion on the issue.' def resolve(project_path:, iid:, locked:) issue = authorized_find!(project_path: project_path, iid: iid) diff --git a/app/graphql/mutations/issues/update.rb b/app/graphql/mutations/issues/update.rb index d34e351b2a6..eea2cd49aa0 100644 --- a/app/graphql/mutations/issues/update.rb +++ b/app/graphql/mutations/issues/update.rb @@ -13,18 +13,18 @@ module Mutations argument :milestone_id, GraphQL::ID_TYPE, # rubocop: disable Graphql/IDType required: false, - description: 'The ID of the milestone to assign to the issue. On update milestone will be removed if set to null' + description: 'The ID of the milestone to assign to the issue. On update milestone will be removed if set to null.' argument :add_label_ids, [GraphQL::ID_TYPE], required: false, - description: 'The IDs of labels to be added to the issue' + description: 'The IDs of labels to be added to the issue.' argument :remove_label_ids, [GraphQL::ID_TYPE], required: false, - description: 'The IDs of labels to be removed from the issue' + description: 'The IDs of labels to be removed from the issue.' argument :state_event, Types::IssueStateEventEnum, - description: 'Close or reopen an issue', + description: 'Close or reopen an issue.', required: false def resolve(project_path:, iid:, **args) diff --git a/app/graphql/mutations/jira_import/import_users.rb b/app/graphql/mutations/jira_import/import_users.rb index 0d59537b903..616ef390657 100644 --- a/app/graphql/mutations/jira_import/import_users.rb +++ b/app/graphql/mutations/jira_import/import_users.rb @@ -14,10 +14,10 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'The project to import the Jira users into' + description: 'The project to import the Jira users into.' argument :start_at, GraphQL::INT_TYPE, required: false, - description: 'The index of the record the import should started at, default 0 (50 records returned)' + description: 'The index of the record the import should started at, default 0 (50 records returned).' def resolve(project_path:, start_at: 0) project = authorized_find!(full_path: project_path) diff --git a/app/graphql/mutations/jira_import/start.rb b/app/graphql/mutations/jira_import/start.rb index eda28059272..3d50ebde13a 100644 --- a/app/graphql/mutations/jira_import/start.rb +++ b/app/graphql/mutations/jira_import/start.rb @@ -10,21 +10,21 @@ module Mutations field :jira_import, Types::JiraImportType, null: true, - description: 'The Jira import data after mutation' + description: 'The Jira import data after mutation.' argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'The project to import the Jira project into' + description: 'The project to import the Jira project into.' argument :jira_project_key, GraphQL::STRING_TYPE, required: true, - description: 'Project key of the importer Jira project' + description: 'Project key of the importer Jira project.' argument :jira_project_name, GraphQL::STRING_TYPE, required: false, - description: 'Project name of the importer Jira project' + description: 'Project name of the importer Jira project.' argument :users_mapping, [Types::JiraUsersMappingInputType], required: false, - description: 'The mapping of Jira to GitLab users' + description: 'The mapping of Jira to GitLab users.' def resolve(project_path:, jira_project_key:, users_mapping:) project = authorized_find!(full_path: project_path) diff --git a/app/graphql/mutations/labels/create.rb b/app/graphql/mutations/labels/create.rb index cb03651618e..ccbd1c37cbf 100644 --- a/app/graphql/mutations/labels/create.rb +++ b/app/graphql/mutations/labels/create.rb @@ -10,20 +10,20 @@ module Mutations field :label, Types::LabelType, null: true, - description: 'The label after mutation' + description: 'The label after mutation.' argument :title, GraphQL::STRING_TYPE, required: true, - description: 'Title of the label' + description: 'Title of the label.' argument :description, GraphQL::STRING_TYPE, required: false, - description: 'Description of the label' + description: 'Description of the label.' argument :color, GraphQL::STRING_TYPE, required: false, default_value: Label::DEFAULT_COLOR, - description: "The color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the CSS color names in https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords" + description: "The color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the CSS color names in https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords." authorize :admin_label diff --git a/app/graphql/mutations/merge_requests/base.rb b/app/graphql/mutations/merge_requests/base.rb index 57920259cf7..cd919a19ba2 100644 --- a/app/graphql/mutations/merge_requests/base.rb +++ b/app/graphql/mutations/merge_requests/base.rb @@ -7,16 +7,16 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: "The project the merge request to mutate is in" + description: "The project the merge request to mutate is in." argument :iid, GraphQL::STRING_TYPE, required: true, - description: "The IID of the merge request to mutate" + description: "The IID of the merge request to mutate." field :merge_request, Types::MergeRequestType, null: true, - description: "The merge request after mutation" + description: "The merge request after mutation." authorize :update_merge_request diff --git a/app/graphql/mutations/merge_requests/create.rb b/app/graphql/mutations/merge_requests/create.rb index fd2cd58a5ee..64fa8417e50 100644 --- a/app/graphql/mutations/merge_requests/create.rb +++ b/app/graphql/mutations/merge_requests/create.rb @@ -9,7 +9,7 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'Project full path the merge request is associated with' + description: 'Project full path the merge request is associated with.' argument :title, GraphQL::STRING_TYPE, required: true, @@ -34,7 +34,7 @@ module Mutations field :merge_request, Types::MergeRequestType, null: true, - description: 'The merge request after mutation' + description: 'The merge request after mutation.' authorize :create_merge_request_from diff --git a/app/graphql/mutations/merge_requests/update.rb b/app/graphql/mutations/merge_requests/update.rb index b583fdfca9b..4721ebab41b 100644 --- a/app/graphql/mutations/merge_requests/update.rb +++ b/app/graphql/mutations/merge_requests/update.rb @@ -20,7 +20,7 @@ module Mutations description: copy_field_description(Types::MergeRequestType, :description) def resolve(args) - merge_request = authorized_find!(args.slice(:project_path, :iid)) + merge_request = authorized_find!(**args.slice(:project_path, :iid)) attributes = args.slice(:title, :description, :target_branch).compact ::MergeRequests::UpdateService diff --git a/app/graphql/mutations/metrics/dashboard/annotations/create.rb b/app/graphql/mutations/metrics/dashboard/annotations/create.rb index c2ec88c68ed..85937809eb8 100644 --- a/app/graphql/mutations/metrics/dashboard/annotations/create.rb +++ b/app/graphql/mutations/metrics/dashboard/annotations/create.rb @@ -15,35 +15,35 @@ module Mutations field :annotation, Types::Metrics::Dashboards::AnnotationType, null: true, - description: 'The created annotation' + description: 'The created annotation.' argument :environment_id, ::Types::GlobalIDType[::Environment], required: false, - description: 'The global ID of the environment to add an annotation to' + description: 'The global ID of the environment to add an annotation to.' argument :cluster_id, ::Types::GlobalIDType[::Clusters::Cluster], required: false, - description: 'The global ID of the cluster to add an annotation to' + description: 'The global ID of the cluster to add an annotation to.' argument :starting_at, Types::TimeType, required: true, - description: 'Timestamp indicating starting moment to which the annotation relates' + description: 'Timestamp indicating starting moment to which the annotation relates.' argument :ending_at, Types::TimeType, required: false, - description: 'Timestamp indicating ending moment to which the annotation relates' + description: 'Timestamp indicating ending moment to which the annotation relates.' argument :dashboard_path, GraphQL::STRING_TYPE, required: true, - description: 'The path to a file defining the dashboard on which the annotation should be added' + description: 'The path to a file defining the dashboard on which the annotation should be added.' argument :description, GraphQL::STRING_TYPE, required: true, - description: 'The description of the annotation' + description: 'The description of the annotation.' AnnotationSource = Struct.new(:object, keyword_init: true) do def type_keys diff --git a/app/graphql/mutations/metrics/dashboard/annotations/delete.rb b/app/graphql/mutations/metrics/dashboard/annotations/delete.rb index 5d6763d8711..e0fadff13d4 100644 --- a/app/graphql/mutations/metrics/dashboard/annotations/delete.rb +++ b/app/graphql/mutations/metrics/dashboard/annotations/delete.rb @@ -11,7 +11,7 @@ module Mutations argument :id, ::Types::GlobalIDType[::Metrics::Dashboard::Annotation], required: true, - description: 'Global ID of the annotation to delete' + description: 'Global ID of the annotation to delete.' def resolve(id:) annotation = authorized_find!(id: id) diff --git a/app/graphql/mutations/namespace/package_settings/update.rb b/app/graphql/mutations/namespace/package_settings/update.rb new file mode 100644 index 00000000000..ca21c3418fc --- /dev/null +++ b/app/graphql/mutations/namespace/package_settings/update.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module Mutations + module Namespace + module PackageSettings + class Update < Mutations::BaseMutation + include Mutations::ResolvesNamespace + + graphql_name 'UpdateNamespacePackageSettings' + + authorize :create_package_settings + + argument :namespace_path, + GraphQL::ID_TYPE, + required: true, + description: 'The namespace path where the namespace package setting is located.' + + argument :maven_duplicates_allowed, + GraphQL::BOOLEAN_TYPE, + required: false, + description: copy_field_description(Types::Namespace::PackageSettingsType, :maven_duplicates_allowed) + + argument :maven_duplicate_exception_regex, + Types::UntrustedRegexp, + required: false, + description: copy_field_description(Types::Namespace::PackageSettingsType, :maven_duplicate_exception_regex) + + field :package_settings, + Types::Namespace::PackageSettingsType, + null: true, + description: 'The namespace package setting after mutation.' + + def resolve(namespace_path:, **args) + namespace = authorized_find!(namespace_path: namespace_path) + + result = ::Namespaces::PackageSettings::UpdateService + .new(container: namespace, current_user: current_user, params: args) + .execute + + { + package_settings: result.payload[:package_settings], + errors: result.errors + } + end + + private + + def find_object(namespace_path:) + resolve_namespace(full_path: namespace_path) + end + end + end + end +end diff --git a/app/graphql/mutations/notes/base.rb b/app/graphql/mutations/notes/base.rb index f2678211335..ff401167ba1 100644 --- a/app/graphql/mutations/notes/base.rb +++ b/app/graphql/mutations/notes/base.rb @@ -6,7 +6,7 @@ module Mutations field :note, Types::Notes::NoteType, null: true, - description: 'The note after mutation' + description: 'The note after mutation.' private diff --git a/app/graphql/mutations/notes/create/base.rb b/app/graphql/mutations/notes/create/base.rb index a1d81c62d91..2351af01813 100644 --- a/app/graphql/mutations/notes/create/base.rb +++ b/app/graphql/mutations/notes/create/base.rb @@ -11,7 +11,7 @@ module Mutations argument :noteable_id, ::Types::GlobalIDType[::Noteable], required: true, - description: 'The global ID of the resource to add a note to' + description: 'The global ID of the resource to add a note to.' argument :body, GraphQL::STRING_TYPE, diff --git a/app/graphql/mutations/notes/create/note.rb b/app/graphql/mutations/notes/create/note.rb index f1cd3bddca8..7af93521e0d 100644 --- a/app/graphql/mutations/notes/create/note.rb +++ b/app/graphql/mutations/notes/create/note.rb @@ -9,7 +9,7 @@ module Mutations argument :discussion_id, ::Types::GlobalIDType[::Discussion], required: false, - description: 'The global ID of the discussion this note is in reply to' + description: 'The global ID of the discussion this note is in reply to.' private diff --git a/app/graphql/mutations/notes/destroy.rb b/app/graphql/mutations/notes/destroy.rb index 0e6a215bf00..21b2cd15a7e 100644 --- a/app/graphql/mutations/notes/destroy.rb +++ b/app/graphql/mutations/notes/destroy.rb @@ -10,7 +10,7 @@ module Mutations argument :id, ::Types::GlobalIDType[::Note], required: true, - description: 'The global ID of the note to destroy' + description: 'The global ID of the note to destroy.' def resolve(id:) note = authorized_find!(id: id) diff --git a/app/graphql/mutations/notes/reposition_image_diff_note.rb b/app/graphql/mutations/notes/reposition_image_diff_note.rb index 15bfb361b13..31d3b7c9bb0 100644 --- a/app/graphql/mutations/notes/reposition_image_diff_note.rb +++ b/app/graphql/mutations/notes/reposition_image_diff_note.rb @@ -16,7 +16,7 @@ module Mutations loads: Types::Notes::NoteType, as: :note, required: true, - description: 'The global ID of the DiffNote to update' + description: 'The global ID of the DiffNote to update.' argument :position, Types::Notes::UpdateDiffImagePositionInputType, diff --git a/app/graphql/mutations/notes/update/base.rb b/app/graphql/mutations/notes/update/base.rb index 42dac20f5d3..4edb7429b97 100644 --- a/app/graphql/mutations/notes/update/base.rb +++ b/app/graphql/mutations/notes/update/base.rb @@ -11,7 +11,7 @@ module Mutations argument :id, ::Types::GlobalIDType[::Note], required: true, - description: 'The global ID of the note to update' + description: 'The global ID of the note to update.' def resolve(args) note = authorized_find!(id: args[:id]) diff --git a/app/graphql/mutations/releases/base.rb b/app/graphql/mutations/releases/base.rb index d53cfbe6a11..dd1724fe320 100644 --- a/app/graphql/mutations/releases/base.rb +++ b/app/graphql/mutations/releases/base.rb @@ -7,7 +7,7 @@ module Mutations argument :project_path, GraphQL::ID_TYPE, required: true, - description: 'Full path of the project the release is associated with' + description: 'Full path of the project the release is associated with.' private diff --git a/app/graphql/mutations/releases/create.rb b/app/graphql/mutations/releases/create.rb index 156cd252848..91ac256033e 100644 --- a/app/graphql/mutations/releases/create.rb +++ b/app/graphql/mutations/releases/create.rb @@ -8,23 +8,23 @@ module Mutations field :release, Types::ReleaseType, null: true, - description: 'The release after mutation' + description: 'The release after mutation.' argument :tag_name, GraphQL::STRING_TYPE, required: true, as: :tag, - description: 'Name of the tag to associate with the release' + description: 'Name of the tag to associate with the release.' argument :ref, GraphQL::STRING_TYPE, required: false, - description: 'The commit SHA or branch name to use if creating a new tag' + description: 'The commit SHA or branch name to use if creating a new tag.' argument :name, GraphQL::STRING_TYPE, required: false, - description: 'Name of the release' + description: 'Name of the release.' argument :description, GraphQL::STRING_TYPE, required: false, - description: 'Description (also known as "release notes") of the release' + description: 'Description (also known as "release notes") of the release.' argument :released_at, Types::TimeType, required: false, @@ -36,7 +36,7 @@ module Mutations argument :assets, Types::ReleaseAssetsInputType, required: false, - description: 'Assets associated to the release' + description: 'Assets associated to the release.' authorize :create_release diff --git a/app/graphql/mutations/releases/update.rb b/app/graphql/mutations/releases/update.rb index bf72b907679..dff743254bd 100644 --- a/app/graphql/mutations/releases/update.rb +++ b/app/graphql/mutations/releases/update.rb @@ -12,19 +12,19 @@ module Mutations argument :tag_name, GraphQL::STRING_TYPE, required: true, as: :tag, - description: 'Name of the tag associated with the release' + description: 'Name of the tag associated with the release.' argument :name, GraphQL::STRING_TYPE, required: false, - description: 'Name of the release' + description: 'Name of the release.' argument :description, GraphQL::STRING_TYPE, required: false, - description: 'Description (release notes) of the release' + description: 'Description (release notes) of the release.' argument :released_at, Types::TimeType, required: false, - description: 'The release date' + description: 'The release date.' argument :milestones, [GraphQL::STRING_TYPE], required: false, @@ -51,17 +51,17 @@ module Mutations params = scalars.with_indifferent_access - release_result = ::Releases::UpdateService.new(project, current_user, params).execute + result = ::Releases::UpdateService.new(project, current_user, params).execute - if release_result[:status] == :success + if result[:status] == :success { - release: release_result[:release], + release: result[:release], errors: [] } else { release: nil, - errors: [release_result[:message]] + errors: [result[:message]] } end end diff --git a/app/graphql/mutations/snippets/base.rb b/app/graphql/mutations/snippets/base.rb index 023f876d035..5196bc5c7ed 100644 --- a/app/graphql/mutations/snippets/base.rb +++ b/app/graphql/mutations/snippets/base.rb @@ -6,7 +6,7 @@ module Mutations field :snippet, Types::SnippetType, null: true, - description: 'The snippet after mutation' + description: 'The snippet after mutation.' private diff --git a/app/graphql/mutations/snippets/create.rb b/app/graphql/mutations/snippets/create.rb index 56c3b398949..b4485e28c5a 100644 --- a/app/graphql/mutations/snippets/create.rb +++ b/app/graphql/mutations/snippets/create.rb @@ -12,30 +12,30 @@ module Mutations field :snippet, Types::SnippetType, null: true, - description: 'The snippet after mutation' + description: 'The snippet after mutation.' argument :title, GraphQL::STRING_TYPE, required: true, - description: 'Title of the snippet' + description: 'Title of the snippet.' argument :description, GraphQL::STRING_TYPE, required: false, - description: 'Description of the snippet' + description: 'Description of the snippet.' argument :visibility_level, Types::VisibilityLevelsEnum, - description: 'The visibility level of the snippet', + description: 'The visibility level of the snippet.', required: true argument :project_path, GraphQL::ID_TYPE, required: false, - description: 'The project full path the snippet is associated with' + description: 'The project full path the snippet is associated with.' argument :uploaded_files, [GraphQL::STRING_TYPE], required: false, - description: 'The paths to files uploaded in the snippet description' + description: 'The paths to files uploaded in the snippet description.' argument :blob_actions, [Types::Snippets::BlobActionInputType], - description: 'Actions to perform over the snippet repository and blobs', + description: 'Actions to perform over the snippet repository and blobs.', required: false def resolve(project_path: nil, **args) diff --git a/app/graphql/mutations/snippets/destroy.rb b/app/graphql/mutations/snippets/destroy.rb index bee6503372d..9b00f62e2f9 100644 --- a/app/graphql/mutations/snippets/destroy.rb +++ b/app/graphql/mutations/snippets/destroy.rb @@ -9,7 +9,7 @@ module Mutations argument :id, ::Types::GlobalIDType[::Snippet], required: true, - description: 'The global ID of the snippet to destroy' + description: 'The global ID of the snippet to destroy.' def resolve(id:) snippet = authorized_find!(id: id) diff --git a/app/graphql/mutations/snippets/mark_as_spam.rb b/app/graphql/mutations/snippets/mark_as_spam.rb index 2d6fea1f5ec..d6e3e131b81 100644 --- a/app/graphql/mutations/snippets/mark_as_spam.rb +++ b/app/graphql/mutations/snippets/mark_as_spam.rb @@ -7,7 +7,7 @@ module Mutations argument :id, ::Types::GlobalIDType[::Snippet], required: true, - description: 'The global ID of the snippet to update' + description: 'The global ID of the snippet to update.' def resolve(id:) snippet = authorized_find!(id: id) diff --git a/app/graphql/mutations/snippets/update.rb b/app/graphql/mutations/snippets/update.rb index 6df1ad6d8b9..930440fbd35 100644 --- a/app/graphql/mutations/snippets/update.rb +++ b/app/graphql/mutations/snippets/update.rb @@ -9,22 +9,22 @@ module Mutations argument :id, ::Types::GlobalIDType[::Snippet], required: true, - description: 'The global ID of the snippet to update' + description: 'The global ID of the snippet to update.' argument :title, GraphQL::STRING_TYPE, required: false, - description: 'Title of the snippet' + description: 'Title of the snippet.' argument :description, GraphQL::STRING_TYPE, required: false, - description: 'Description of the snippet' + description: 'Description of the snippet.' argument :visibility_level, Types::VisibilityLevelsEnum, - description: 'The visibility level of the snippet', + description: 'The visibility level of the snippet.', required: false argument :blob_actions, [Types::Snippets::BlobActionInputType], - description: 'Actions to perform over the snippet repository and blobs', + description: 'Actions to perform over the snippet repository and blobs.', required: false def resolve(id:, **args) diff --git a/app/graphql/mutations/terraform/state/base.rb b/app/graphql/mutations/terraform/state/base.rb index b1721c784b1..01f69934ea3 100644 --- a/app/graphql/mutations/terraform/state/base.rb +++ b/app/graphql/mutations/terraform/state/base.rb @@ -9,7 +9,7 @@ module Mutations argument :id, Types::GlobalIDType[::Terraform::State], required: true, - description: 'Global ID of the Terraform state' + description: 'Global ID of the Terraform state.' private diff --git a/app/graphql/mutations/todos/create.rb b/app/graphql/mutations/todos/create.rb index 53c88696fdd..814f7ec4fc4 100644 --- a/app/graphql/mutations/todos/create.rb +++ b/app/graphql/mutations/todos/create.rb @@ -10,11 +10,11 @@ module Mutations argument :target_id, Types::GlobalIDType[Todoable], required: true, - description: "The global ID of the to-do item's parent. Issues, merge requests, designs and epics are supported" + description: "The global ID of the to-do item's parent. Issues, merge requests, designs and epics are supported." field :todo, Types::TodoType, null: true, - description: 'The to-do created' + description: 'The to-do created.' def resolve(target_id:) id = ::Types::GlobalIDType[Todoable].coerce_isolated_input(target_id) diff --git a/app/graphql/mutations/todos/mark_all_done.rb b/app/graphql/mutations/todos/mark_all_done.rb index 97bbbeeaa2f..c8359953567 100644 --- a/app/graphql/mutations/todos/mark_all_done.rb +++ b/app/graphql/mutations/todos/mark_all_done.rb @@ -11,11 +11,11 @@ module Mutations [::Types::GlobalIDType[::Todo]], null: false, deprecated: { reason: 'Use todos', milestone: '13.2' }, - description: 'Ids of the updated todos' + description: 'Ids of the updated todos.' field :todos, [::Types::TodoType], null: false, - description: 'Updated todos' + description: 'Updated todos.' def resolve authorize!(current_user) diff --git a/app/graphql/mutations/todos/mark_done.rb b/app/graphql/mutations/todos/mark_done.rb index 2ae50846108..95144abb040 100644 --- a/app/graphql/mutations/todos/mark_done.rb +++ b/app/graphql/mutations/todos/mark_done.rb @@ -10,11 +10,11 @@ module Mutations argument :id, ::Types::GlobalIDType[::Todo], required: true, - description: 'The global ID of the todo to mark as done' + description: 'The global ID of the todo to mark as done.' field :todo, Types::TodoType, null: false, - description: 'The requested todo' + description: 'The requested todo.' def resolve(id:) todo = authorized_find!(id: id) diff --git a/app/graphql/mutations/todos/restore.rb b/app/graphql/mutations/todos/restore.rb index c532b455a16..e496627aec2 100644 --- a/app/graphql/mutations/todos/restore.rb +++ b/app/graphql/mutations/todos/restore.rb @@ -10,11 +10,11 @@ module Mutations argument :id, ::Types::GlobalIDType[::Todo], required: true, - description: 'The global ID of the todo to restore' + description: 'The global ID of the todo to restore.' field :todo, Types::TodoType, null: false, - description: 'The requested todo' + description: 'The requested todo.' def resolve(id:) todo = authorized_find!(id: id) diff --git a/app/graphql/mutations/todos/restore_many.rb b/app/graphql/mutations/todos/restore_many.rb index 59965589856..9263c1d9afe 100644 --- a/app/graphql/mutations/todos/restore_many.rb +++ b/app/graphql/mutations/todos/restore_many.rb @@ -10,16 +10,16 @@ module Mutations argument :ids, [::Types::GlobalIDType[::Todo]], required: true, - description: 'The global IDs of the todos to restore (a maximum of 50 is supported at once)' + description: 'The global IDs of the todos to restore (a maximum of 50 is supported at once).' field :updated_ids, [::Types::GlobalIDType[Todo]], null: false, - description: 'The IDs of the updated todo items', + description: 'The IDs of the updated todo items.', deprecated: { reason: 'Use todos', milestone: '13.2' } field :todos, [::Types::TodoType], null: false, - description: 'Updated todos' + description: 'Updated todos.' def resolve(ids:) check_update_amount_limit!(ids) diff --git a/app/graphql/queries/container_registry/get_container_repositories.query.graphql b/app/graphql/queries/container_registry/get_container_repositories.query.graphql new file mode 100644 index 00000000000..6171233c446 --- /dev/null +++ b/app/graphql/queries/container_registry/get_container_repositories.query.graphql @@ -0,0 +1,60 @@ +query getProjectContainerRepositories( + $fullPath: ID! + $name: String + $first: Int + $last: Int + $after: String + $before: String + $isGroupPage: Boolean! +) { + project(fullPath: $fullPath) @skip(if: $isGroupPage) { + __typename + containerRepositoriesCount + containerRepositories(name: $name, after: $after, before: $before, first: $first, last: $last) { + __typename + nodes { + id + name + path + status + location + canDelete + createdAt + expirationPolicyStartedAt + __typename + } + pageInfo { + __typename + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } + } + group(fullPath: $fullPath) @include(if: $isGroupPage) { + __typename + containerRepositoriesCount + containerRepositories(name: $name, after: $after, before: $before, first: $first, last: $last) { + __typename + nodes { + id + name + path + status + location + canDelete + createdAt + expirationPolicyStartedAt + __typename + } + pageInfo { + __typename + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } + } +} diff --git a/app/graphql/queries/pipelines/get_pipeline_details.query.graphql b/app/graphql/queries/pipelines/get_pipeline_details.query.graphql new file mode 100644 index 00000000000..92323923266 --- /dev/null +++ b/app/graphql/queries/pipelines/get_pipeline_details.query.graphql @@ -0,0 +1,101 @@ +fragment LinkedPipelineData on Pipeline { + __typename + id + iid + path + status: detailedStatus { + __typename + group + label + icon + } + sourceJob { + __typename + name + } + project { + __typename + name + fullPath + } +} + +query getPipelineDetails($projectPath: ID!, $iid: ID!) { + project(fullPath: $projectPath) { + __typename + pipeline(iid: $iid) { + __typename + id + iid + downstream { + __typename + nodes { + ...LinkedPipelineData + } + } + upstream { + ...LinkedPipelineData + } + stages { + __typename + nodes { + __typename + name + status: detailedStatus { + __typename + action { + __typename + icon + path + title + } + } + groups { + __typename + nodes { + __typename + status: detailedStatus { + __typename + label + group + icon + } + name + size + jobs { + __typename + nodes { + __typename + name + scheduledAt + needs { + __typename + nodes { + __typename + name + } + } + status: detailedStatus { + __typename + icon + tooltip + hasDetails + detailsPath + group + action { + __typename + buttonTitle + icon + path + title + } + } + } + } + } + } + } + } + } + } +} diff --git a/app/graphql/queries/snippet/snippet.query.graphql b/app/graphql/queries/snippet/snippet.query.graphql index 2205dc26642..ebfc135c51c 100644 --- a/app/graphql/queries/snippet/snippet.query.graphql +++ b/app/graphql/queries/snippet/snippet.query.graphql @@ -59,6 +59,11 @@ query GetSnippetQuery($ids: [SnippetID!]) { name username webUrl + status { + __typename + emoji + message + } } } } diff --git a/app/graphql/resolvers/admin/analytics/instance_statistics/measurements_resolver.rb b/app/graphql/resolvers/admin/analytics/instance_statistics/measurements_resolver.rb index 9bac9f222ab..9df07df24d8 100644 --- a/app/graphql/resolvers/admin/analytics/instance_statistics/measurements_resolver.rb +++ b/app/graphql/resolvers/admin/analytics/instance_statistics/measurements_resolver.rb @@ -11,15 +11,15 @@ module Resolvers argument :identifier, Types::Admin::Analytics::InstanceStatistics::MeasurementIdentifierEnum, required: true, - description: 'The type of measurement/statistics to retrieve' + description: 'The type of measurement/statistics to retrieve.' argument :recorded_after, Types::TimeType, required: false, - description: 'Measurement recorded after this date' + description: 'Measurement recorded after this date.' argument :recorded_before, Types::TimeType, required: false, - description: 'Measurement recorded before this date' + description: 'Measurement recorded before this date.' def resolve(identifier:, recorded_before: nil, recorded_after: nil) authorize! diff --git a/app/graphql/resolvers/alert_management/alert_resolver.rb b/app/graphql/resolvers/alert_management/alert_resolver.rb index b115bd80113..d60cabde62b 100644 --- a/app/graphql/resolvers/alert_management/alert_resolver.rb +++ b/app/graphql/resolvers/alert_management/alert_resolver.rb @@ -7,19 +7,19 @@ module Resolvers argument :iid, GraphQL::STRING_TYPE, required: false, - description: 'IID of the alert. For example, "1"' + description: 'IID of the alert. For example, "1".' argument :statuses, [Types::AlertManagement::StatusEnum], as: :status, required: false, - description: 'Alerts with the specified statues. For example, [TRIGGERED]' + description: 'Alerts with the specified statues. For example, [TRIGGERED].' argument :sort, Types::AlertManagement::AlertSortEnum, - description: 'Sort alerts by this criteria', + description: 'Sort alerts by this criteria.', required: false argument :domain, Types::AlertManagement::DomainFilterEnum, - description: 'Filter query for given domain', + description: 'Filter query for given domain.', required: true, default_value: 'operations' @@ -29,7 +29,7 @@ module Resolvers argument :assignee_username, GraphQL::STRING_TYPE, required: false, - description: 'Username of a user assigned to the issue' + description: 'Username of a user assigned to the issue.' type Types::AlertManagement::AlertType, null: true diff --git a/app/graphql/resolvers/alert_management/alert_status_counts_resolver.rb b/app/graphql/resolvers/alert_management/alert_status_counts_resolver.rb index 8fc0f9fd1ff..410f72cff84 100644 --- a/app/graphql/resolvers/alert_management/alert_status_counts_resolver.rb +++ b/app/graphql/resolvers/alert_management/alert_status_counts_resolver.rb @@ -11,7 +11,7 @@ module Resolvers argument :assignee_username, GraphQL::STRING_TYPE, required: false, - description: 'Username of a user assigned to the issue' + description: 'Username of a user assigned to the issue.' def resolve(**args) ::Gitlab::AlertManagement::AlertStatusCounts.new(context[:current_user], object, args) diff --git a/app/graphql/resolvers/board_list_issues_resolver.rb b/app/graphql/resolvers/board_list_issues_resolver.rb index 3e4a5a3cb70..29e66a59a15 100644 --- a/app/graphql/resolvers/board_list_issues_resolver.rb +++ b/app/graphql/resolvers/board_list_issues_resolver.rb @@ -6,7 +6,7 @@ module Resolvers argument :filters, Types::Boards::BoardIssueInputType, required: false, - description: 'Filters applied when selecting issues in the board list' + description: 'Filters applied when selecting issues in the board list.' type Types::IssueType, null: true diff --git a/app/graphql/resolvers/board_lists_resolver.rb b/app/graphql/resolvers/board_lists_resolver.rb index 35d938c50be..7bdff8ba61f 100644 --- a/app/graphql/resolvers/board_lists_resolver.rb +++ b/app/graphql/resolvers/board_lists_resolver.rb @@ -13,11 +13,11 @@ module Resolvers argument :id, Types::GlobalIDType[List], required: false, - description: 'Find a list by its global ID' + description: 'Find a list by its global ID.' argument :issue_filters, Types::Boards::BoardIssueInputType, required: false, - description: 'Filters applied when getting issue metadata in the board list' + description: 'Filters applied when getting issue metadata in the board list.' alias_method :board, :object diff --git a/app/graphql/resolvers/board_resolver.rb b/app/graphql/resolvers/board_resolver.rb index 517f4e514c9..582707cc1e4 100644 --- a/app/graphql/resolvers/board_resolver.rb +++ b/app/graphql/resolvers/board_resolver.rb @@ -8,7 +8,7 @@ module Resolvers argument :id, ::Types::GlobalIDType[::Board], required: true, - description: 'The board\'s ID' + description: 'The board\'s ID.' def resolve(id: nil) return unless parent diff --git a/app/graphql/resolvers/boards_resolver.rb b/app/graphql/resolvers/boards_resolver.rb index 42b6ce03118..cdb15dc8f37 100644 --- a/app/graphql/resolvers/boards_resolver.rb +++ b/app/graphql/resolvers/boards_resolver.rb @@ -6,7 +6,7 @@ module Resolvers argument :id, ::Types::GlobalIDType[::Board], required: false, - description: 'Find a board by its ID' + description: 'Find a board by its ID.' def resolve(id: nil) # The project or group could have been loaded in batch by `BatchLoader`. diff --git a/app/graphql/resolvers/ci/config_resolver.rb b/app/graphql/resolvers/ci/config_resolver.rb index d6e7c206691..72d3ae30d73 100644 --- a/app/graphql/resolvers/ci/config_resolver.rb +++ b/app/graphql/resolvers/ci/config_resolver.rb @@ -3,40 +3,64 @@ module Resolvers module Ci class ConfigResolver < BaseResolver + include Gitlab::Graphql::Authorize::AuthorizeResource + include ResolvesProject + type Types::Ci::Config::ConfigType, null: true + authorize :read_pipeline + + argument :project_path, GraphQL::ID_TYPE, + required: true, + description: 'The project of the CI config.' + argument :content, GraphQL::STRING_TYPE, required: true, - description: 'Contents of .gitlab-ci.yml' - - def resolve(content:) - result = ::Gitlab::Ci::YamlProcessor.new(content).execute - - response = if result.errors.empty? - { - status: :valid, - errors: [], - stages: make_stages(result.jobs) - } - else - { - status: :invalid, - errors: result.errors - } - end - - response.merge(merged_yaml: result.merged_yaml) + description: "Contents of '.gitlab-ci.yml'." + + argument :dry_run, GraphQL::BOOLEAN_TYPE, + required: false, + description: 'Run pipeline creation simulation, or only do static check.' + + def resolve(project_path:, content:, dry_run: false) + project = authorized_find!(project_path: project_path) + + result = ::Gitlab::Ci::Lint + .new(project: project, current_user: context[:current_user]) + .validate(content, dry_run: dry_run) + + if result.errors.empty? + { + status: :valid, + errors: [], + stages: make_stages(result.jobs) + } + else + { + status: :invalid, + errors: result.errors + } + end end private def make_jobs(config_jobs) - config_jobs.map do |job_name, job| + config_jobs.map do |job| { - name: job_name, + name: job[:name], stage: job[:stage], - group_name: CommitStatus.new(name: job_name).group_name, - needs: job.dig(:needs, :job) || [] + group_name: CommitStatus.new(name: job[:name]).group_name, + needs: job.dig(:needs) || [], + allow_failure: job[:allow_failure], + before_script: job[:before_script], + script: job[:script], + after_script: job[:after_script], + only: job[:only], + except: job[:except], + when: job[:when], + tags: job[:tag_list], + environment: job[:environment] } end end @@ -55,6 +79,10 @@ module Resolvers .group_by { |group| group[:stage] } .map { |name, groups| { name: name, groups: groups } } end + + def find_object(project_path:) + resolve_project(full_path: project_path) + end end end end diff --git a/app/graphql/resolvers/ci/jobs_resolver.rb b/app/graphql/resolvers/ci/jobs_resolver.rb index 2c4911748a5..dd565094017 100644 --- a/app/graphql/resolvers/ci/jobs_resolver.rb +++ b/app/graphql/resolvers/ci/jobs_resolver.rb @@ -9,7 +9,7 @@ module Resolvers argument :security_report_types, [Types::Security::ReportTypeEnum], required: false, - description: 'Filter jobs by the type of security report they produce' + description: 'Filter jobs by the type of security report they produce.' def resolve(security_report_types: []) if security_report_types.present? diff --git a/app/graphql/resolvers/ci/runner_setup_resolver.rb b/app/graphql/resolvers/ci/runner_setup_resolver.rb index f68d71174c3..ac2a56b89a7 100644 --- a/app/graphql/resolvers/ci/runner_setup_resolver.rb +++ b/app/graphql/resolvers/ci/runner_setup_resolver.rb @@ -7,19 +7,19 @@ module Resolvers argument :platform, GraphQL::STRING_TYPE, required: true, - description: 'Platform to generate the instructions for' + description: 'Platform to generate the instructions for.' argument :architecture, GraphQL::STRING_TYPE, required: true, - description: 'Architecture to generate the instructions for' + description: 'Architecture to generate the instructions for.' argument :project_id, ::Types::GlobalIDType[::Project], required: false, - description: 'Project to register the runner for' + description: 'Project to register the runner for.' argument :group_id, ::Types::GlobalIDType[::Group], required: false, - description: 'Group to register the runner for' + description: 'Group to register the runner for.' def resolve(platform:, architecture:, **args) instructions = Gitlab::Ci::RunnerInstructions.new( diff --git a/app/graphql/resolvers/concerns/issue_resolver_arguments.rb b/app/graphql/resolvers/concerns/issue_resolver_arguments.rb index 4715b867ecb..84b0dafe213 100644 --- a/app/graphql/resolvers/concerns/issue_resolver_arguments.rb +++ b/app/graphql/resolvers/concerns/issue_resolver_arguments.rb @@ -8,52 +8,52 @@ module IssueResolverArguments argument :iid, GraphQL::STRING_TYPE, required: false, - description: 'IID of the issue. For example, "1"' + description: 'IID of the issue. For example, "1".' argument :iids, [GraphQL::STRING_TYPE], required: false, - description: 'List of IIDs of issues. For example, [1, 2]' + description: 'List of IIDs of issues. For example, [1, 2].' argument :label_name, GraphQL::STRING_TYPE.to_list_type, required: false, - description: 'Labels applied to this issue' + description: 'Labels applied to this issue.' argument :milestone_title, GraphQL::STRING_TYPE.to_list_type, required: false, - description: 'Milestone applied to this issue' + description: 'Milestone applied to this issue.' argument :author_username, GraphQL::STRING_TYPE, required: false, - description: 'Username of the author of the issue' + description: 'Username of the author of the issue.' argument :assignee_username, GraphQL::STRING_TYPE, required: false, - description: 'Username of a user assigned to the issue' + description: 'Username of a user assigned to the issue.' argument :assignee_usernames, [GraphQL::STRING_TYPE], required: false, - description: 'Usernames of users assigned to the issue' + description: 'Usernames of users assigned to the issue.' argument :assignee_id, GraphQL::STRING_TYPE, required: false, - description: 'ID of a user assigned to the issues, "none" and "any" values are supported' + description: 'ID of a user assigned to the issues, "none" and "any" values are supported.' argument :created_before, Types::TimeType, required: false, - description: 'Issues created before this date' + description: 'Issues created before this date.' argument :created_after, Types::TimeType, required: false, - description: 'Issues created after this date' + description: 'Issues created after this date.' argument :updated_before, Types::TimeType, required: false, - description: 'Issues updated before this date' + description: 'Issues updated before this date.' argument :updated_after, Types::TimeType, required: false, - description: 'Issues updated after this date' + description: 'Issues updated after this date.' argument :closed_before, Types::TimeType, required: false, - description: 'Issues closed before this date' + description: 'Issues closed before this date.' argument :closed_after, Types::TimeType, required: false, - description: 'Issues closed after this date' + description: 'Issues closed after this date.' argument :search, GraphQL::STRING_TYPE, required: false, - description: 'Search query for issue title or description' + description: 'Search query for issue title or description.' argument :types, [Types::IssueTypeEnum], as: :issue_types, - description: 'Filter issues by the given issue types', + description: 'Filter issues by the given issue types.', required: false end diff --git a/app/graphql/resolvers/concerns/looks_ahead.rb b/app/graphql/resolvers/concerns/looks_ahead.rb index d468047b539..77a85edfba6 100644 --- a/app/graphql/resolvers/concerns/looks_ahead.rb +++ b/app/graphql/resolvers/concerns/looks_ahead.rb @@ -20,11 +20,11 @@ module LooksAhead includes = preloads.each.flat_map do |name, requirements| selection&.selects?(name) ? requirements : [] end - preloads = (unconditional_includes + includes).uniq + all_preloads = (unconditional_includes + includes).uniq - return query if preloads.empty? + return query if all_preloads.empty? - query.preload(*preloads) # rubocop: disable CodeReuse/ActiveRecord + query.preload(*all_preloads) # rubocop: disable CodeReuse/ActiveRecord end private diff --git a/app/graphql/resolvers/concerns/resolves_merge_requests.rb b/app/graphql/resolvers/concerns/resolves_merge_requests.rb index ab83476ddea..31444b0c592 100644 --- a/app/graphql/resolvers/concerns/resolves_merge_requests.rb +++ b/app/graphql/resolvers/concerns/resolves_merge_requests.rb @@ -40,6 +40,8 @@ module ResolvesMergeRequests def preloads { assignees: [:assignees], + reviewers: [:reviewers], + participants: MergeRequest.participant_includes, labels: [:labels], author: [:author], merged_at: [:metrics], @@ -47,6 +49,7 @@ module ResolvesMergeRequests diff_stats_summary: [:metrics], approved_by: [:approved_by_users], milestone: [:milestone], + security_auto_fix: [:author], head_pipeline: [:merge_request_diff, { head_pipeline: [:merge_request] }] } end diff --git a/app/graphql/resolvers/concerns/resolves_pipelines.rb b/app/graphql/resolvers/concerns/resolves_pipelines.rb index f061f5f1606..bbf33c0b5eb 100644 --- a/app/graphql/resolvers/concerns/resolves_pipelines.rb +++ b/app/graphql/resolvers/concerns/resolves_pipelines.rb @@ -8,15 +8,15 @@ module ResolvesPipelines argument :status, Types::Ci::PipelineStatusEnum, required: false, - description: "Filter pipelines by their status" + description: "Filter pipelines by their status." argument :ref, GraphQL::STRING_TYPE, required: false, - description: "Filter pipelines by the ref they are run for" + description: "Filter pipelines by the ref they are run for." argument :sha, GraphQL::STRING_TYPE, required: false, - description: "Filter pipelines by the sha of the commit they are run for" + description: "Filter pipelines by the sha of the commit they are run for." end class_methods do diff --git a/app/graphql/resolvers/concerns/resolves_snippets.rb b/app/graphql/resolvers/concerns/resolves_snippets.rb index 790ff4f774f..0bc38188b9a 100644 --- a/app/graphql/resolvers/concerns/resolves_snippets.rb +++ b/app/graphql/resolvers/concerns/resolves_snippets.rb @@ -8,11 +8,11 @@ module ResolvesSnippets argument :ids, [::Types::GlobalIDType[::Snippet]], required: false, - description: 'Array of global snippet ids, e.g., "gid://gitlab/ProjectSnippet/1"' + description: 'Array of global snippet ids, e.g., "gid://gitlab/ProjectSnippet/1".' argument :visibility, Types::Snippets::VisibilityScopesEnum, required: false, - description: 'The visibility of the snippet' + description: 'The visibility of the snippet.' end def resolve(**args) diff --git a/app/graphql/resolvers/concerns/time_frame_arguments.rb b/app/graphql/resolvers/concerns/time_frame_arguments.rb index 94bfe6f7f9f..6cac46a71d2 100644 --- a/app/graphql/resolvers/concerns/time_frame_arguments.rb +++ b/app/graphql/resolvers/concerns/time_frame_arguments.rb @@ -18,7 +18,7 @@ module TimeFrameArguments argument :timeframe, Types::TimeframeInputType, required: false, - description: 'List items overlapping the given timeframe' + description: 'List items overlapping the given timeframe.' end # TODO: remove when the start_date and end_date arguments are removed diff --git a/app/graphql/resolvers/container_repositories_resolver.rb b/app/graphql/resolvers/container_repositories_resolver.rb index b4b2893a3b8..8042a368e33 100644 --- a/app/graphql/resolvers/container_repositories_resolver.rb +++ b/app/graphql/resolvers/container_repositories_resolver.rb @@ -8,7 +8,7 @@ module Resolvers argument :name, GraphQL::STRING_TYPE, required: false, - description: 'Filter the container repositories by their name' + description: 'Filter the container repositories by their name.' def resolve(name: nil) ContainerRepositoriesFinder.new(user: current_user, subject: object, params: { name: name }) diff --git a/app/graphql/resolvers/design_management/design_at_version_resolver.rb b/app/graphql/resolvers/design_management/design_at_version_resolver.rb index 1b69efebe4e..533692e2b12 100644 --- a/app/graphql/resolvers/design_management/design_at_version_resolver.rb +++ b/app/graphql/resolvers/design_management/design_at_version_resolver.rb @@ -11,7 +11,7 @@ module Resolvers argument :id, ::Types::GlobalIDType[::DesignManagement::DesignAtVersion], required: true, - description: 'The Global ID of the design at this version' + description: 'The Global ID of the design at this version.' def resolve(id:) authorized_find!(id: id) diff --git a/app/graphql/resolvers/design_management/design_resolver.rb b/app/graphql/resolvers/design_management/design_resolver.rb index b60c14ca835..e640f57f04a 100644 --- a/app/graphql/resolvers/design_management/design_resolver.rb +++ b/app/graphql/resolvers/design_management/design_resolver.rb @@ -9,11 +9,11 @@ module Resolvers argument :id, ::Types::GlobalIDType[::DesignManagement::Design], required: false, - description: 'Find a design by its ID' + description: 'Find a design by its ID.' argument :filename, GraphQL::STRING_TYPE, required: false, - description: 'Find a design by its filename' + description: 'Find a design by its filename.' def resolve(filename: nil, id: nil) params = parse_args(filename, id) diff --git a/app/graphql/resolvers/design_management/designs_resolver.rb b/app/graphql/resolvers/design_management/designs_resolver.rb index c588142ea6b..c45e4d01f6e 100644 --- a/app/graphql/resolvers/design_management/designs_resolver.rb +++ b/app/graphql/resolvers/design_management/designs_resolver.rb @@ -10,10 +10,10 @@ module Resolvers argument :ids, [DesignID], required: false, - description: 'Filters designs by their ID' + description: 'Filters designs by their ID.' argument :filenames, [GraphQL::STRING_TYPE], required: false, - description: 'Filters designs by their filename' + description: 'Filters designs by their filename.' argument :at_version, VersionID, required: false, description: 'Filters designs to only those that existed at the version. ' \ diff --git a/app/graphql/resolvers/design_management/version/design_at_version_resolver.rb b/app/graphql/resolvers/design_management/version/design_at_version_resolver.rb index 49a4974bfbf..fea74cbfb0b 100644 --- a/app/graphql/resolvers/design_management/version/design_at_version_resolver.rb +++ b/app/graphql/resolvers/design_management/version/design_at_version_resolver.rb @@ -19,13 +19,13 @@ module Resolvers argument :id, DesignAtVersionID, required: false, as: :design_at_version_id, - description: 'The ID of the DesignAtVersion' + description: 'The ID of the DesignAtVersion.' argument :design_id, DesignID, required: false, - description: 'The ID of a specific design' + description: 'The ID of a specific design.' argument :filename, GraphQL::STRING_TYPE, required: false, - description: 'The filename of a specific design' + description: 'The filename of a specific design.' def self.single self diff --git a/app/graphql/resolvers/design_management/version/designs_at_version_resolver.rb b/app/graphql/resolvers/design_management/version/designs_at_version_resolver.rb index a129d8620d4..930b1b60d0e 100644 --- a/app/graphql/resolvers/design_management/version/designs_at_version_resolver.rb +++ b/app/graphql/resolvers/design_management/version/designs_at_version_resolver.rb @@ -15,11 +15,11 @@ module Resolvers argument :ids, [DesignID], required: false, - description: 'Filters designs by their ID' + description: 'Filters designs by their ID.' argument :filenames, [GraphQL::STRING_TYPE], required: false, - description: 'Filters designs by their filename' + description: 'Filters designs by their filename.' def self.single ::Resolvers::DesignManagement::Version::DesignAtVersionResolver diff --git a/app/graphql/resolvers/design_management/version_in_collection_resolver.rb b/app/graphql/resolvers/design_management/version_in_collection_resolver.rb index 7d20cfc2c8e..593974beb04 100644 --- a/app/graphql/resolvers/design_management/version_in_collection_resolver.rb +++ b/app/graphql/resolvers/design_management/version_in_collection_resolver.rb @@ -17,11 +17,11 @@ module Resolvers argument :sha, GraphQL::STRING_TYPE, required: false, - description: "The SHA256 of a specific version" + description: "The SHA256 of a specific version." argument :id, VersionID, as: :version_id, required: false, - description: 'The Global ID of the version' + description: 'The Global ID of the version.' def resolve(version_id: nil, sha: nil) # TODO: remove this line when the compatibility layer is removed diff --git a/app/graphql/resolvers/design_management/version_resolver.rb b/app/graphql/resolvers/design_management/version_resolver.rb index 1bc9c1a7cd6..2144e588208 100644 --- a/app/graphql/resolvers/design_management/version_resolver.rb +++ b/app/graphql/resolvers/design_management/version_resolver.rb @@ -11,7 +11,7 @@ module Resolvers argument :id, ::Types::GlobalIDType[::DesignManagement::Version], required: true, - description: 'The Global ID of the version' + description: 'The Global ID of the version.' def resolve(id:) authorized_find!(id: id) diff --git a/app/graphql/resolvers/design_management/versions_resolver.rb b/app/graphql/resolvers/design_management/versions_resolver.rb index 3c718a631db..619448cbc18 100644 --- a/app/graphql/resolvers/design_management/versions_resolver.rb +++ b/app/graphql/resolvers/design_management/versions_resolver.rb @@ -14,12 +14,12 @@ module Resolvers argument :earlier_or_equal_to_sha, GraphQL::STRING_TYPE, as: :sha, required: false, - description: 'The SHA256 of the most recent acceptable version' + description: 'The SHA256 of the most recent acceptable version.' argument :earlier_or_equal_to_id, VersionID, as: :id, required: false, - description: 'The Global ID of the most recent acceptable version' + description: 'The Global ID of the most recent acceptable version.' # This resolver has a custom singular resolver def self.single diff --git a/app/graphql/resolvers/echo_resolver.rb b/app/graphql/resolvers/echo_resolver.rb index 6b85b700712..0c7dad622cf 100644 --- a/app/graphql/resolvers/echo_resolver.rb +++ b/app/graphql/resolvers/echo_resolver.rb @@ -6,7 +6,7 @@ module Resolvers description 'Testing endpoint to validate the API with' argument :text, GraphQL::STRING_TYPE, required: true, - description: 'Text to echo back' + description: 'Text to echo back.' def resolve(text:) username = current_user&.username diff --git a/app/graphql/resolvers/environments_resolver.rb b/app/graphql/resolvers/environments_resolver.rb index 1b916a89796..ed3395d05aa 100644 --- a/app/graphql/resolvers/environments_resolver.rb +++ b/app/graphql/resolvers/environments_resolver.rb @@ -4,15 +4,15 @@ module Resolvers class EnvironmentsResolver < BaseResolver argument :name, GraphQL::STRING_TYPE, required: false, - description: 'Name of the environment' + description: 'Name of the environment.' argument :search, GraphQL::STRING_TYPE, required: false, - description: 'Search query for environment name' + description: 'Search query for environment name.' argument :states, [GraphQL::STRING_TYPE], required: false, - description: 'States of environments that should be included in result' + description: 'States of environments that should be included in result.' type Types::EnvironmentType, null: true diff --git a/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb b/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb index 09e76dba645..7032af46221 100644 --- a/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb +++ b/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb @@ -7,7 +7,7 @@ module Resolvers argument :id, ::Types::GlobalIDType[::Gitlab::ErrorTracking::DetailedError], required: true, - description: 'ID of the Sentry issue' + description: 'ID of the Sentry issue.' def resolve(id:) # TODO: remove this line when the compatibility layer is removed diff --git a/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb b/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb index 13b5672d750..8876f8badcd 100644 --- a/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb +++ b/app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb @@ -7,7 +7,7 @@ module Resolvers argument :id, ::Types::GlobalIDType[::Gitlab::ErrorTracking::DetailedError], required: true, - description: 'ID of the Sentry issue' + description: 'ID of the Sentry issue.' def resolve(id:) # TODO: remove this line when the compatibility layer is removed diff --git a/app/graphql/resolvers/error_tracking/sentry_errors_resolver.rb b/app/graphql/resolvers/error_tracking/sentry_errors_resolver.rb index e844ffedbeb..4cd65daa655 100644 --- a/app/graphql/resolvers/error_tracking/sentry_errors_resolver.rb +++ b/app/graphql/resolvers/error_tracking/sentry_errors_resolver.rb @@ -7,12 +7,12 @@ module Resolvers extension Gitlab::Graphql::Extensions::ExternallyPaginatedArrayExtension argument :search_term, ::GraphQL::STRING_TYPE, - description: 'Search query for the Sentry error details', + description: 'Search query for the Sentry error details.', required: false # TODO: convert to Enum argument :sort, ::GraphQL::STRING_TYPE, - description: 'Attribute to sort on. Options are frequency, first_seen, last_seen. last_seen is default', + description: 'Attribute to sort on. Options are frequency, first_seen, last_seen. last_seen is default.', required: false delegate :project, to: :object diff --git a/app/graphql/resolvers/full_path_resolver.rb b/app/graphql/resolvers/full_path_resolver.rb index cbb0bf998a6..d01cdf749a1 100644 --- a/app/graphql/resolvers/full_path_resolver.rb +++ b/app/graphql/resolvers/full_path_resolver.rb @@ -7,7 +7,7 @@ module Resolvers prepended do argument :full_path, GraphQL::ID_TYPE, required: true, - description: 'The full path of the project, group or namespace, e.g., "gitlab-org/gitlab-foss"' + description: 'The full path of the project, group or namespace, e.g., "gitlab-org/gitlab-foss".' end def model_by_full_path(model, full_path) diff --git a/app/graphql/resolvers/group_members_resolver.rb b/app/graphql/resolvers/group_members_resolver.rb index fcdf7c01d8b..36e1977b756 100644 --- a/app/graphql/resolvers/group_members_resolver.rb +++ b/app/graphql/resolvers/group_members_resolver.rb @@ -7,7 +7,7 @@ module Resolvers authorize :read_group_member argument :relations, [Types::GroupMemberRelationEnum], - description: 'Filter members by the given member relations', + description: 'Filter members by the given member relations.', required: false, default_value: GroupMembersFinder::DEFAULT_RELATIONS diff --git a/app/graphql/resolvers/group_milestones_resolver.rb b/app/graphql/resolvers/group_milestones_resolver.rb index 83b82e2720b..179283fd7b7 100644 --- a/app/graphql/resolvers/group_milestones_resolver.rb +++ b/app/graphql/resolvers/group_milestones_resolver.rb @@ -5,7 +5,7 @@ module Resolvers class GroupMilestonesResolver < MilestonesResolver argument :include_descendants, GraphQL::BOOLEAN_TYPE, required: false, - description: 'Also return milestones in all subgroups and subprojects' + description: 'Also return milestones in all subgroups and subprojects.' type Types::MilestoneType.connection_type, null: true diff --git a/app/graphql/resolvers/issues_resolver.rb b/app/graphql/resolvers/issues_resolver.rb index ae27cce9113..ac3bdda0f12 100644 --- a/app/graphql/resolvers/issues_resolver.rb +++ b/app/graphql/resolvers/issues_resolver.rb @@ -6,9 +6,9 @@ module Resolvers argument :state, Types::IssuableStateEnum, required: false, - description: 'Current state of this issue' + description: 'Current state of this issue.' argument :sort, Types::IssueSortEnum, - description: 'Sort issues by this criteria', + description: 'Sort issues by this criteria.', required: false, default_value: :created_desc @@ -19,7 +19,7 @@ module Resolvers milestone_due_asc milestone_due_desc].freeze def continue_issue_resolve(parent, finder, **args) - issues = apply_lookahead(Gitlab::Graphql::Loaders::IssuableLoader.new(parent, finder).batching_find_all) + issues = Gitlab::Graphql::Loaders::IssuableLoader.new(parent, finder).batching_find_all { |q| apply_lookahead(q) } if non_stable_cursor_sort?(args[:sort]) # Certain complex sorts are not supported by the stable cursor pagination yet. @@ -32,6 +32,14 @@ module Resolvers private + def unconditional_includes + [ + { + project: [:project_feature] + } + ] + end + def preloads { alert_management_alert: [:alert_management_alert], diff --git a/app/graphql/resolvers/members_resolver.rb b/app/graphql/resolvers/members_resolver.rb index cf51fd298bd..76c3ae936ee 100644 --- a/app/graphql/resolvers/members_resolver.rb +++ b/app/graphql/resolvers/members_resolver.rb @@ -9,7 +9,7 @@ module Resolvers argument :search, GraphQL::STRING_TYPE, required: false, - description: 'Search query' + description: 'Search query.' def resolve_with_lookahead(**args) authorize!(object) diff --git a/app/graphql/resolvers/merge_request_resolver.rb b/app/graphql/resolvers/merge_request_resolver.rb index 4cad65fa697..8fd33c6626e 100644 --- a/app/graphql/resolvers/merge_request_resolver.rb +++ b/app/graphql/resolvers/merge_request_resolver.rb @@ -11,7 +11,7 @@ module Resolvers argument :iid, GraphQL::STRING_TYPE, required: true, as: :iids, - description: 'IID of the merge request, for example `1`' + description: 'IID of the merge request, for example `1`.' def no_results_possible?(args) project.nil? diff --git a/app/graphql/resolvers/merge_requests_resolver.rb b/app/graphql/resolvers/merge_requests_resolver.rb index 98c95565778..ecbdaaa3f55 100644 --- a/app/graphql/resolvers/merge_requests_resolver.rb +++ b/app/graphql/resolvers/merge_requests_resolver.rb @@ -11,24 +11,24 @@ module Resolvers def self.accept_assignee argument :assignee_username, GraphQL::STRING_TYPE, required: false, - description: 'Username of the assignee' + description: 'Username of the assignee.' end def self.accept_author argument :author_username, GraphQL::STRING_TYPE, required: false, - description: 'Username of the author' + description: 'Username of the author.' end def self.accept_reviewer argument :reviewer_username, GraphQL::STRING_TYPE, required: false, - description: 'Username of the reviewer' + description: 'Username of the reviewer.' end argument :iids, [GraphQL::STRING_TYPE], required: false, - description: 'Array of IIDs of merge requests, for example `[1, 2]`' + description: 'Array of IIDs of merge requests, for example `[1, 2]`.' argument :source_branches, [GraphQL::STRING_TYPE], required: false, @@ -50,15 +50,15 @@ module Resolvers description: 'Array of label names. All resolved merge requests will have all of these labels.' argument :merged_after, Types::TimeType, required: false, - description: 'Merge requests merged after this date' + description: 'Merge requests merged after this date.' argument :merged_before, Types::TimeType, required: false, - description: 'Merge requests merged before this date' + description: 'Merge requests merged before this date.' argument :milestone_title, GraphQL::STRING_TYPE, required: false, - description: 'Title of the milestone' + description: 'Title of the milestone.' argument :sort, Types::MergeRequestSortEnum, - description: 'Sort merge requests by this criteria', + description: 'Sort merge requests by this criteria.', required: false, default_value: :created_desc diff --git a/app/graphql/resolvers/metrics/dashboard_resolver.rb b/app/graphql/resolvers/metrics/dashboard_resolver.rb index 18a654c7dc5..f569cb0b2c3 100644 --- a/app/graphql/resolvers/metrics/dashboard_resolver.rb +++ b/app/graphql/resolvers/metrics/dashboard_resolver.rb @@ -5,7 +5,7 @@ module Resolvers class DashboardResolver < Resolvers::BaseResolver argument :path, GraphQL::STRING_TYPE, required: true, - description: "Path to a file which defines metrics dashboard eg: 'config/prometheus/common_metrics.yml'" + description: "Path to a file which defines metrics dashboard eg: 'config/prometheus/common_metrics.yml'." type Types::Metrics::DashboardType, null: true diff --git a/app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb b/app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb index 2dd224bb17b..9d6b0486c04 100644 --- a/app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb +++ b/app/graphql/resolvers/metrics/dashboards/annotation_resolver.rb @@ -6,11 +6,11 @@ module Resolvers class AnnotationResolver < Resolvers::BaseResolver argument :from, Types::TimeType, required: true, - description: "Timestamp marking date and time from which annotations need to be fetched" + description: "Timestamp marking date and time from which annotations need to be fetched." argument :to, Types::TimeType, required: false, - description: "Timestamp marking date and time to which annotations need to be fetched" + description: "Timestamp marking date and time to which annotations need to be fetched." type Types::Metrics::Dashboards::AnnotationType, null: true diff --git a/app/graphql/resolvers/milestones_resolver.rb b/app/graphql/resolvers/milestones_resolver.rb index 564e388d571..9a715e4d08b 100644 --- a/app/graphql/resolvers/milestones_resolver.rb +++ b/app/graphql/resolvers/milestones_resolver.rb @@ -7,23 +7,23 @@ module Resolvers argument :ids, [GraphQL::ID_TYPE], required: false, - description: 'Array of global milestone IDs, e.g., "gid://gitlab/Milestone/1"' + description: 'Array of global milestone IDs, e.g., "gid://gitlab/Milestone/1".' argument :state, Types::MilestoneStateEnum, required: false, - description: 'Filter milestones by state' + description: 'Filter milestones by state.' argument :title, GraphQL::STRING_TYPE, required: false, - description: 'The title of the milestone' + description: 'The title of the milestone.' argument :search_title, GraphQL::STRING_TYPE, required: false, - description: 'A search string for the title' + description: 'A search string for the title.' argument :containing_date, Types::TimeType, required: false, - description: 'A date that the milestone contains' + description: 'A date that the milestone contains.' type Types::MilestoneType.connection_type, null: true diff --git a/app/graphql/resolvers/namespace_projects_resolver.rb b/app/graphql/resolvers/namespace_projects_resolver.rb index 9f57c8f3405..da44b9b5623 100644 --- a/app/graphql/resolvers/namespace_projects_resolver.rb +++ b/app/graphql/resolvers/namespace_projects_resolver.rb @@ -5,17 +5,17 @@ module Resolvers argument :include_subgroups, GraphQL::BOOLEAN_TYPE, required: false, default_value: false, - description: 'Include also subgroup projects' + description: 'Include also subgroup projects.' argument :search, GraphQL::STRING_TYPE, required: false, default_value: nil, - description: 'Search project with most similar names or paths' + description: 'Search project with most similar names or paths.' argument :sort, Types::Projects::NamespaceProjectSortEnum, required: false, default_value: nil, - description: 'Sort projects by this criteria' + description: 'Sort projects by this criteria.' type Types::ProjectType, null: true diff --git a/app/graphql/resolvers/package_details_resolver.rb b/app/graphql/resolvers/package_details_resolver.rb new file mode 100644 index 00000000000..dcf4430e55f --- /dev/null +++ b/app/graphql/resolvers/package_details_resolver.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Resolvers + # No return types defined because they can be different. + # rubocop: disable Graphql/ResolverType + class PackageDetailsResolver < BaseResolver + argument :id, ::Types::GlobalIDType[::Packages::Package], + required: true, + description: 'The global ID of the package.' + + def resolve(id:) + # TODO: remove this line when the compatibility layer is removed + # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 + id = ::Types::GlobalIDType[::Packages::Package].coerce_isolated_input(id) + GitlabSchema.find_by_gid(id) + end + end +end diff --git a/app/graphql/resolvers/packages_resolver.rb b/app/graphql/resolvers/packages_resolver.rb index 519fb87183e..d19099e94d4 100644 --- a/app/graphql/resolvers/packages_resolver.rb +++ b/app/graphql/resolvers/packages_resolver.rb @@ -2,7 +2,7 @@ module Resolvers class PackagesResolver < BaseResolver - type Types::PackageType, null: true + type Types::Packages::PackageType, null: true def resolve(**args) return unless packages_available? diff --git a/app/graphql/resolvers/project_members_resolver.rb b/app/graphql/resolvers/project_members_resolver.rb index 659b12c2563..e889b47c000 100644 --- a/app/graphql/resolvers/project_members_resolver.rb +++ b/app/graphql/resolvers/project_members_resolver.rb @@ -6,7 +6,7 @@ module Resolvers authorize :read_project_member argument :relations, [Types::ProjectMemberRelationEnum], - description: 'Filter members by the given member relations', + description: 'Filter members by the given member relations.', required: false, default_value: MembersFinder::DEFAULT_RELATIONS diff --git a/app/graphql/resolvers/project_milestones_resolver.rb b/app/graphql/resolvers/project_milestones_resolver.rb index c88c9ce7219..4cd9cb53f56 100644 --- a/app/graphql/resolvers/project_milestones_resolver.rb +++ b/app/graphql/resolvers/project_milestones_resolver.rb @@ -5,7 +5,7 @@ module Resolvers class ProjectMilestonesResolver < MilestonesResolver argument :include_ancestors, GraphQL::BOOLEAN_TYPE, required: false, - description: "Also return milestones in the project's parent group and its ancestors" + description: "Also return milestones in the project's parent group and its ancestors." type Types::MilestoneType.connection_type, null: true diff --git a/app/graphql/resolvers/project_pipeline_resolver.rb b/app/graphql/resolvers/project_pipeline_resolver.rb index 8bf4e0b08ef..b604a408928 100644 --- a/app/graphql/resolvers/project_pipeline_resolver.rb +++ b/app/graphql/resolvers/project_pipeline_resolver.rb @@ -8,7 +8,7 @@ module Resolvers argument :iid, GraphQL::ID_TYPE, required: true, - description: 'IID of the Pipeline, e.g., "1"' + description: 'IID of the Pipeline, e.g., "1".' def resolve(iid:) BatchLoader::GraphQL.for(iid).batch(key: project) do |iids, loader, args| diff --git a/app/graphql/resolvers/projects/jira_projects_resolver.rb b/app/graphql/resolvers/projects/jira_projects_resolver.rb index 31f42d305b0..de85e8c42e6 100644 --- a/app/graphql/resolvers/projects/jira_projects_resolver.rb +++ b/app/graphql/resolvers/projects/jira_projects_resolver.rb @@ -6,11 +6,12 @@ module Resolvers include Gitlab::Graphql::Authorize::AuthorizeResource type Types::Projects::Services::JiraProjectType.connection_type, null: true + authorize :admin_project argument :name, GraphQL::STRING_TYPE, required: false, - description: 'Project name or key' + description: 'Project name or key.' def resolve(name: nil, **args) authorize!(project) @@ -31,10 +32,6 @@ module Resolvers end end - def authorized_resource?(project) - Ability.allowed?(context[:current_user], :admin_project, project) - end - private alias_method :jira_service, :object diff --git a/app/graphql/resolvers/projects/services_resolver.rb b/app/graphql/resolvers/projects/services_resolver.rb index 4f5a6cddbb3..f618bf2df77 100644 --- a/app/graphql/resolvers/projects/services_resolver.rb +++ b/app/graphql/resolvers/projects/services_resolver.rb @@ -12,11 +12,11 @@ module Resolvers argument :active, GraphQL::BOOLEAN_TYPE, required: false, - description: 'Indicates if the service is active' + description: 'Indicates if the service is active.' argument :type, Types::Projects::ServiceTypeEnum, required: false, - description: 'Class name of the service' + description: 'Class name of the service.' alias_method :project, :object diff --git a/app/graphql/resolvers/projects_resolver.rb b/app/graphql/resolvers/projects_resolver.rb index 69438229a50..11d18a0a080 100644 --- a/app/graphql/resolvers/projects_resolver.rb +++ b/app/graphql/resolvers/projects_resolver.rb @@ -6,23 +6,23 @@ module Resolvers argument :membership, GraphQL::BOOLEAN_TYPE, required: false, - description: 'Limit projects that the current user is a member of' + description: 'Limit projects that the current user is a member of.' argument :search, GraphQL::STRING_TYPE, required: false, - description: 'Search query for project name, path, or description' + description: 'Search query for project name, path, or description.' argument :ids, [GraphQL::ID_TYPE], required: false, - description: 'Filter projects by IDs' + description: 'Filter projects by IDs.' argument :search_namespaces, GraphQL::BOOLEAN_TYPE, required: false, - description: 'Include namespace in project search' + description: 'Include namespace in project search.' argument :sort, GraphQL::STRING_TYPE, required: false, - description: 'Sort order of results' + description: 'Sort order of results.' def resolve(**args) ProjectsFinder diff --git a/app/graphql/resolvers/release_milestones_resolver.rb b/app/graphql/resolvers/release_milestones_resolver.rb new file mode 100644 index 00000000000..7582c91272f --- /dev/null +++ b/app/graphql/resolvers/release_milestones_resolver.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Resolvers + class ReleaseMilestonesResolver < BaseResolver + type Types::MilestoneType.connection_type, null: true + + alias_method :release, :object + + def resolve(**args) + offset_pagination(release.milestones.order_by_dates_and_title) + end + end +end diff --git a/app/graphql/resolvers/release_resolver.rb b/app/graphql/resolvers/release_resolver.rb index 1edcc8c70b5..20ef01f8593 100644 --- a/app/graphql/resolvers/release_resolver.rb +++ b/app/graphql/resolvers/release_resolver.rb @@ -6,7 +6,7 @@ module Resolvers argument :tag_name, GraphQL::STRING_TYPE, required: true, - description: 'The name of the tag associated to the release' + description: 'The name of the tag associated to the release.' alias_method :project, :object diff --git a/app/graphql/resolvers/releases_resolver.rb b/app/graphql/resolvers/releases_resolver.rb index 8e8127cf279..01c1e9b11e7 100644 --- a/app/graphql/resolvers/releases_resolver.rb +++ b/app/graphql/resolvers/releases_resolver.rb @@ -6,7 +6,7 @@ module Resolvers argument :sort, Types::ReleaseSortEnum, required: false, default_value: :released_at_desc, - description: 'Sort releases by this criteria' + description: 'Sort releases by this criteria.' alias_method :project, :object diff --git a/app/graphql/resolvers/snippets/blobs_resolver.rb b/app/graphql/resolvers/snippets/blobs_resolver.rb index cfb1711aed4..868d34ae7ad 100644 --- a/app/graphql/resolvers/snippets/blobs_resolver.rb +++ b/app/graphql/resolvers/snippets/blobs_resolver.rb @@ -13,7 +13,7 @@ module Resolvers argument :paths, [GraphQL::STRING_TYPE], required: false, - description: 'Paths of the blobs' + description: 'Paths of the blobs.' def resolve(**args) authorize!(snippet) diff --git a/app/graphql/resolvers/snippets_resolver.rb b/app/graphql/resolvers/snippets_resolver.rb index 77099565df0..7153c919062 100644 --- a/app/graphql/resolvers/snippets_resolver.rb +++ b/app/graphql/resolvers/snippets_resolver.rb @@ -11,20 +11,20 @@ module Resolvers argument :author_id, ::Types::GlobalIDType[::User], required: false, - description: 'The ID of an author' + description: 'The ID of an author.' argument :project_id, ::Types::GlobalIDType[::Project], required: false, - description: 'The ID of a project' + description: 'The ID of a project.' argument :type, Types::Snippets::TypeEnum, required: false, - description: 'The type of snippet' + description: 'The type of snippet.' argument :explore, GraphQL::BOOLEAN_TYPE, required: false, - description: 'Explore personal snippets' + description: 'Explore personal snippets.' def resolve(**args) if args[:author_id].present? && args[:project_id].present? diff --git a/app/graphql/resolvers/todo_resolver.rb b/app/graphql/resolvers/todo_resolver.rb index 9a8f7a71154..8966285fccc 100644 --- a/app/graphql/resolvers/todo_resolver.rb +++ b/app/graphql/resolvers/todo_resolver.rb @@ -8,27 +8,27 @@ module Resolvers argument :action, [Types::TodoActionEnum], required: false, - description: 'The action to be filtered' + description: 'The action to be filtered.' argument :author_id, [GraphQL::ID_TYPE], required: false, - description: 'The ID of an author' + description: 'The ID of an author.' argument :project_id, [GraphQL::ID_TYPE], required: false, - description: 'The ID of a project' + description: 'The ID of a project.' argument :group_id, [GraphQL::ID_TYPE], required: false, - description: 'The ID of a group' + description: 'The ID of a group.' argument :state, [Types::TodoStateEnum], required: false, - description: 'The state of the todo' + description: 'The state of the todo.' argument :type, [Types::TodoTargetEnum], required: false, - description: 'The type of the todo' + description: 'The type of the todo.' def resolve(**args) return Todo.none unless current_user.present? && target.present? diff --git a/app/graphql/resolvers/tree_resolver.rb b/app/graphql/resolvers/tree_resolver.rb index 075a1929c47..7a70c35897d 100644 --- a/app/graphql/resolvers/tree_resolver.rb +++ b/app/graphql/resolvers/tree_resolver.rb @@ -7,15 +7,15 @@ module Resolvers argument :path, GraphQL::STRING_TYPE, required: false, default_value: '', - description: 'The path to get the tree for. Default value is the root of the repository' + description: 'The path to get the tree for. Default value is the root of the repository.' argument :ref, GraphQL::STRING_TYPE, required: false, default_value: :head, - description: 'The commit ref to get the tree for. Default value is HEAD' + description: 'The commit ref to get the tree for. Default value is HEAD.' argument :recursive, GraphQL::BOOLEAN_TYPE, required: false, default_value: false, - description: 'Used to get a recursive tree. Default is false' + description: 'Used to get a recursive tree. Default is false.' alias_method :repository, :object diff --git a/app/graphql/resolvers/user_resolver.rb b/app/graphql/resolvers/user_resolver.rb index 06c1f0cb42d..84bc03091d9 100644 --- a/app/graphql/resolvers/user_resolver.rb +++ b/app/graphql/resolvers/user_resolver.rb @@ -8,11 +8,11 @@ module Resolvers argument :id, Types::GlobalIDType[User], required: false, - description: 'ID of the User' + description: 'ID of the User.' argument :username, GraphQL::STRING_TYPE, required: false, - description: 'Username of the User' + description: 'Username of the User.' def ready?(id: nil, username: nil) unless id.present? ^ username.present? diff --git a/app/graphql/resolvers/user_starred_projects_resolver.rb b/app/graphql/resolvers/user_starred_projects_resolver.rb index cc3bb90decf..db420b3d116 100644 --- a/app/graphql/resolvers/user_starred_projects_resolver.rb +++ b/app/graphql/resolvers/user_starred_projects_resolver.rb @@ -6,7 +6,7 @@ module Resolvers argument :search, GraphQL::STRING_TYPE, required: false, - description: 'Search query' + description: 'Search query.' alias_method :user, :object diff --git a/app/graphql/resolvers/users/snippets_resolver.rb b/app/graphql/resolvers/users/snippets_resolver.rb index c2d42437ffd..e8048b9deb9 100644 --- a/app/graphql/resolvers/users/snippets_resolver.rb +++ b/app/graphql/resolvers/users/snippets_resolver.rb @@ -10,7 +10,7 @@ module Resolvers argument :type, Types::Snippets::TypeEnum, required: false, - description: 'The type of snippet' + description: 'The type of snippet.' private diff --git a/app/graphql/resolvers/users_resolver.rb b/app/graphql/resolvers/users_resolver.rb index a0ed076595d..95ced131504 100644 --- a/app/graphql/resolvers/users_resolver.rb +++ b/app/graphql/resolvers/users_resolver.rb @@ -9,13 +9,13 @@ module Resolvers argument :ids, [GraphQL::ID_TYPE], required: false, - description: 'List of user Global IDs' + description: 'List of user Global IDs.' argument :usernames, [GraphQL::STRING_TYPE], required: false, - description: 'List of usernames' + description: 'List of usernames.' argument :sort, Types::SortEnum, - description: 'Sort users by this criteria', + description: 'Sort users by this criteria.', required: false, default_value: :created_desc @@ -23,10 +23,15 @@ module Resolvers required: false, description: "Query to search users by name, username, or primary email." - def resolve(ids: nil, usernames: nil, sort: nil, search: nil) + argument :admins, GraphQL::BOOLEAN_TYPE, + required: false, + default_value: false, + description: 'Return only admin users.' + + def resolve(ids: nil, usernames: nil, sort: nil, search: nil, admins: nil) authorize! - ::UsersFinder.new(context[:current_user], finder_params(ids, usernames, sort, search)).execute + ::UsersFinder.new(context[:current_user], finder_params(ids, usernames, sort, search, admins)).execute end def ready?(**args) @@ -34,7 +39,7 @@ module Resolvers return super if args.values.compact.blank? - if args.values.all? + if args[:usernames]&.present? && args[:ids]&.present? raise Gitlab::Graphql::Errors::ArgumentError, 'Provide either a list of usernames or ids' end @@ -47,12 +52,13 @@ module Resolvers private - def finder_params(ids, usernames, sort, search) + def finder_params(ids, usernames, sort, search, admins) params = {} params[:sort] = sort if sort params[:username] = usernames if usernames params[:id] = parse_gids(ids) if ids params[:search] = search if search + params[:admins] = admins if admins params end diff --git a/app/graphql/types/admin/analytics/instance_statistics/measurement_type.rb b/app/graphql/types/admin/analytics/instance_statistics/measurement_type.rb index d45341077a4..eab42c2b78d 100644 --- a/app/graphql/types/admin/analytics/instance_statistics/measurement_type.rb +++ b/app/graphql/types/admin/analytics/instance_statistics/measurement_type.rb @@ -1,14 +1,16 @@ # frozen_string_literal: true -# rubocop:disable Graphql/AuthorizeTypes module Types module Admin module Analytics module InstanceStatistics class MeasurementType < BaseObject + include Gitlab::Graphql::Authorize::AuthorizeResource graphql_name 'InstanceStatisticsMeasurement' description 'Represents a recorded measurement (object count) for the Admins' + authorize :read_instance_statistics_measurements + field :recorded_at, Types::TimeType, null: true, description: 'The time the measurement was recorded' diff --git a/app/graphql/types/alert_management/domain_filter_enum.rb b/app/graphql/types/alert_management/domain_filter_enum.rb index 58dbc8bb2cf..a798cfb9ee9 100644 --- a/app/graphql/types/alert_management/domain_filter_enum.rb +++ b/app/graphql/types/alert_management/domain_filter_enum.rb @@ -6,7 +6,7 @@ module Types graphql_name 'AlertManagementDomainFilter' description 'Filters the alerts based on given domain' - value 'operations', description: 'Alerts for operations domain ' + value 'operations', description: 'Alerts for operations domain' value 'threat_monitoring', description: 'Alerts for threat monitoring domain' end end diff --git a/app/graphql/types/base_enum.rb b/app/graphql/types/base_enum.rb index 159443641bc..cbd45b46dd6 100644 --- a/app/graphql/types/base_enum.rb +++ b/app/graphql/types/base_enum.rb @@ -5,6 +5,25 @@ module Types extend GitlabStyleDeprecations class << self + # Registers enum definition by the given DeclarativeEnum module + # + # @param enum_mod [Module] The enum module to be used + # @param use_name [Boolean] Does not override the name if set `false` + # @param use_description [Boolean] Does not override the description if set `false` + # + # Example: + # + # class MyEnum < BaseEnum + # declarative_enum MyDeclarativeEnum + # end + # + def declarative_enum(enum_mod, use_name: true, use_description: true) + graphql_name(enum_mod.name) if use_name + description(enum_mod.description) if use_description + + enum_mod.definition.each { |key, content| value(key.to_s.upcase, content) } + end + def value(*args, **kwargs, &block) enum[args[0].downcase] = kwargs[:value] || args[0] kwargs = gitlab_deprecation(kwargs) diff --git a/app/graphql/types/board_type.rb b/app/graphql/types/board_type.rb index f47c744d1bb..f576fd83840 100644 --- a/app/graphql/types/board_type.rb +++ b/app/graphql/types/board_type.rb @@ -7,6 +7,8 @@ module Types accepts ::Board authorize :read_board + present_using BoardPresenter + field :id, type: GraphQL::ID_TYPE, null: false, description: 'ID (global ID) of the board' field :name, type: GraphQL::STRING_TYPE, null: true, @@ -24,6 +26,12 @@ module Types description: 'Lists of the board', resolver: Resolvers::BoardListsResolver, extras: [:lookahead] + + field :web_path, GraphQL::STRING_TYPE, null: false, + description: 'Web path of the board.' + + field :web_url, GraphQL::STRING_TYPE, null: false, + description: 'Web URL of the board.' end end diff --git a/app/graphql/types/ci/build_need_type.rb b/app/graphql/types/ci/build_need_type.rb new file mode 100644 index 00000000000..3bd81f8fa8f --- /dev/null +++ b/app/graphql/types/ci/build_need_type.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Types + module Ci + # rubocop: disable Graphql/AuthorizeTypes + # This type is only accessible from CiJob + class BuildNeedType < BaseObject + graphql_name 'CiBuildNeed' + + field :name, GraphQL::STRING_TYPE, null: true, + description: 'Name of the job we need to complete.' + end + end +end diff --git a/app/graphql/types/ci/ci_cd_setting_type.rb b/app/graphql/types/ci/ci_cd_setting_type.rb index 207c37f9538..e80771cdf9d 100644 --- a/app/graphql/types/ci/ci_cd_setting_type.rb +++ b/app/graphql/types/ci/ci_cd_setting_type.rb @@ -11,8 +11,10 @@ module Types description: 'Whether merge pipelines are enabled.', method: :merge_pipelines_enabled? field :merge_trains_enabled, GraphQL::BOOLEAN_TYPE, null: true, - description: 'Whether merge trains are enabled.', + description: 'Whether merge trains are enabled.', method: :merge_trains_enabled? + field :keep_latest_artifact, GraphQL::BOOLEAN_TYPE, null: true, + description: 'Whether to keep the latest builds artifacts.' field :project, Types::ProjectType, null: true, description: 'Project the CI/CD settings belong to.' end diff --git a/app/graphql/types/ci/config/config_type.rb b/app/graphql/types/ci/config/config_type.rb index e54b345f3d3..29093c6d3c9 100644 --- a/app/graphql/types/ci/config/config_type.rb +++ b/app/graphql/types/ci/config/config_type.rb @@ -11,7 +11,7 @@ module Types description: 'Linting errors' field :merged_yaml, GraphQL::STRING_TYPE, null: true, description: 'Merged CI config YAML' - field :stages, [Types::Ci::Config::StageType], null: true, + field :stages, Types::Ci::Config::StageType.connection_type, null: true, description: 'Stages of the pipeline' field :status, Types::Ci::Config::StatusEnum, null: true, description: 'Status of linting, can be either valid or invalid' diff --git a/app/graphql/types/ci/config/group_type.rb b/app/graphql/types/ci/config/group_type.rb index 8b0db2934a4..8e133bbcba8 100644 --- a/app/graphql/types/ci/config/group_type.rb +++ b/app/graphql/types/ci/config/group_type.rb @@ -9,7 +9,7 @@ module Types field :name, GraphQL::STRING_TYPE, null: true, description: 'Name of the job group' - field :jobs, [Types::Ci::Config::JobType], null: true, + field :jobs, Types::Ci::Config::JobType.connection_type, null: true, description: 'Jobs in group' field :size, GraphQL::INT_TYPE, null: true, description: 'Size of the job group' diff --git a/app/graphql/types/ci/config/job_restriction_type.rb b/app/graphql/types/ci/config/job_restriction_type.rb new file mode 100644 index 00000000000..294e3c94571 --- /dev/null +++ b/app/graphql/types/ci/config/job_restriction_type.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Types + module Ci + # rubocop: disable Graphql/AuthorizeTypes + module Config + class JobRestrictionType < BaseObject + graphql_name 'CiConfigJobRestriction' + + field :refs, [GraphQL::STRING_TYPE], null: true, + description: 'The Git refs the job restriction applies to.' + end + end + end +end diff --git a/app/graphql/types/ci/config/job_type.rb b/app/graphql/types/ci/config/job_type.rb index 59bcbd9ef49..65fdc4c2615 100644 --- a/app/graphql/types/ci/config/job_type.rb +++ b/app/graphql/types/ci/config/job_type.rb @@ -8,13 +8,36 @@ module Types graphql_name 'CiConfigJob' field :name, GraphQL::STRING_TYPE, null: true, - description: 'Name of the job' + description: 'Name of the job.' field :group_name, GraphQL::STRING_TYPE, null: true, - description: 'Name of the job group' + description: 'Name of the job group.' field :stage, GraphQL::STRING_TYPE, null: true, - description: 'Name of the job stage' - field :needs, [Types::Ci::Config::NeedType], null: true, - description: 'Builds that must complete before the jobs run' + description: 'Name of the job stage.' + field :needs, Types::Ci::Config::NeedType.connection_type, null: true, + description: 'Builds that must complete before the jobs run.' + field :allow_failure, GraphQL::BOOLEAN_TYPE, null: true, + description: 'Allow job to fail.' + field :before_script, [GraphQL::STRING_TYPE], null: true, + description: 'Override a set of commands that are executed before the job.' + field :script, [GraphQL::STRING_TYPE], null: true, + description: 'Shell script that is executed by a runner.' + field :after_script, [GraphQL::STRING_TYPE], null: true, + description: 'Override a set of commands that are executed after the job.' + field :when, GraphQL::STRING_TYPE, null: true, + description: 'When to run the job.', + resolver_method: :restrict_when_to_run_jobs + field :environment, GraphQL::STRING_TYPE, null: true, + description: 'Name of an environment to which the job deploys.' + field :except, Types::Ci::Config::JobRestrictionType, null: true, + description: 'Limit when jobs are not created.' + field :only, Types::Ci::Config::JobRestrictionType, null: true, + description: 'Jobs are created when these conditions do not apply.' + field :tags, [GraphQL::STRING_TYPE], null: true, + description: 'List of tags that are used to select a runner.' + + def restrict_when_to_run_jobs + object[:when] + end end end end diff --git a/app/graphql/types/ci/config/stage_type.rb b/app/graphql/types/ci/config/stage_type.rb index 20618bc41f8..2008c553629 100644 --- a/app/graphql/types/ci/config/stage_type.rb +++ b/app/graphql/types/ci/config/stage_type.rb @@ -9,7 +9,7 @@ module Types field :name, GraphQL::STRING_TYPE, null: true, description: 'Name of the stage' - field :groups, [Types::Ci::Config::GroupType], null: true, + field :groups, Types::Ci::Config::GroupType.connection_type, null: true, description: 'Groups of jobs for the stage' end end diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 5b6e8fe8567..f8bf1732e63 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -2,16 +2,16 @@ module Types module Ci - # rubocop: disable Graphql/AuthorizeTypes class JobType < BaseObject graphql_name 'CiJob' + authorize :read_commit_status field :pipeline, Types::Ci::PipelineType, null: true, description: 'Pipeline the job belongs to' field :name, GraphQL::STRING_TYPE, null: true, description: 'Name of the job' - field :needs, JobType.connection_type, null: true, - description: 'Builds that must complete before the jobs run' + field :needs, BuildNeedType.connection_type, null: true, + description: 'References to builds that must complete before the jobs run' field :detailed_status, Types::Ci::DetailedStatusType, null: true, description: 'Detailed status of the job' field :scheduled_at, Types::TimeType, null: true, diff --git a/app/graphql/types/ci/stage_type.rb b/app/graphql/types/ci/stage_type.rb index fd0bde90836..695e7c61bd9 100644 --- a/app/graphql/types/ci/stage_type.rb +++ b/app/graphql/types/ci/stage_type.rb @@ -9,6 +9,7 @@ module Types field :name, GraphQL::STRING_TYPE, null: true, description: 'Name of the stage' field :groups, Ci::GroupType.connection_type, null: true, + extras: [:lookahead], description: 'Group of jobs for the stage' field :detailed_status, Types::Ci::DetailedStatusType, null: true, description: 'Detailed status of the stage' @@ -16,6 +17,38 @@ module Types def detailed_status object.detailed_status(context[:current_user]) end + + # Issues one query per pipeline + def groups(lookahead:) + key = ::Gitlab::Graphql::BatchKey.new(object, lookahead, object_name: :stage) + + BatchLoader::GraphQL.for(key).batch(default_value: []) do |keys, loader| + by_pipeline = keys.group_by(&:pipeline) + include_needs = keys.any? { |k| k.requires?(%i[nodes jobs nodes needs]) } + + by_pipeline.each do |pl, key_group| + project = pl.project + indexed = key_group.index_by(&:id) + + jobs_for_pipeline(pl, indexed.keys, include_needs).each do |stage_id, statuses| + key = indexed[stage_id] + groups = ::Ci::Group.fabricate(project, key.stage, statuses) + loader.call(key, groups) + end + end + end + end + + private + + # rubocop: disable CodeReuse/ActiveRecord + def jobs_for_pipeline(pipeline, stage_ids, include_needs) + results = pipeline.latest_statuses.where(stage_id: stage_ids) + results = results.preload(:needs) if include_needs + + results.group_by(&:stage_id) + end + # rubocop: enable CodeReuse/ActiveRecord end end end diff --git a/app/graphql/types/data_visualization_palette/color_enum.rb b/app/graphql/types/data_visualization_palette/color_enum.rb new file mode 100644 index 00000000000..d55dde44048 --- /dev/null +++ b/app/graphql/types/data_visualization_palette/color_enum.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Types + module DataVisualizationPalette + class ColorEnum < BaseEnum + graphql_name 'DataVisualizationColorEnum' + description 'Color of the data visualization palette' + + Enums::DataVisualizationPalette.colors.keys.each do |unit| + value unit.upcase, value: unit, description: "#{unit.to_s.titleize} color" + end + end + end +end diff --git a/app/graphql/types/data_visualization_palette/weight_enum.rb b/app/graphql/types/data_visualization_palette/weight_enum.rb new file mode 100644 index 00000000000..b2b12a90ee4 --- /dev/null +++ b/app/graphql/types/data_visualization_palette/weight_enum.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Types + module DataVisualizationPalette + class WeightEnum < BaseEnum + graphql_name 'DataVisualizationWeightEnum' + description 'Weight of the data visualization palette' + + ::Enums::DataVisualizationPalette.weights.keys.each do |unit| + value "weight_#{unit}".upcase, value: unit, description: "#{unit.to_s.titleize} weight" + end + end + end +end diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 83b8a834801..78fb20650e9 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -121,6 +121,9 @@ module Types field :moved_to, Types::IssueType, null: true, description: 'Updated Issue after it got moved to another project' + field :create_note_email, GraphQL::STRING_TYPE, null: true, + description: 'User specific email address for the issue' + def author Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.author_id).find end @@ -140,6 +143,10 @@ module Types def discussion_locked !!object.discussion_locked end + + def create_note_email + object.creatable_note_email_address(context[:current_user]) + end end end diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index 816160e58f7..ee7d5780f7a 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -96,6 +96,8 @@ module Types description: 'Default merge commit message of the merge request' field :default_merge_commit_message_with_description, GraphQL::STRING_TYPE, null: true, description: 'Default merge commit message of the merge request with description' + field :default_squash_commit_message, GraphQL::STRING_TYPE, null: true, calls_gitaly: true, + description: 'Default squash commit message of the merge request' field :merge_ongoing, GraphQL::BOOLEAN_TYPE, method: :merge_ongoing?, null: false, description: 'Indicates if a merge is currently occurring' field :source_branch_exists, GraphQL::BOOLEAN_TYPE, @@ -126,10 +128,12 @@ module Types description: 'The milestone of the merge request' field :assignees, Types::UserType.connection_type, null: true, complexity: 5, description: 'Assignees of the merge request' + field :reviewers, Types::UserType.connection_type, null: true, complexity: 5, + description: 'Users from whom a review has been requested.' field :author, Types::UserType, null: true, description: 'User who created this merge request' - field :participants, Types::UserType.connection_type, null: true, complexity: 5, - description: 'Participants in the merge request' + field :participants, Types::UserType.connection_type, null: true, complexity: 15, + description: 'Participants in the merge request. This includes the author, assignees, reviewers, and users mentioned in notes.' field :subscribed, GraphQL::BOOLEAN_TYPE, method: :subscribed?, null: false, complexity: 5, description: 'Indicates if the currently logged in user is subscribed to this merge request' field :labels, Types::LabelType.connection_type, null: true, complexity: 5, @@ -159,6 +163,8 @@ module Types description: 'Users who approved the merge request' field :squash_on_merge, GraphQL::BOOLEAN_TYPE, null: false, method: :squash_on_merge?, description: 'Indicates if squash on merge is enabled' + field :squash, GraphQL::BOOLEAN_TYPE, null: false, + description: 'Indicates if squash on merge is enabled' field :available_auto_merge_strategies, [GraphQL::STRING_TYPE], null: true, calls_gitaly: true, description: 'Array of available auto merge strategies' field :has_ci, GraphQL::BOOLEAN_TYPE, null: false, method: :has_ci?, @@ -169,6 +175,10 @@ module Types calls_gitaly: true, description: 'Merge request commits excluding merge commits' field :security_auto_fix, GraphQL::BOOLEAN_TYPE, null: true, description: 'Indicates if the merge request is created by @GitLab-Security-Bot.' + field :auto_merge_strategy, GraphQL::STRING_TYPE, null: true, + description: 'Selected auto merge strategy' + field :merge_user, Types::UserType, null: true, + description: 'User who merged this merge request' def approved_by object.approved_by_users @@ -235,6 +245,10 @@ module Types def security_auto_fix object.author == User.security_bot end + + def reviewers + object.reviewers if object.allows_reviewers? + end end end diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index 9eea81c9d3e..f9dd11cbe37 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -88,9 +88,11 @@ module Types mount_mutation Mutations::ContainerExpirationPolicies::Update mount_mutation Mutations::ContainerRepositories::Destroy mount_mutation Mutations::ContainerRepositories::DestroyTags - mount_mutation Mutations::Ci::PipelineCancel - mount_mutation Mutations::Ci::PipelineDestroy - mount_mutation Mutations::Ci::PipelineRetry + mount_mutation Mutations::Ci::Pipeline::Cancel + mount_mutation Mutations::Ci::Pipeline::Destroy + mount_mutation Mutations::Ci::Pipeline::Retry + mount_mutation Mutations::Ci::CiCdSettingsUpdate + mount_mutation Mutations::Namespace::PackageSettings::Update end end diff --git a/app/graphql/types/namespace/package_settings_type.rb b/app/graphql/types/namespace/package_settings_type.rb new file mode 100644 index 00000000000..0720a1cfb4b --- /dev/null +++ b/app/graphql/types/namespace/package_settings_type.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Types + class Namespace::PackageSettingsType < BaseObject + graphql_name 'PackageSettings' + + description 'Namespace-level Package Registry settings' + + authorize :read_package_settings + + field :maven_duplicates_allowed, GraphQL::BOOLEAN_TYPE, null: false, description: 'Indicates whether duplicate Maven packages are allowed for this namespace.' + field :maven_duplicate_exception_regex, Types::UntrustedRegexp, null: true, description: 'When maven_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect.' + end +end diff --git a/app/graphql/types/namespace_type.rb b/app/graphql/types/namespace_type.rb index 4dec6f4c5e6..ab614d92b06 100644 --- a/app/graphql/types/namespace_type.rb +++ b/app/graphql/types/namespace_type.rb @@ -37,6 +37,11 @@ module Types description: 'Projects within this namespace', resolver: ::Resolvers::NamespaceProjectsResolver + field :package_settings, + Types::Namespace::PackageSettingsType, + null: true, + description: 'The package settings for the namespace' + def root_storage_statistics Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(object.id).find end diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb index f4e05e19eca..84b61340e93 100644 --- a/app/graphql/types/notes/note_type.rb +++ b/app/graphql/types/notes/note_type.rb @@ -46,6 +46,13 @@ module Types field :confidential, GraphQL::BOOLEAN_TYPE, null: true, description: 'Indicates if this note is confidential', method: :confidential? + field :url, GraphQL::STRING_TYPE, + null: true, + description: 'URL to view this Note in the Web UI' + + def url + ::Gitlab::UrlBuilder.build(object) + end def system_note_icon_name SystemNoteHelper.system_note_icon_name(object) if object.system? diff --git a/app/graphql/types/package_type.rb b/app/graphql/types/package_type.rb deleted file mode 100644 index 0604bf827a5..00000000000 --- a/app/graphql/types/package_type.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module Types - class PackageType < BaseObject - graphql_name 'Package' - description 'Represents a package' - authorize :read_package - - field :id, GraphQL::ID_TYPE, null: false, description: 'The ID of the package' - field :name, GraphQL::STRING_TYPE, null: false, description: 'The name of the package' - field :created_at, Types::TimeType, null: false, description: 'The created date' - field :updated_at, Types::TimeType, null: false, description: 'The update date' - field :version, GraphQL::STRING_TYPE, null: true, description: 'The version of the package' - field :package_type, Types::PackageTypeEnum, null: false, description: 'The type of the package' - end -end diff --git a/app/graphql/types/package_type_enum.rb b/app/graphql/types/package_type_enum.rb deleted file mode 100644 index 6f50c166da3..00000000000 --- a/app/graphql/types/package_type_enum.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Types - class PackageTypeEnum < BaseEnum - PACKAGE_TYPE_NAMES = { - pypi: 'PyPI', - npm: 'NPM' - }.freeze - - ::Packages::Package.package_types.keys.each do |package_type| - type_name = PACKAGE_TYPE_NAMES.fetch(package_type.to_sym, package_type.capitalize) - value package_type.to_s.upcase, "Packages from the #{type_name} package manager", value: package_type.to_s - end - end -end diff --git a/app/graphql/types/packages/composer/details_type.rb b/app/graphql/types/packages/composer/details_type.rb new file mode 100644 index 00000000000..8c6845a6fb3 --- /dev/null +++ b/app/graphql/types/packages/composer/details_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Types + module Packages + module Composer + class DetailsType < Types::Packages::PackageType + graphql_name 'PackageComposerDetails' + description 'Details of a Composer package' + + authorize :read_package + + field :composer_metadatum, Types::Packages::Composer::MetadatumType, null: false, description: 'The Composer metadatum.' + end + end + end +end diff --git a/app/graphql/types/packages/composer/json_type.rb b/app/graphql/types/packages/composer/json_type.rb new file mode 100644 index 00000000000..b7aa32f0170 --- /dev/null +++ b/app/graphql/types/packages/composer/json_type.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Types + module Packages + module Composer + # rubocop: disable Graphql/AuthorizeTypes + class JsonType < BaseObject + graphql_name 'PackageComposerJsonType' + description 'Represents a composer JSON file' + + field :name, GraphQL::STRING_TYPE, null: true, description: 'The name set in the Composer JSON file.' + field :type, GraphQL::STRING_TYPE, null: true, description: 'The type set in the Composer JSON file.' + field :license, GraphQL::STRING_TYPE, null: true, description: 'The license set in the Composer JSON file.' + field :version, GraphQL::STRING_TYPE, null: true, description: 'The version set in the Composer JSON file.' + end + end + end +end diff --git a/app/graphql/types/packages/composer/metadatum_type.rb b/app/graphql/types/packages/composer/metadatum_type.rb new file mode 100644 index 00000000000..a97818b1fb8 --- /dev/null +++ b/app/graphql/types/packages/composer/metadatum_type.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Types + module Packages + module Composer + class MetadatumType < BaseObject + graphql_name 'PackageComposerMetadatumType' + description 'Composer metadatum' + + authorize :read_package + + field :target_sha, GraphQL::STRING_TYPE, null: false, description: 'Target SHA of the package.' + field :composer_json, Types::Packages::Composer::JsonType, null: false, description: 'Data of the Composer JSON file.' + end + end + end +end diff --git a/app/graphql/types/packages/package_tag_type.rb b/app/graphql/types/packages/package_tag_type.rb new file mode 100644 index 00000000000..a05ce03da67 --- /dev/null +++ b/app/graphql/types/packages/package_tag_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Types + module Packages + class PackageTagType < BaseObject + graphql_name 'PackageTag' + description 'Represents a package tag' + authorize :read_package + + field :id, GraphQL::ID_TYPE, null: false, description: 'The ID of the tag.' + field :name, GraphQL::STRING_TYPE, null: false, description: 'The name of the tag.' + field :created_at, Types::TimeType, null: false, description: 'The created date.' + field :updated_at, Types::TimeType, null: false, description: 'The updated date.' + end + end +end diff --git a/app/graphql/types/packages/package_type.rb b/app/graphql/types/packages/package_type.rb new file mode 100644 index 00000000000..b13d16e91c6 --- /dev/null +++ b/app/graphql/types/packages/package_type.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Types + module Packages + class PackageType < BaseObject + graphql_name 'Package' + description 'Represents a package in the Package Registry' + + authorize :read_package + + field :id, GraphQL::ID_TYPE, null: false, description: 'The ID of the package.' + field :name, GraphQL::STRING_TYPE, null: false, description: 'The name of the package.' + field :created_at, Types::TimeType, null: false, description: 'The created date.' + field :updated_at, Types::TimeType, null: false, description: 'The updated date.' + field :version, GraphQL::STRING_TYPE, null: true, description: 'The version of the package.' + field :package_type, Types::Packages::PackageTypeEnum, null: false, description: 'The type of the package.' + field :tags, Types::Packages::PackageTagType.connection_type, null: true, description: 'The package tags.' + field :project, Types::ProjectType, null: false, description: 'Project where the package is stored.' + field :pipelines, Types::Ci::PipelineType.connection_type, null: true, description: 'Pipelines that built the package.' + field :versions, Types::Packages::PackageType.connection_type, null: true, description: 'The other versions of the package.' + + def project + Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.project_id).find + end + end + end +end diff --git a/app/graphql/types/packages/package_type_enum.rb b/app/graphql/types/packages/package_type_enum.rb new file mode 100644 index 00000000000..9713c9d49b1 --- /dev/null +++ b/app/graphql/types/packages/package_type_enum.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Types + module Packages + class PackageTypeEnum < BaseEnum + PACKAGE_TYPE_NAMES = { + pypi: 'PyPI', + npm: 'NPM' + }.freeze + + ::Packages::Package.package_types.keys.each do |package_type| + type_name = PACKAGE_TYPE_NAMES.fetch(package_type.to_sym, package_type.capitalize) + value package_type.to_s.upcase, "Packages from the #{type_name} package manager", value: package_type.to_s + end + end + end +end diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index a7d9548610e..f66d8926a9f 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -175,7 +175,7 @@ module Types description: 'A single issue of the project', resolver: Resolvers::IssuesResolver.single - field :packages, Types::PackageType.connection_type, null: true, + field :packages, Types::Packages::PackageType.connection_type, null: true, description: 'Packages of the project', resolver: Resolvers::PackagesResolver @@ -315,9 +315,6 @@ module Types description: 'Pipeline analytics', resolver: Resolvers::ProjectPipelineStatisticsResolver - field :total_pipeline_duration, GraphQL::INT_TYPE, null: true, - description: 'Total pipeline duration for all of the pipelines in a project' - def label(title:) BatchLoader::GraphQL.for(title).batch(key: project) do |titles, loader, args| LabelsFinder @@ -362,10 +359,6 @@ module Types project.container_repositories.size end - def total_pipeline_duration - object.all_pipelines.total_duration - end - private def project diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 05bb371088c..0e0c060f374 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -58,6 +58,11 @@ module Types argument :id, ::Types::GlobalIDType[::ContainerRepository], required: true, description: 'The global ID of the container repository' end + field :package_composer_details, Types::Packages::Composer::DetailsType, + null: true, + description: 'Find a composer package', + resolver: Resolvers::PackageDetailsResolver + field :user, Types::UserType, null: true, description: 'Find a user', diff --git a/app/graphql/types/release_type.rb b/app/graphql/types/release_type.rb index b715b981483..e7afa7ce7f7 100644 --- a/app/graphql/types/release_type.rb +++ b/app/graphql/types/release_type.rb @@ -35,7 +35,8 @@ module Types field :links, Types::ReleaseLinksType, null: true, method: :itself, description: 'Links of the release' field :milestones, Types::MilestoneType.connection_type, null: true, - description: 'Milestones associated to the release' + description: 'Milestones associated to the release', + resolver: ::Resolvers::ReleaseMilestonesResolver field :evidences, Types::EvidenceType.connection_type, null: true, description: 'Evidence for the release' diff --git a/app/graphql/types/repository_type.rb b/app/graphql/types/repository_type.rb index f0c25e13a26..5b86871142c 100644 --- a/app/graphql/types/repository_type.rb +++ b/app/graphql/types/repository_type.rb @@ -10,7 +10,7 @@ module Types description: 'Default branch of the repository' field :empty, GraphQL::BOOLEAN_TYPE, null: false, method: :empty?, calls_gitaly: true, description: 'Indicates repository has no visible content' - field :exists, GraphQL::BOOLEAN_TYPE, null: false, method: :exists?, + field :exists, GraphQL::BOOLEAN_TYPE, null: false, method: :exists?, calls_gitaly: true, description: 'Indicates a corresponding Git repository exists on disk' field :tree, Types::Tree::TreeType, null: true, resolver: Resolvers::TreeResolver, calls_gitaly: true, description: 'Tree of the repository' |