diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /app/graphql | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'app/graphql')
182 files changed, 1915 insertions, 1174 deletions
diff --git a/app/graphql/gitlab_schema.rb b/app/graphql/gitlab_schema.rb index b399f0490ee..c0e063a34d5 100644 --- a/app/graphql/gitlab_schema.rb +++ b/app/graphql/gitlab_schema.rb @@ -53,6 +53,7 @@ class GitlabSchema < GraphQL::Schema def get_type(type_name, context = GraphQL::Query::NullContext) type_name = Gitlab::GlobalId::Deprecations.apply_to_graphql_name(type_name) + type_name = Gitlab::Graphql::TypeNameDeprecations.apply_to_graphql_name(type_name) super(type_name, context) end @@ -163,6 +164,7 @@ class GitlabSchema < GraphQL::Schema def get_type(type_name) type_name = Gitlab::GlobalId::Deprecations.apply_to_graphql_name(type_name) + type_name = Gitlab::Graphql::TypeNameDeprecations.apply_to_graphql_name(type_name) super(type_name) end diff --git a/app/graphql/graphql_triggers.rb b/app/graphql/graphql_triggers.rb index 342cff83e90..b39875b83a9 100644 --- a/app/graphql/graphql_triggers.rb +++ b/app/graphql/graphql_triggers.rb @@ -16,4 +16,8 @@ module GraphqlTriggers def self.issuable_labels_updated(issuable) GitlabSchema.subscriptions.trigger('issuableLabelsUpdated', { issuable_id: issuable.to_gid }, issuable) end + + def self.issuable_dates_updated(issuable) + GitlabSchema.subscriptions.trigger('issuableDatesUpdated', { issuable_id: issuable.to_gid }, issuable) + end end diff --git a/app/graphql/mutations/award_emojis/toggle.rb b/app/graphql/mutations/award_emojis/toggle.rb index 5da2731d562..a419a8df64e 100644 --- a/app/graphql/mutations/award_emojis/toggle.rb +++ b/app/graphql/mutations/award_emojis/toggle.rb @@ -5,9 +5,10 @@ module Mutations class Toggle < Base graphql_name 'AwardEmojiToggle' - field :toggled_on, GraphQL::Types::Boolean, null: false, - description: 'Indicates the status of the emoji. ' \ - 'True if the toggle awarded the emoji, and false if the toggle removed the emoji.' + field :toggled_on, GraphQL::Types::Boolean, + null: false, + description: 'Indicates the status of the emoji. ' \ + 'True if the toggle awarded the emoji, and false if the toggle removed the emoji.' def resolve(args) awardable = authorized_find!(id: args[:awardable_id]) diff --git a/app/graphql/mutations/ci/job/retry.rb b/app/graphql/mutations/ci/job/retry.rb index 50e9c51c9e7..bfb9b902cc5 100644 --- a/app/graphql/mutations/ci/job/retry.rb +++ b/app/graphql/mutations/ci/job/retry.rb @@ -11,13 +11,20 @@ module Mutations null: true, description: 'Job after the mutation.' + argument :variables, [::Types::Ci::VariableInputType], + required: false, + default_value: [], + replace_null_with_default: true, + description: 'Variables to use when retrying a manual job.' + authorize :update_build - def resolve(id:) + def resolve(id:, variables:) job = authorized_find!(id: id) project = job.project + variables = variables.map(&:to_h) - response = ::Ci::RetryJobService.new(project, current_user).execute(job) + response = ::Ci::RetryJobService.new(project, current_user).execute(job, variables: variables) if response.success? { diff --git a/app/graphql/mutations/ci/pipeline/cancel.rb b/app/graphql/mutations/ci/pipeline/cancel.rb index 3ec6eee9f54..c52e3b4f4b8 100644 --- a/app/graphql/mutations/ci/pipeline/cancel.rb +++ b/app/graphql/mutations/ci/pipeline/cancel.rb @@ -13,7 +13,6 @@ module Mutations if pipeline.cancelable? pipeline.cancel_running - pipeline.cancel { success: true, errors: [] } else diff --git a/app/graphql/mutations/ci/runner/bulk_delete.rb b/app/graphql/mutations/ci/runner/bulk_delete.rb new file mode 100644 index 00000000000..4c1c2967799 --- /dev/null +++ b/app/graphql/mutations/ci/runner/bulk_delete.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +module Mutations + module Ci + module Runner + class BulkDelete < BaseMutation + graphql_name 'BulkRunnerDelete' + + RunnerID = ::Types::GlobalIDType[::Ci::Runner] + + argument :ids, [RunnerID], + required: false, + description: 'IDs of the runners to delete.' + + field :deleted_count, + ::GraphQL::Types::Int, + null: true, + description: 'Number of records effectively deleted. ' \ + 'Only present if operation was performed synchronously.' + + field :deleted_ids, + [RunnerID], + null: true, + description: 'IDs of records effectively deleted. ' \ + 'Only present if operation was performed synchronously.' + + def resolve(**runner_attrs) + raise_resource_not_available_error! unless Ability.allowed?(current_user, :delete_runners) + + if ids = runner_attrs[:ids] + runners = find_all_runners_by_ids(model_ids_of(ids)) + + result = ::Ci::Runners::BulkDeleteRunnersService.new(runners: runners).execute + result.payload.slice(:deleted_count, :deleted_ids).merge(errors: []) + else + { errors: [] } + end + end + + private + + def model_ids_of(ids) + ids.map do |gid| + gid.model_id.to_i + end.compact + end + + def find_all_runners_by_ids(ids) + return ::Ci::Runner.none if ids.blank? + + ::Ci::Runner.id_in(ids) + end + end + end + end +end diff --git a/app/graphql/mutations/ci/runner/update.rb b/app/graphql/mutations/ci/runner/update.rb index b6d8c20c40b..1c6cf6989bf 100644 --- a/app/graphql/mutations/ci/runner/update.rb +++ b/app/graphql/mutations/ci/runner/update.rb @@ -39,15 +39,17 @@ module Mutations required: false, description: 'Indicates the runner is not allowed to receive jobs.' - argument :locked, GraphQL::Types::Boolean, required: false, - description: 'Indicates the runner is locked.' + argument :locked, GraphQL::Types::Boolean, + required: false, + description: 'Indicates the runner is locked.' argument :run_untagged, GraphQL::Types::Boolean, required: false, description: 'Indicates the runner is able to run untagged jobs.' - argument :tag_list, [GraphQL::Types::String], required: false, - description: 'Tags associated with the runner.' + argument :tag_list, [GraphQL::Types::String], + required: false, + description: 'Tags associated with the runner.' field :runner, Types::Ci::RunnerType, diff --git a/app/graphql/mutations/ci/runners_registration_token/reset.rb b/app/graphql/mutations/ci/runners_registration_token/reset.rb index 8c49b682ab0..c9fe7ea47f0 100644 --- a/app/graphql/mutations/ci/runners_registration_token/reset.rb +++ b/app/graphql/mutations/ci/runners_registration_token/reset.rb @@ -49,7 +49,10 @@ module Mutations end def reset_token(scope) - ::Ci::Runners::ResetRegistrationTokenService.new(scope, current_user).execute if scope + return unless scope + + result = ::Ci::Runners::ResetRegistrationTokenService.new(scope, current_user).execute + result.payload[:new_registration_token] if result.success? end end end diff --git a/app/graphql/mutations/concerns/mutations/work_items/update_arguments.rb b/app/graphql/mutations/concerns/mutations/work_items/update_arguments.rb index cbe1cfb4099..1f90f394521 100644 --- a/app/graphql/mutations/concerns/mutations/work_items/update_arguments.rb +++ b/app/graphql/mutations/concerns/mutations/work_items/update_arguments.rb @@ -15,15 +15,21 @@ module Mutations argument :title, GraphQL::Types::String, required: false, description: copy_field_description(Types::WorkItemType, :title) + argument :confidential, GraphQL::Types::Boolean, + required: false, + description: 'Sets the work item confidentiality.' argument :description_widget, ::Types::WorkItems::Widgets::DescriptionInputType, required: false, description: 'Input for description widget.' - argument :weight_widget, ::Types::WorkItems::Widgets::WeightInputType, + argument :assignees_widget, ::Types::WorkItems::Widgets::AssigneesInputType, required: false, - description: 'Input for weight widget.' + description: 'Input for assignees widget.' argument :hierarchy_widget, ::Types::WorkItems::Widgets::HierarchyUpdateInputType, required: false, description: 'Input for hierarchy widget.' + argument :start_and_due_date_widget, ::Types::WorkItems::Widgets::StartAndDueDateUpdateInputType, + required: false, + description: 'Input for start and due date widget.' end end end diff --git a/app/graphql/mutations/container_repositories/destroy.rb b/app/graphql/mutations/container_repositories/destroy.rb index 1d8f7b22f88..2a45291be22 100644 --- a/app/graphql/mutations/container_repositories/destroy.rb +++ b/app/graphql/mutations/container_repositories/destroy.rb @@ -21,7 +21,9 @@ module Mutations container_repository = authorized_find!(id: id) container_repository.delete_scheduled! + # rubocop:disable CodeReuse/Worker DeleteContainerRepositoryWorker.perform_async(current_user.id, container_repository.id) + # rubocop:enable CodeReuse/Worker track_event(:delete_repository, :container) { diff --git a/app/graphql/mutations/design_management/move.rb b/app/graphql/mutations/design_management/move.rb index b19d9b4ce61..cf7b7a7b99b 100644 --- a/app/graphql/mutations/design_management/move.rb +++ b/app/graphql/mutations/design_management/move.rb @@ -7,18 +7,21 @@ module Mutations DesignID = ::Types::GlobalIDType[::DesignManagement::Design] - argument :id, DesignID, required: true, as: :current_design, - description: "ID of the design to move." + argument :id, DesignID, + required: true, as: :current_design, + description: "ID of the design to move." - argument :previous, DesignID, required: false, as: :previous_design, - description: "ID of the immediately preceding design." + argument :previous, DesignID, + required: false, as: :previous_design, + description: "ID of the immediately preceding design." - argument :next, DesignID, required: false, as: :next_design, - description: "ID of the immediately following design." + argument :next, DesignID, + required: false, as: :next_design, + description: "ID of the immediately following design." field :design_collection, Types::DesignManagement::DesignCollectionType, - null: true, - description: "Current state of the collection." + null: true, + description: "Current state of the collection." def resolve(**args) service = ::DesignManagement::MoveDesignsService.new(current_user, parameters(**args)) diff --git a/app/graphql/mutations/issues/move.rb b/app/graphql/mutations/issues/move.rb index fb22a2d891c..63bc9dabbf9 100644 --- a/app/graphql/mutations/issues/move.rb +++ b/app/graphql/mutations/issues/move.rb @@ -19,8 +19,8 @@ module Mutations begin moved_issue = ::Issues::MoveService.new(project: source_project, current_user: current_user).execute(issue, target_project) - rescue ::Issues::MoveService::MoveError => error - errors = error.message + rescue ::Issues::MoveService::MoveError => e + errors = e.message end { diff --git a/app/graphql/mutations/issues/set_confidential.rb b/app/graphql/mutations/issues/set_confidential.rb index abfd6fec0bd..b795d66c16f 100644 --- a/app/graphql/mutations/issues/set_confidential.rb +++ b/app/graphql/mutations/issues/set_confidential.rb @@ -24,7 +24,7 @@ module Mutations check_spam_action_response!(issue) { - issue: issue, + issue: issue.reset, errors: errors_on_object(issue) } end diff --git a/app/graphql/mutations/issues/set_severity.rb b/app/graphql/mutations/issues/set_severity.rb index 872a0e7b33d..4a24bfd18ef 100644 --- a/app/graphql/mutations/issues/set_severity.rb +++ b/app/graphql/mutations/issues/set_severity.rb @@ -5,8 +5,9 @@ module Mutations class SetSeverity < Base graphql_name 'IssueSetSeverity' - argument :severity, Types::IssuableSeverityEnum, required: true, - description: 'Set the incident severity level.' + argument :severity, Types::IssuableSeverityEnum, + required: true, + description: 'Set the incident severity level.' authorize :admin_issue diff --git a/app/graphql/mutations/merge_requests/remove_attention_request.rb b/app/graphql/mutations/merge_requests/remove_attention_request.rb deleted file mode 100644 index 3b12b09528b..00000000000 --- a/app/graphql/mutations/merge_requests/remove_attention_request.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module MergeRequests - class RemoveAttentionRequest < Base - graphql_name 'MergeRequestRemoveAttentionRequest' - - argument :user_id, ::Types::GlobalIDType[::User], - loads: Types::UserType, - required: true, - description: <<~DESC - User ID of the user for attention request removal. - DESC - - def resolve(project_path:, iid:, user:) - raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless feature_enabled? - - merge_request = authorized_find!(project_path: project_path, iid: iid) - - result = ::MergeRequests::RemoveAttentionRequestedService.new( - project: merge_request.project, - current_user: current_user, - merge_request: merge_request, - user: user - ).execute - - { - merge_request: merge_request, - errors: Array(result[:message]) - } - end - - private - - def feature_enabled? - current_user&.mr_attention_requests_enabled? - end - end - end -end diff --git a/app/graphql/mutations/merge_requests/request_attention.rb b/app/graphql/mutations/merge_requests/request_attention.rb deleted file mode 100644 index 5f5565285f6..00000000000 --- a/app/graphql/mutations/merge_requests/request_attention.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module MergeRequests - class RequestAttention < Base - graphql_name 'MergeRequestRequestAttention' - - argument :user_id, ::Types::GlobalIDType[::User], - loads: Types::UserType, - required: true, - description: <<~DESC - User ID of the user to request attention. - DESC - - def resolve(project_path:, iid:, user:) - raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless feature_enabled? - - merge_request = authorized_find!(project_path: project_path, iid: iid) - - result = ::MergeRequests::RequestAttentionService.new( - project: merge_request.project, - current_user: current_user, - merge_request: merge_request, - user: user - ).execute - - { - merge_request: merge_request, - errors: Array(result[:message]) - } - end - - private - - def feature_enabled? - current_user&.mr_attention_requests_enabled? - end - end - end -end diff --git a/app/graphql/mutations/merge_requests/set_reviewers.rb b/app/graphql/mutations/merge_requests/set_reviewers.rb new file mode 100644 index 00000000000..8d3f8601597 --- /dev/null +++ b/app/graphql/mutations/merge_requests/set_reviewers.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +module Mutations + module MergeRequests + class SetReviewers < Base + graphql_name 'MergeRequestSetReviewers' + + argument :reviewer_usernames, + [GraphQL::Types::String], + required: true, + description: 'Usernames of reviewers to assign. Replaces existing reviewers by default.' + + argument :operation_mode, + Types::MutationOperationModeEnum, + required: false, + default_value: Types::MutationOperationModeEnum.default_mode, + description: 'Operation to perform. Defaults to REPLACE.' + + def resolve(project_path:, iid:, reviewer_usernames:, operation_mode:) + resource = authorized_find!(project_path: project_path, iid: iid) + + ::MergeRequests::UpdateReviewersService.new( + project: resource.project, + current_user: current_user, + params: { reviewer_ids: reviewer_ids(resource, reviewer_usernames, operation_mode) } + ).execute(resource) + + { + resource.class.name.underscore.to_sym => resource, + errors: errors_on_object(resource) + } + end + + private + + def reviewer_ids(resource, usernames, mode) + new_reviewers = UsersFinder.new(current_user, username: usernames).execute.to_a + new_reviewer_ids = user_ids(new_reviewers) + + case mode + when 'REPLACE' then new_reviewer_ids + when 'APPEND' then user_ids(resource.reviewers) | new_reviewer_ids + when 'REMOVE' then user_ids(resource.reviewers) - new_reviewer_ids + end + end + + def user_ids(users) + users.map(&:id) + end + end + end +end diff --git a/app/graphql/mutations/merge_requests/toggle_attention_requested.rb b/app/graphql/mutations/merge_requests/toggle_attention_requested.rb deleted file mode 100644 index 8913ca48531..00000000000 --- a/app/graphql/mutations/merge_requests/toggle_attention_requested.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -module Mutations - module MergeRequests - class ToggleAttentionRequested < Base - graphql_name 'MergeRequestToggleAttentionRequested' - - argument :user_id, ::Types::GlobalIDType[::User], - loads: Types::UserType, - required: true, - description: <<~DESC - User ID for the user to toggle attention requested. - DESC - - def resolve(project_path:, iid:, user:) - raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless current_user&.mr_attention_requests_enabled? - - merge_request = authorized_find!(project_path: project_path, iid: iid) - - result = ::MergeRequests::ToggleAttentionRequestedService.new(project: merge_request.project, current_user: current_user, merge_request: merge_request, user: user).execute - - { - merge_request: merge_request, - errors: Array(result[:message]) - } - end - end - end -end diff --git a/app/graphql/mutations/notes/create/base.rb b/app/graphql/mutations/notes/create/base.rb index 1b673204213..f48e62af767 100644 --- a/app/graphql/mutations/notes/create/base.rb +++ b/app/graphql/mutations/notes/create/base.rb @@ -21,7 +21,13 @@ module Mutations argument :confidential, GraphQL::Types::Boolean, required: false, - description: 'Confidentiality flag of a note. Default is false.' + description: 'Confidentiality flag of a note. Default is false.', + deprecated: { reason: :renamed, replacement: 'internal', milestone: '15.3' } + + argument :internal, + GraphQL::Types::Boolean, + required: false, + description: 'Internal flag for a note. Default is false.' def resolve(args) noteable = authorized_find!(id: args[:noteable_id]) @@ -49,7 +55,7 @@ module Mutations { noteable: noteable, note: args[:body], - confidential: args[:confidential] + internal: args[:internal] || args[:confidential] } end diff --git a/app/graphql/mutations/security/ci_configuration/base_security_analyzer.rb b/app/graphql/mutations/security/ci_configuration/base_security_analyzer.rb index e5bb5b6d573..3ccc90c16ae 100644 --- a/app/graphql/mutations/security/ci_configuration/base_security_analyzer.rb +++ b/app/graphql/mutations/security/ci_configuration/base_security_analyzer.rb @@ -7,14 +7,16 @@ module Mutations include FindsProject argument :project_path, GraphQL::Types::ID, - required: true, - description: 'Full path of the project.' + required: true, + description: 'Full path of the project.' - field :success_path, GraphQL::Types::String, null: true, - description: 'Redirect path to use when the response is successful.' + field :success_path, GraphQL::Types::String, + null: true, + description: 'Redirect path to use when the response is successful.' - field :branch, GraphQL::Types::String, null: true, - description: 'Branch that has the new/modified `.gitlab-ci.yml` file.' + field :branch, GraphQL::Types::String, + null: true, + description: 'Branch that has the new/modified `.gitlab-ci.yml` file.' authorize :push_code diff --git a/app/graphql/mutations/timelogs/base.rb b/app/graphql/mutations/timelogs/base.rb new file mode 100644 index 00000000000..9859f0e7d79 --- /dev/null +++ b/app/graphql/mutations/timelogs/base.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Mutations + module Timelogs + class Base < Mutations::BaseMutation + field :timelog, + Types::TimelogType, + null: true, + description: 'Timelog.' + + private + + def response(result) + { timelog: result.payload[:timelog], errors: result.errors } + end + end + end +end diff --git a/app/graphql/mutations/timelogs/create.rb b/app/graphql/mutations/timelogs/create.rb new file mode 100644 index 00000000000..bab7508454e --- /dev/null +++ b/app/graphql/mutations/timelogs/create.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module Mutations + module Timelogs + class Create < Base + graphql_name 'TimelogCreate' + + argument :time_spent, + GraphQL::Types::String, + required: true, + description: 'Amount of time spent.' + + argument :spent_at, + Types::DateType, + required: true, + description: 'When the time was spent.' + + argument :summary, + GraphQL::Types::String, + required: true, + description: 'Summary of time spent.' + + argument :issuable_id, + ::Types::GlobalIDType[::Issuable], + required: true, + description: 'Global ID of the issuable (Issue, WorkItem or MergeRequest).' + + authorize :create_timelog + + def resolve(issuable_id:, time_spent:, spent_at:, summary:, **args) + issuable = authorized_find!(id: issuable_id) + parsed_time_spent = Gitlab::TimeTrackingFormatter.parse(time_spent) + + result = ::Timelogs::CreateService.new( + issuable, parsed_time_spent, spent_at, summary, current_user + ).execute + + response(result) + end + + private + + def find_object(id:) + GitlabSchema.object_from_id(id, expected_type: [::Issue, ::WorkItem, ::MergeRequest]).sync + end + end + end +end diff --git a/app/graphql/mutations/timelogs/delete.rb b/app/graphql/mutations/timelogs/delete.rb index 8fd41c27b88..61588d839a7 100644 --- a/app/graphql/mutations/timelogs/delete.rb +++ b/app/graphql/mutations/timelogs/delete.rb @@ -2,14 +2,9 @@ module Mutations module Timelogs - class Delete < Mutations::BaseMutation + class Delete < Base graphql_name 'TimelogDelete' - field :timelog, - Types::TimelogType, - null: true, - description: 'Deleted timelog.' - argument :id, ::Types::GlobalIDType[::Timelog], required: true, @@ -22,11 +17,13 @@ module Mutations result = ::Timelogs::DeleteService.new(timelog, current_user).execute # Return the result payload, not the loaded timelog, so that it returns null in case of unauthorized access - { timelog: result.payload, errors: result.errors } + response(result) end + private + def find_object(id:) - GitlabSchema.find_by_gid(id) + GitlabSchema.object_from_id(id, expected_type: ::Timelog).sync end end end diff --git a/app/graphql/mutations/uploads/delete.rb b/app/graphql/mutations/uploads/delete.rb new file mode 100644 index 00000000000..e2fb967cd2c --- /dev/null +++ b/app/graphql/mutations/uploads/delete.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Mutations + module Uploads + class Delete < BaseMutation + graphql_name 'UploadDelete' + description 'Deletes an upload.' + + include Mutations::ResolvesResourceParent + + authorize :destroy_upload + + argument :secret, GraphQL::Types::String, + required: true, + description: 'Secret part of upload path.' + + argument :filename, GraphQL::Types::String, + required: true, + description: 'Upload filename.' + + field :upload, Types::UploadType, + null: true, + description: 'Deleted upload.' + + def resolve(args) + parent = authorized_resource_parent_find!(args) + + result = ::Uploads::DestroyService.new(parent, current_user).execute(args[:secret], args[:filename]) + + { + upload: result[:status] == :success ? result[:upload] : nil, + errors: Array(result[:message]) + } + end + end + end +end diff --git a/app/graphql/mutations/work_items/create.rb b/app/graphql/mutations/work_items/create.rb index 350153eaf19..ece00e04ed9 100644 --- a/app/graphql/mutations/work_items/create.rb +++ b/app/graphql/mutations/work_items/create.rb @@ -13,6 +13,9 @@ module Mutations authorize :create_work_item + argument :confidential, GraphQL::Types::Boolean, + required: false, + description: 'Sets the work item confidentiality.' argument :description, GraphQL::Types::String, required: false, description: copy_field_description(Types::WorkItemType, :description) diff --git a/app/graphql/mutations/work_items/update.rb b/app/graphql/mutations/work_items/update.rb index 5d8c574877a..b4ed0a1a3ca 100644 --- a/app/graphql/mutations/work_items/update.rb +++ b/app/graphql/mutations/work_items/update.rb @@ -51,3 +51,5 @@ module Mutations end end end + +Mutations::WorkItems::Update.prepend_mod diff --git a/app/graphql/resolvers/ci/config_resolver.rb b/app/graphql/resolvers/ci/config_resolver.rb index 1f486c47771..ec6ede58cf5 100644 --- a/app/graphql/resolvers/ci/config_resolver.rb +++ b/app/graphql/resolvers/ci/config_resolver.rb @@ -38,8 +38,8 @@ module Resolvers .validate(content, dry_run: dry_run) response(result) - rescue GRPC::InvalidArgument => error - Gitlab::ErrorTracking.track_and_raise_exception(error, sha: sha) + rescue GRPC::InvalidArgument => e + Gitlab::ErrorTracking.track_and_raise_exception(e, sha: sha) end private diff --git a/app/graphql/resolvers/ci/runners_resolver.rb b/app/graphql/resolvers/ci/runners_resolver.rb index 64738608b60..b52a4cc0ab4 100644 --- a/app/graphql/resolvers/ci/runners_resolver.rb +++ b/app/graphql/resolvers/ci/runners_resolver.rb @@ -36,7 +36,7 @@ module Resolvers required: false, description: 'Sort order of results.' - argument :upgrade_status, ::Types::Ci::RunnerUpgradeStatusTypeEnum, + argument :upgrade_status, ::Types::Ci::RunnerUpgradeStatusEnum, required: false, description: 'Filter by upgrade status.' diff --git a/app/graphql/resolvers/ci/template_resolver.rb b/app/graphql/resolvers/ci/template_resolver.rb index 17f2668df11..f2531d877c7 100644 --- a/app/graphql/resolvers/ci/template_resolver.rb +++ b/app/graphql/resolvers/ci/template_resolver.rb @@ -5,8 +5,11 @@ module Resolvers class TemplateResolver < BaseResolver type Types::Ci::TemplateType, null: true - argument :name, GraphQL::Types::String, required: true, - description: 'Name of the CI/CD template to search for. Template must be formatted as `Name.gitlab-ci.yml`.' + argument :name, + GraphQL::Types::String, + required: true, + description: 'Name of the CI/CD template to search for. ' \ + 'Template must be formatted as `Name.gitlab-ci.yml`.' alias_method :project, :object diff --git a/app/graphql/resolvers/crm/contact_state_counts_resolver.rb b/app/graphql/resolvers/crm/contact_state_counts_resolver.rb new file mode 100644 index 00000000000..f696400d44e --- /dev/null +++ b/app/graphql/resolvers/crm/contact_state_counts_resolver.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Resolvers + module Crm + class ContactStateCountsResolver < BaseResolver + include Gitlab::Graphql::Authorize::AuthorizeResource + + authorize :read_crm_contact + + type Types::CustomerRelations::ContactStateCountsType, null: true + + argument :search, GraphQL::Types::String, + required: false, + description: 'Search term to find contacts with.' + + argument :state, Types::CustomerRelations::ContactStateEnum, + required: false, + description: 'State of the contacts to search for.' + + def resolve(**args) + CustomerRelations::ContactStateCounts.new(context[:current_user], object, args) + end + end + end +end diff --git a/app/graphql/resolvers/crm/contacts_resolver.rb b/app/graphql/resolvers/crm/contacts_resolver.rb index 58d0e2ce13d..a93942cf93b 100644 --- a/app/graphql/resolvers/crm/contacts_resolver.rb +++ b/app/graphql/resolvers/crm/contacts_resolver.rb @@ -10,6 +10,11 @@ module Resolvers type Types::CustomerRelations::ContactType, null: true + argument :sort, Types::CustomerRelations::ContactSortEnum, + description: 'Criteria to sort contacts by.', + required: false, + default_value: { field: 'last_name', direction: :asc } + argument :search, GraphQL::Types::String, required: false, description: 'Search term to find contacts with.' @@ -24,13 +29,25 @@ module Resolvers def resolve(**args) args[:ids] = resolve_ids(args.delete(:ids)) - - ::Crm::ContactsFinder.new(current_user, { group: group }.merge(args)).execute + args.delete(:state) if args[:state] == :all + + contacts = ::Crm::ContactsFinder.new(current_user, { group: group }.merge(args)).execute + if needs_offset?(args) + offset_pagination(contacts) + else + contacts + end end def group object.respond_to?(:sync) ? object.sync : object end + + private + + def needs_offset?(args) + args.key?(:sort) && args[:sort][:field] == 'organization' + end end end end diff --git a/app/graphql/resolvers/environments_resolver.rb b/app/graphql/resolvers/environments_resolver.rb index 1823eb65d44..934c1ba2738 100644 --- a/app/graphql/resolvers/environments_resolver.rb +++ b/app/graphql/resolvers/environments_resolver.rb @@ -22,8 +22,8 @@ module Resolvers return unless project.present? Environments::EnvironmentsFinder.new(project, context[:current_user], args).execute - rescue Environments::EnvironmentsFinder::InvalidStatesError => exception - raise Gitlab::Graphql::Errors::ArgumentError, exception.message + rescue Environments::EnvironmentsFinder::InvalidStatesError => e + raise Gitlab::Graphql::Errors::ArgumentError, e.message end end end 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 27bba6c8144..187063bb8c3 100644 --- a/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb +++ b/app/graphql/resolvers/error_tracking/sentry_detailed_error_resolver.rb @@ -14,7 +14,7 @@ module Resolvers response = ::ErrorTracking::IssueDetailsService.new( project, current_user, - { issue_id: id.model_id } + { issue_id: id.model_id, tracking_event: :error_tracking_view_details } ).execute issue = response[:issue] issue.gitlab_project = project if issue diff --git a/app/graphql/resolvers/group_milestones_resolver.rb b/app/graphql/resolvers/group_milestones_resolver.rb index 319ff9f68c4..9242be7f684 100644 --- a/app/graphql/resolvers/group_milestones_resolver.rb +++ b/app/graphql/resolvers/group_milestones_resolver.rb @@ -45,5 +45,9 @@ module Resolvers options: { include_subgroups: true } ).execute end + + def preloads + super.merge({ subgroup_milestone: :group }) + end end end diff --git a/app/graphql/resolvers/projects/fork_targets_resolver.rb b/app/graphql/resolvers/projects/fork_targets_resolver.rb new file mode 100644 index 00000000000..5e8be325d43 --- /dev/null +++ b/app/graphql/resolvers/projects/fork_targets_resolver.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Resolvers + module Projects + class ForkTargetsResolver < BaseResolver + include ResolvesGroups + include Gitlab::Graphql::Authorize::AuthorizeResource + + type Types::NamespaceType.connection_type, null: true + + authorize :fork_project + authorizes_object! + + alias_method :project, :object + + argument :search, GraphQL::Types::String, + required: false, + description: 'Search query for path or name.' + + private + + def resolve_groups(**args) + ForkTargetsFinder.new(project, current_user).execute(args) + end + end + end +end diff --git a/app/graphql/resolvers/projects_resolver.rb b/app/graphql/resolvers/projects_resolver.rb index b846248458f..facf8ffe36f 100644 --- a/app/graphql/resolvers/projects_resolver.rb +++ b/app/graphql/resolvers/projects_resolver.rb @@ -25,8 +25,8 @@ module Resolvers description: 'Sort order of results.' argument :topics, type: [GraphQL::Types::String], - required: false, - description: 'Filters projects by topics.' + required: false, + description: 'Filters projects by topics.' def resolve(**args) ProjectsFinder diff --git a/app/graphql/resolvers/users_resolver.rb b/app/graphql/resolvers/users_resolver.rb index b0d704d09fc..90a6bd3e6b2 100644 --- a/app/graphql/resolvers/users_resolver.rb +++ b/app/graphql/resolvers/users_resolver.rb @@ -12,7 +12,7 @@ module Resolvers description: 'List of user Global IDs.' argument :usernames, [GraphQL::Types::String], required: false, - description: 'List of usernames.' + description: 'List of usernames.' argument :sort, Types::SortEnum, description: 'Sort users by this criteria.', diff --git a/app/graphql/resolvers/work_items_resolver.rb b/app/graphql/resolvers/work_items_resolver.rb index 1bc74131b9e..055984db3cb 100644 --- a/app/graphql/resolvers/work_items_resolver.rb +++ b/app/graphql/resolvers/work_items_resolver.rb @@ -58,3 +58,5 @@ module Resolvers end end end + +Resolvers::WorkItemsResolver.prepend_mod_with('Resolvers::WorkItemsResolver') diff --git a/app/graphql/types/access_level_type.rb b/app/graphql/types/access_level_type.rb index 2d97f6b30e8..4a709aa4711 100644 --- a/app/graphql/types/access_level_type.rb +++ b/app/graphql/types/access_level_type.rb @@ -7,11 +7,11 @@ module Types description 'Represents the access level of a relationship between a User and object that it is related to' field :integer_value, GraphQL::Types::Int, null: true, - description: 'Integer representation of access level.', - method: :to_i + description: 'Integer representation of access level.', + method: :to_i field :string_value, Types::AccessLevelEnum, null: true, - description: 'String representation of access level.', - method: :to_i + description: 'String representation of access level.', + method: :to_i end end diff --git a/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb b/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb index 1fc47303d67..0da0a6bcd1a 100644 --- a/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb +++ b/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb @@ -13,12 +13,14 @@ module Types authorize :read_usage_trends_measurement field :recorded_at, Types::TimeType, null: true, - description: 'Time the measurement was recorded.' + description: 'Time the measurement was recorded.' field :count, GraphQL::Types::Int, null: false, - description: 'Object count.' + description: 'Object count.' - field :identifier, Types::Admin::Analytics::UsageTrends::MeasurementIdentifierEnum, null: false, + field :identifier, + Types::Admin::Analytics::UsageTrends::MeasurementIdentifierEnum, + null: false, description: 'Type of objects being measured.' end end diff --git a/app/graphql/types/alert_management/domain_filter_enum.rb b/app/graphql/types/alert_management/domain_filter_enum.rb index cd70cdd8ecf..86da345fd69 100644 --- a/app/graphql/types/alert_management/domain_filter_enum.rb +++ b/app/graphql/types/alert_management/domain_filter_enum.rb @@ -7,11 +7,12 @@ module Types description 'Filters the alerts based on given domain' value 'operations', description: 'Alerts for operations domain.' - value 'threat_monitoring', description: 'Alerts for threat monitoring domain.', - deprecated: { - reason: 'Network policies are deprecated and will be removed in GitLab 16.0', - milestone: '15.0' - } + value 'threat_monitoring', + description: 'Alerts for threat monitoring domain.', + deprecated: { + reason: 'Network policies are deprecated and will be removed in GitLab 16.0', + milestone: '15.0' + } end end end diff --git a/app/graphql/types/base_field.rb b/app/graphql/types/base_field.rb index 6aee9a5c052..1c43432594a 100644 --- a/app/graphql/types/base_field.rb +++ b/app/graphql/types/base_field.rb @@ -17,7 +17,7 @@ module Types @requires_argument = !!kwargs.delete(:requires_argument) @authorize = Array.wrap(kwargs.delete(:authorize)) kwargs[:complexity] = field_complexity(kwargs[:resolver_class], kwargs[:complexity]) - @feature_flag = kwargs[:feature_flag] + @feature_flag = kwargs[:_deprecated_feature_flag] kwargs = check_feature_flag(kwargs) @deprecation = gitlab_deprecation(kwargs) after_connection_extensions = kwargs.delete(:late_extensions) || [] @@ -136,7 +136,7 @@ module Types end def check_feature_flag(args) - ff = args.delete(:feature_flag) + ff = args.delete(:_deprecated_feature_flag) return args unless ff.present? args[:description] = feature_documentation_message(ff, args[:description]) diff --git a/app/graphql/types/board_list_type.rb b/app/graphql/types/board_list_type.rb index 7f4c49df429..2352a21bd87 100644 --- a/app/graphql/types/board_list_type.rb +++ b/app/graphql/types/board_list_type.rb @@ -15,19 +15,21 @@ module Types description: 'ID (global ID) of the list.' field :collapsed, GraphQL::Types::Boolean, null: true, - description: 'Indicates if the list is collapsed for this user.' + description: 'Indicates if the list is collapsed for this user.' field :issues_count, GraphQL::Types::Int, null: true, - description: 'Count of issues in the list.' + description: 'Count of issues in the list.' field :label, Types::LabelType, null: true, - description: 'Label of the list.' + description: 'Label of the list.' field :list_type, GraphQL::Types::String, null: false, - description: 'Type of the list.' + description: 'Type of the list.' field :position, GraphQL::Types::Int, null: true, - description: 'Position of list within the board.' + description: 'Position of list within the board.' field :title, GraphQL::Types::String, null: false, - description: 'Title of the list.' + description: 'Title of the list.' - field :issues, ::Types::IssueType.connection_type, null: true, + field :issues, + ::Types::IssueType.connection_type, + null: true, description: 'Board issues.', late_extensions: [Gitlab::Graphql::Board::IssuesConnectionExtension], resolver: ::Resolvers::BoardListIssuesResolver diff --git a/app/graphql/types/board_type.rb b/app/graphql/types/board_type.rb index 4ec9a8a9c63..00638988989 100644 --- a/app/graphql/types/board_type.rb +++ b/app/graphql/types/board_type.rb @@ -10,21 +10,21 @@ module Types present_using BoardPresenter field :id, type: GraphQL::Types::ID, null: false, - description: 'ID (global ID) of the board.' + description: 'ID (global ID) of the board.' field :name, type: GraphQL::Types::String, null: true, - description: 'Name of the board.' + description: 'Name of the board.' field :hide_backlog_list, type: GraphQL::Types::Boolean, null: true, - description: 'Whether or not backlog list is hidden.' + description: 'Whether or not backlog list is hidden.' field :hide_closed_list, type: GraphQL::Types::Boolean, null: true, - description: 'Whether or not closed list is hidden.' + description: 'Whether or not closed list is hidden.' field :created_at, Types::TimeType, null: false, - description: 'Timestamp of when the board was created.' + description: 'Timestamp of when the board was created.' field :updated_at, Types::TimeType, null: false, - description: 'Timestamp of when the board was last updated.' + description: 'Timestamp of when the board was last updated.' field :lists, Types::BoardListType.connection_type, @@ -34,10 +34,10 @@ module Types extras: [:lookahead] field :web_path, GraphQL::Types::String, null: false, - description: 'Web path of the board.' + description: 'Web path of the board.' field :web_url, GraphQL::Types::String, null: false, - description: 'Web URL of the board.' + description: 'Web URL of the board.' end end diff --git a/app/graphql/types/ci/analytics_type.rb b/app/graphql/types/ci/analytics_type.rb index a77b8026f86..6a55a6138ea 100644 --- a/app/graphql/types/ci/analytics_type.rb +++ b/app/graphql/types/ci/analytics_type.rb @@ -7,27 +7,27 @@ module Types graphql_name 'PipelineAnalytics' field :month_pipelines_labels, [GraphQL::Types::String], null: true, - description: 'Labels for the monthly pipeline count.' + description: 'Labels for the monthly pipeline count.' field :month_pipelines_successful, [GraphQL::Types::Int], null: true, - description: 'Total monthly successful pipeline count.' + description: 'Total monthly successful pipeline count.' field :month_pipelines_totals, [GraphQL::Types::Int], null: true, - description: 'Total monthly pipeline count.' + description: 'Total monthly pipeline count.' field :pipeline_times_labels, [GraphQL::Types::String], null: true, - description: 'Pipeline times labels.' + description: 'Pipeline times labels.' field :pipeline_times_values, [GraphQL::Types::Int], null: true, - description: 'Pipeline times.' + description: 'Pipeline times.' field :week_pipelines_labels, [GraphQL::Types::String], null: true, - description: 'Labels for the weekly pipeline count.' + description: 'Labels for the weekly pipeline count.' field :week_pipelines_successful, [GraphQL::Types::Int], null: true, - description: 'Total weekly successful pipeline count.' + description: 'Total weekly successful pipeline count.' field :week_pipelines_totals, [GraphQL::Types::Int], null: true, - description: 'Total weekly pipeline count.' + description: 'Total weekly pipeline count.' field :year_pipelines_labels, [GraphQL::Types::String], null: true, - description: 'Labels for the yearly pipeline count.' + description: 'Labels for the yearly pipeline count.' field :year_pipelines_successful, [GraphQL::Types::Int], null: true, - description: 'Total yearly successful pipeline count.' + description: 'Total yearly successful pipeline count.' field :year_pipelines_totals, [GraphQL::Types::Int], null: true, - description: 'Total yearly pipeline count.' + description: 'Total yearly pipeline count.' end end end diff --git a/app/graphql/types/ci/application_setting_type.rb b/app/graphql/types/ci/application_setting_type.rb index 2322778d159..53202c56f03 100644 --- a/app/graphql/types/ci/application_setting_type.rb +++ b/app/graphql/types/ci/application_setting_type.rb @@ -8,7 +8,7 @@ module Types authorize :read_application_setting field :keep_latest_artifact, GraphQL::Types::Boolean, null: true, - description: 'Whether to keep the latest jobs artifacts.' + description: 'Whether to keep the latest jobs artifacts.' end end end diff --git a/app/graphql/types/ci/build_need_type.rb b/app/graphql/types/ci/build_need_type.rb index b71d10c4c06..4ab711881fe 100644 --- a/app/graphql/types/ci/build_need_type.rb +++ b/app/graphql/types/ci/build_need_type.rb @@ -8,9 +8,9 @@ module Types graphql_name 'CiBuildNeed' field :id, GraphQL::Types::ID, null: false, - description: 'ID of the BuildNeed.' + description: 'ID of the BuildNeed.' field :name, GraphQL::Types::String, null: true, - description: 'Name of the job we need to complete.' + 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 e43af6f3e78..bec8c72e783 100644 --- a/app/graphql/types/ci/ci_cd_setting_type.rb +++ b/app/graphql/types/ci/ci_cd_setting_type.rb @@ -7,20 +7,22 @@ module Types authorize :admin_project - field :job_token_scope_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates CI job tokens generated in this project have restricted access to resources.', - method: :job_token_scope_enabled? + field :job_token_scope_enabled, + GraphQL::Types::Boolean, + null: true, + description: 'Indicates CI job tokens generated in this project have restricted access to resources.', + method: :job_token_scope_enabled? field :keep_latest_artifact, GraphQL::Types::Boolean, null: true, - description: 'Whether to keep the latest builds artifacts.', - method: :keep_latest_artifacts_available? + description: 'Whether to keep the latest builds artifacts.', + method: :keep_latest_artifacts_available? field :merge_pipelines_enabled, GraphQL::Types::Boolean, null: true, - description: 'Whether merge pipelines are enabled.', - method: :merge_pipelines_enabled? + description: 'Whether merge pipelines are enabled.', + method: :merge_pipelines_enabled? field :merge_trains_enabled, GraphQL::Types::Boolean, null: true, - description: 'Whether merge trains are enabled.', - method: :merge_trains_enabled? + description: 'Whether merge trains are enabled.', + method: :merge_trains_enabled? field :project, Types::ProjectType, null: true, - description: 'Project the CI/CD settings belong to.' + description: 'Project the CI/CD settings belong to.' end end end diff --git a/app/graphql/types/ci/config/config_type.rb b/app/graphql/types/ci/config/config_type.rb index a7a6927136d..6ccc62331df 100644 --- a/app/graphql/types/ci/config/config_type.rb +++ b/app/graphql/types/ci/config/config_type.rb @@ -8,17 +8,17 @@ module Types graphql_name 'CiConfig' field :errors, [GraphQL::Types::String], null: true, - description: 'Linting errors.' + description: 'Linting errors.' field :includes, [Types::Ci::Config::IncludeType], null: true, - description: 'List of included files.' + description: 'List of included files.' field :merged_yaml, GraphQL::Types::String, null: true, - description: 'Merged CI configuration YAML.' + description: 'Merged CI configuration YAML.' field :stages, Types::Ci::Config::StageType.connection_type, null: true, - description: 'Stages of the pipeline.' + description: 'Stages of the pipeline.' field :status, Types::Ci::Config::StatusEnum, null: true, - description: 'Status of linting, can be either valid or invalid.' + description: 'Status of linting, can be either valid or invalid.' field :warnings, [GraphQL::Types::String], null: true, - description: 'Linting warnings.' + description: 'Linting warnings.' end end end diff --git a/app/graphql/types/ci/config/group_type.rb b/app/graphql/types/ci/config/group_type.rb index 19076fe9c20..8c4a0c04a2a 100644 --- a/app/graphql/types/ci/config/group_type.rb +++ b/app/graphql/types/ci/config/group_type.rb @@ -8,11 +8,11 @@ module Types graphql_name 'CiConfigGroup' field :jobs, Types::Ci::Config::JobType.connection_type, null: true, - description: 'Jobs in group.' + description: 'Jobs in group.' field :name, GraphQL::Types::String, null: true, - description: 'Name of the job group.' + description: 'Name of the job group.' field :size, GraphQL::Types::Int, null: true, - description: 'Size of the job group.' + description: 'Size of the job group.' end end end diff --git a/app/graphql/types/ci/config/job_restriction_type.rb b/app/graphql/types/ci/config/job_restriction_type.rb index 8cf0e210def..bb9c03f7c1e 100644 --- a/app/graphql/types/ci/config/job_restriction_type.rb +++ b/app/graphql/types/ci/config/job_restriction_type.rb @@ -8,7 +8,7 @@ module Types graphql_name 'CiConfigJobRestriction' field :refs, [GraphQL::Types::String], null: true, - description: 'Git refs the job restriction applies to.' + description: 'Git refs the job restriction applies to.' end end end diff --git a/app/graphql/types/ci/config/job_type.rb b/app/graphql/types/ci/config/job_type.rb index 20279143635..fb92a37dee6 100644 --- a/app/graphql/types/ci/config/job_type.rb +++ b/app/graphql/types/ci/config/job_type.rb @@ -7,33 +7,41 @@ module Types class JobType < BaseObject graphql_name 'CiConfigJob' - field :after_script, [GraphQL::Types::String], null: true, + field :after_script, + [GraphQL::Types::String], + null: true, description: 'Override a set of commands that are executed after the job.' field :allow_failure, GraphQL::Types::Boolean, null: true, - description: 'Allow job to fail.' - field :before_script, [GraphQL::Types::String], null: true, + description: 'Allow job to fail.' + field :before_script, + [GraphQL::Types::String], + null: true, description: 'Override a set of commands that are executed before the job.' field :environment, GraphQL::Types::String, null: true, - description: 'Name of an environment to which the job deploys.' + 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.' + description: 'Limit when jobs are not created.' field :group_name, GraphQL::Types::String, null: true, - description: 'Name of the job group.' + description: 'Name of the job group.' field :name, GraphQL::Types::String, null: true, - description: 'Name of the job.' - field :needs, Types::Ci::Config::NeedType.connection_type, null: true, + description: 'Name of the job.' + field :needs, + Types::Ci::Config::NeedType.connection_type, + null: true, description: 'Builds that must complete before the jobs run.' - field :only, Types::Ci::Config::JobRestrictionType, null: true, - description: 'Jobs are created when these conditions do not apply.' + field :only, + Types::Ci::Config::JobRestrictionType, + null: true, + description: 'Jobs are created when these conditions do not apply.' field :script, [GraphQL::Types::String], null: true, - description: 'Shell script that is executed by a runner.' + description: 'Shell script that is executed by a runner.' field :stage, GraphQL::Types::String, null: true, - description: 'Name of the job stage.' + description: 'Name of the job stage.' field :tags, [GraphQL::Types::String], null: true, - description: 'List of tags that are used to select a runner.' + description: 'List of tags that are used to select a runner.' field :when, GraphQL::Types::String, null: true, - description: 'When to run the job.', - resolver_method: :restrict_when_to_run_jobs + description: 'When to run the job.', + resolver_method: :restrict_when_to_run_jobs def restrict_when_to_run_jobs object[:when] diff --git a/app/graphql/types/ci/config/need_type.rb b/app/graphql/types/ci/config/need_type.rb index 6e9aea8eb64..dd262923246 100644 --- a/app/graphql/types/ci/config/need_type.rb +++ b/app/graphql/types/ci/config/need_type.rb @@ -8,7 +8,7 @@ module Types graphql_name 'CiConfigNeed' field :name, GraphQL::Types::String, null: true, - description: 'Name of the need.' + description: 'Name of the need.' end end end diff --git a/app/graphql/types/ci/config/stage_type.rb b/app/graphql/types/ci/config/stage_type.rb index 5b1163edac2..4dacba2f1ed 100644 --- a/app/graphql/types/ci/config/stage_type.rb +++ b/app/graphql/types/ci/config/stage_type.rb @@ -8,9 +8,9 @@ module Types graphql_name 'CiConfigStage' field :groups, Types::Ci::Config::GroupType.connection_type, null: true, - description: 'Groups of jobs for the stage.' + description: 'Groups of jobs for the stage.' field :name, GraphQL::Types::String, null: true, - description: 'Name of the stage.' + description: 'Name of the stage.' end end end diff --git a/app/graphql/types/ci/detailed_status_type.rb b/app/graphql/types/ci/detailed_status_type.rb index 3fab040cc0b..8bc50e974bb 100644 --- a/app/graphql/types/ci/detailed_status_type.rb +++ b/app/graphql/types/ci/detailed_status_type.rb @@ -6,31 +6,33 @@ module Types class DetailedStatusType < BaseObject graphql_name 'DetailedStatus' - field :action, Types::Ci::StatusActionType, null: true, + field :action, + Types::Ci::StatusActionType, + null: true, calls_gitaly: true, description: 'Action information for the status. This includes method, button title, icon, path, and title.' field :details_path, GraphQL::Types::String, null: true, - description: 'Path of the details for the status.' + description: 'Path of the details for the status.' field :favicon, GraphQL::Types::String, null: true, - description: 'Favicon of the status.' + description: 'Favicon of the status.' field :group, GraphQL::Types::String, null: true, - description: 'Group of the status.' + description: 'Group of the status.' field :has_details, GraphQL::Types::Boolean, null: true, - description: 'Indicates if the status has further details.', - method: :has_details? + description: 'Indicates if the status has further details.', + method: :has_details? field :icon, GraphQL::Types::String, null: true, - description: 'Icon of the status.' + description: 'Icon of the status.' field :id, GraphQL::Types::String, null: false, - description: 'ID for a detailed status.', - extras: [:parent] + description: 'ID for a detailed status.', + extras: [:parent] field :label, GraphQL::Types::String, null: true, - calls_gitaly: true, - description: 'Label of the status.' + calls_gitaly: true, + description: 'Label of the status.' field :text, GraphQL::Types::String, null: true, - description: 'Text of the status.' + description: 'Text of the status.' field :tooltip, GraphQL::Types::String, null: true, - description: 'Tooltip associated with the status.', - method: :status_tooltip + description: 'Tooltip associated with the status.', + method: :status_tooltip def id(parent:) "#{object.id}-#{parent.id}" diff --git a/app/graphql/types/ci/group_type.rb b/app/graphql/types/ci/group_type.rb index c3c73ef170c..f2150fa5e1a 100644 --- a/app/graphql/types/ci/group_type.rb +++ b/app/graphql/types/ci/group_type.rb @@ -7,15 +7,15 @@ module Types graphql_name 'CiGroup' field :detailed_status, Types::Ci::DetailedStatusType, null: true, - description: 'Detailed status of the group.' + description: 'Detailed status of the group.' field :id, GraphQL::Types::String, null: false, - description: 'ID for a group.' + description: 'ID for a group.' field :jobs, Ci::JobType.connection_type, null: true, - description: 'Jobs in group.' + description: 'Jobs in group.' field :name, GraphQL::Types::String, null: true, - description: 'Name of the job group.' + description: 'Name of the job group.' field :size, GraphQL::Types::Int, null: true, - description: 'Size of the group.' + description: 'Size of the group.' def detailed_status object.detailed_status(context[:current_user]) diff --git a/app/graphql/types/ci/group_variable_type.rb b/app/graphql/types/ci/group_variable_type.rb new file mode 100644 index 00000000000..3322f741342 --- /dev/null +++ b/app/graphql/types/ci/group_variable_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Types + module Ci + # rubocop: disable Graphql/AuthorizeTypes + class GroupVariableType < BaseObject + graphql_name 'CiGroupVariable' + description 'CI/CD variables for a group.' + + implements(VariableInterface) + + field :environment_scope, GraphQL::Types::String, + null: true, + description: 'Scope defining the environments that can use the variable.' + + field :protected, GraphQL::Types::Boolean, + null: true, + description: 'Indicates whether the variable is protected.' + + field :masked, GraphQL::Types::Boolean, + null: true, + description: 'Indicates whether the variable is masked.' + end + end +end diff --git a/app/graphql/types/ci/instance_variable_type.rb b/app/graphql/types/ci/instance_variable_type.rb new file mode 100644 index 00000000000..f564a2f59a0 --- /dev/null +++ b/app/graphql/types/ci/instance_variable_type.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Types + module Ci + # rubocop: disable Graphql/AuthorizeTypes + class InstanceVariableType < BaseObject + graphql_name 'CiInstanceVariable' + description 'CI/CD variables for a GitLab instance.' + + implements(VariableInterface) + + field :environment_scope, GraphQL::Types::String, + null: true, + deprecated: { + reason: 'No longer used, only available for GroupVariableType and ProjectVariableType', + milestone: '15.3' + }, + description: 'Scope defining the environments that can use the variable.' + + field :protected, GraphQL::Types::Boolean, + null: true, + description: 'Indicates whether the variable is protected.' + + field :masked, GraphQL::Types::Boolean, + null: true, + description: 'Indicates whether the variable is masked.' + + def environment_scope + nil + end + end + end +end diff --git a/app/graphql/types/ci/job_artifact_type.rb b/app/graphql/types/ci/job_artifact_type.rb index 69bb5325dba..a6ab445702c 100644 --- a/app/graphql/types/ci/job_artifact_type.rb +++ b/app/graphql/types/ci/job_artifact_type.rb @@ -7,14 +7,14 @@ module Types graphql_name 'CiJobArtifact' field :download_path, GraphQL::Types::String, null: true, - description: "URL for downloading the artifact's file." + description: "URL for downloading the artifact's file." field :file_type, ::Types::Ci::JobArtifactFileTypeEnum, null: true, - description: 'File type of the artifact.' + description: 'File type of the artifact.' field :name, GraphQL::Types::String, null: true, - description: 'File name of the artifact.', - method: :filename + description: 'File name of the artifact.', + method: :filename def download_path ::Gitlab::Routing.url_helpers.download_project_job_artifacts_path( diff --git a/app/graphql/types/ci/job_token_scope_type.rb b/app/graphql/types/ci/job_token_scope_type.rb index 9f48298e1d3..37c0af944a7 100644 --- a/app/graphql/types/ci/job_token_scope_type.rb +++ b/app/graphql/types/ci/job_token_scope_type.rb @@ -7,9 +7,11 @@ module Types class JobTokenScopeType < BaseObject graphql_name 'CiJobTokenScopeType' - field :projects, Types::ProjectType.connection_type, null: false, - description: 'Allow list of projects that can be accessed by CI Job tokens created by this project.', - method: :all_projects + field :projects, + Types::ProjectType.connection_type, + null: false, + description: 'Allow list of projects that can be accessed by CI Job tokens created by this project.', + method: :all_projects end end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 42b55f47f92..4ea9a016e74 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -12,39 +12,39 @@ module Types expose_permissions Types::PermissionTypes::Ci::Job field :allow_failure, ::GraphQL::Types::Boolean, null: false, - description: 'Whether the job is allowed to fail.' + description: 'Whether the job is allowed to fail.' field :duration, GraphQL::Types::Int, null: true, - description: 'Duration of the job in seconds.' + description: 'Duration of the job in seconds.' field :id, ::Types::GlobalIDType[::CommitStatus].as('JobID'), null: true, - description: 'ID of the job.' + description: 'ID of the job.' field :kind, type: ::Types::Ci::JobKindEnum, null: false, - description: 'Indicates the type of job.' + description: 'Indicates the type of job.' field :name, GraphQL::Types::String, null: true, - description: 'Name of the job.' + description: 'Name of the job.' field :needs, BuildNeedType.connection_type, null: true, - description: 'References to builds that must complete before the jobs run.' + description: 'References to builds that must complete before the jobs run.' field :pipeline, Types::Ci::PipelineType, null: true, - description: 'Pipeline the job belongs to.' + description: 'Pipeline the job belongs to.' field :stage, Types::Ci::StageType, null: true, - description: 'Stage of the job.' + description: 'Stage of the job.' field :status, type: ::Types::Ci::JobStatusEnum, null: true, description: "Status of the job." field :tags, [GraphQL::Types::String], null: true, - description: 'Tags for the current job.' + description: 'Tags for the current job.' # Life-cycle timestamps: field :created_at, Types::TimeType, null: false, - description: "When the job was created." + description: "When the job was created." field :finished_at, Types::TimeType, null: true, - description: 'When a job has finished running.' + description: 'When a job has finished running.' field :queued_at, Types::TimeType, null: true, - description: 'When the job was enqueued and marked as pending.' + description: 'When the job was enqueued and marked as pending.' field :scheduled_at, Types::TimeType, null: true, - description: 'Schedule for the build.' + description: 'Schedule for the build.' field :started_at, Types::TimeType, null: true, - description: 'When the job was started.' + description: 'When the job was started.' # Life-cycle durations: field :queued_duration, @@ -53,45 +53,45 @@ module Types description: 'How long the job was enqueued before starting.' field :active, GraphQL::Types::Boolean, null: false, method: :active?, - description: 'Indicates the job is active.' + description: 'Indicates the job is active.' field :artifacts, Types::Ci::JobArtifactType.connection_type, null: true, - description: 'Artifacts generated by the job.' + description: 'Artifacts generated by the job.' field :cancelable, GraphQL::Types::Boolean, null: false, method: :cancelable?, - description: 'Indicates the job can be canceled.' + description: 'Indicates the job can be canceled.' field :commit_path, GraphQL::Types::String, null: true, - description: 'Path to the commit that triggered the job.' + description: 'Path to the commit that triggered the job.' field :coverage, GraphQL::Types::Float, null: true, - description: 'Coverage level of the job.' + description: 'Coverage level of the job.' field :created_by_tag, GraphQL::Types::Boolean, null: false, - description: 'Whether the job was created by a tag.', method: :tag? + description: 'Whether the job was created by a tag.', method: :tag? field :detailed_status, Types::Ci::DetailedStatusType, null: true, - description: 'Detailed status of the job.' + description: 'Detailed status of the job.' field :downstream_pipeline, Types::Ci::PipelineType, null: true, - description: 'Downstream pipeline for a bridge.' + description: 'Downstream pipeline for a bridge.' field :manual_job, GraphQL::Types::Boolean, null: true, - description: 'Whether the job has a manual action.' - field :manual_variables, VariableType.connection_type, null: true, - description: 'Variables added to a manual job when the job is triggered.' + description: 'Whether the job has a manual action.' + field :manual_variables, ManualVariableType.connection_type, null: true, + description: 'Variables added to a manual job when the job is triggered.' field :playable, GraphQL::Types::Boolean, null: false, method: :playable?, - description: 'Indicates the job can be played.' + description: 'Indicates the job can be played.' field :previous_stage_jobs_or_needs, Types::Ci::JobNeedUnion.connection_type, null: true, - description: 'Jobs that must complete before the job runs. Returns `BuildNeed`, which is the needed jobs if the job uses the `needs` keyword, or the previous stage jobs otherwise.' + description: 'Jobs that must complete before the job runs. Returns `BuildNeed`, which is the needed jobs if the job uses the `needs` keyword, or the previous stage jobs otherwise.' field :ref_name, GraphQL::Types::String, null: true, - description: 'Ref name of the job.' + description: 'Ref name of the job.' field :ref_path, GraphQL::Types::String, null: true, - description: 'Path to the ref.' + description: 'Path to the ref.' field :retried, GraphQL::Types::Boolean, null: true, - description: 'Indicates that the job has been retried.' + description: 'Indicates that the job has been retried.' field :retryable, GraphQL::Types::Boolean, null: false, method: :retryable?, - description: 'Indicates the job can be retried.' + description: 'Indicates the job can be retried.' field :scheduling_type, GraphQL::Types::String, null: true, - description: 'Type of job scheduling. Value is `dag` if the job uses the `needs` keyword, and `stage` otherwise.' + description: 'Type of job scheduling. Value is `dag` if the job uses the `needs` keyword, and `stage` otherwise.' field :short_sha, type: GraphQL::Types::String, null: false, - description: 'Short SHA1 ID of the commit.' + description: 'Short SHA1 ID of the commit.' field :stuck, GraphQL::Types::Boolean, null: false, method: :stuck?, - description: 'Indicates the job is stuck.' + description: 'Indicates the job is stuck.' field :triggered, GraphQL::Types::Boolean, null: true, - description: 'Whether the job was triggered.' + description: 'Whether the job was triggered.' def kind return ::Ci::Build unless [::Ci::Build, ::Ci::Bridge].include?(object.class) @@ -194,7 +194,7 @@ module Types end def manual_variables - if object.manual? && object.respond_to?(:job_variables) + if object.action? && object.respond_to?(:job_variables) object.job_variables else [] diff --git a/app/graphql/types/ci/manual_variable_type.rb b/app/graphql/types/ci/manual_variable_type.rb new file mode 100644 index 00000000000..d6f59c1d249 --- /dev/null +++ b/app/graphql/types/ci/manual_variable_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Types + module Ci + # rubocop: disable Graphql/AuthorizeTypes + class ManualVariableType < BaseObject + graphql_name 'CiManualVariable' + description 'CI/CD variables given to a manual job.' + + implements(VariableInterface) + + field :environment_scope, GraphQL::Types::String, + null: true, + deprecated: { + reason: 'No longer used, only available for GroupVariableType and ProjectVariableType', + milestone: '15.3' + }, + description: 'Scope defining the environments that can use the variable.' + + def environment_scope + nil + end + end + end +end diff --git a/app/graphql/types/ci/pipeline_message_type.rb b/app/graphql/types/ci/pipeline_message_type.rb index 7edea1901a1..35164b0894a 100644 --- a/app/graphql/types/ci/pipeline_message_type.rb +++ b/app/graphql/types/ci/pipeline_message_type.rb @@ -7,10 +7,10 @@ module Types graphql_name 'PipelineMessage' field :id, GraphQL::Types::ID, null: false, - description: 'ID of the pipeline message.' + description: 'ID of the pipeline message.' field :content, GraphQL::Types::String, null: false, - description: 'Content of the pipeline message.' + description: 'Content of the pipeline message.' end end end diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index 60418fec6c5..4a523f2edd9 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -13,14 +13,14 @@ module Types expose_permissions Types::PermissionTypes::Ci::Pipeline field :id, GraphQL::Types::ID, null: false, - description: 'ID of the pipeline.' + description: 'ID of the pipeline.' field :iid, GraphQL::Types::String, null: false, - description: 'Internal ID of the pipeline.' + description: 'Internal ID of the pipeline.' field :sha, GraphQL::Types::String, null: true, - method: :sha, - description: "SHA of the pipeline's commit." do + method: :sha, + description: "SHA of the pipeline's commit." do argument :format, type: Types::ShaFormatEnum, required: false, @@ -28,46 +28,46 @@ module Types end field :before_sha, GraphQL::Types::String, null: true, - description: 'Base SHA of the source branch.' + description: 'Base SHA of the source branch.' field :complete, GraphQL::Types::Boolean, null: false, method: :complete?, - description: 'Indicates if a pipeline is complete.' + description: 'Indicates if a pipeline is complete.' field :status, PipelineStatusEnum, null: false, - description: "Status of the pipeline (#{::Ci::Pipeline.all_state_names.compact.join(', ').upcase})" + description: "Status of the pipeline (#{::Ci::Pipeline.all_state_names.compact.join(', ').upcase})" field :warnings, GraphQL::Types::Boolean, null: false, method: :has_warnings?, - description: "Indicates if a pipeline has warnings." + description: "Indicates if a pipeline has warnings." field :detailed_status, Types::Ci::DetailedStatusType, null: false, - description: 'Detailed status of the pipeline.' + description: 'Detailed status of the pipeline.' field :config_source, PipelineConfigSourceEnum, null: true, - description: "Configuration source of the pipeline (#{::Enums::Ci::Pipeline.config_sources.keys.join(', ').upcase})" + description: "Configuration source of the pipeline (#{::Enums::Ci::Pipeline.config_sources.keys.join(', ').upcase})" field :duration, GraphQL::Types::Int, null: true, - description: 'Duration of the pipeline in seconds.' + description: 'Duration of the pipeline in seconds.' field :queued_duration, Types::DurationType, null: true, - description: 'How long the pipeline was queued before starting.' + description: 'How long the pipeline was queued before starting.' field :coverage, GraphQL::Types::Float, null: true, - description: 'Coverage percentage.' + description: 'Coverage percentage.' field :created_at, Types::TimeType, null: false, - description: "Timestamp of the pipeline's creation." + description: "Timestamp of the pipeline's creation." field :updated_at, Types::TimeType, null: false, - description: "Timestamp of the pipeline's last activity." + description: "Timestamp of the pipeline's last activity." field :started_at, Types::TimeType, null: true, - description: 'Timestamp when the pipeline was started.' + description: 'Timestamp when the pipeline was started.' field :finished_at, Types::TimeType, null: true, - description: "Timestamp of the pipeline's completion." + description: "Timestamp of the pipeline's completion." field :committed_at, Types::TimeType, null: true, - description: "Timestamp of the pipeline's commit." + description: "Timestamp of the pipeline's commit." field :stages, type: Types::Ci::StageType.connection_type, @@ -126,32 +126,32 @@ module Types description: 'Job where pipeline was triggered from.' field :downstream, Types::Ci::PipelineType.connection_type, null: true, - description: 'Pipelines this pipeline will trigger.', - method: :triggered_pipelines_with_preloads + description: 'Pipelines this pipeline will trigger.', + method: :triggered_pipelines_with_preloads field :upstream, Types::Ci::PipelineType, null: true, - description: 'Pipeline that triggered the pipeline.', - method: :triggered_by_pipeline + description: 'Pipeline that triggered the pipeline.', + method: :triggered_by_pipeline field :path, GraphQL::Types::String, null: true, - description: "Relative path to the pipeline's page." + description: "Relative path to the pipeline's page." field :commit, Types::CommitType, null: true, - description: "Git commit of the pipeline.", - calls_gitaly: true + description: "Git commit of the pipeline.", + calls_gitaly: true field :commit_path, GraphQL::Types::String, null: true, - description: 'Path to the commit that triggered the pipeline.' + description: 'Path to the commit that triggered the pipeline.' field :project, Types::ProjectType, null: true, - description: 'Project the pipeline belongs to.' + description: 'Project the pipeline belongs to.' field :active, GraphQL::Types::Boolean, null: false, method: :active?, - description: 'Indicates if the pipeline is active.' + description: 'Indicates if the pipeline is active.' field :uses_needs, GraphQL::Types::Boolean, null: true, - method: :uses_needs?, - description: 'Indicates if the pipeline has jobs with `needs` dependencies.' + method: :uses_needs?, + description: 'Indicates if the pipeline has jobs with `needs` dependencies.' field :test_report_summary, Types::Ci::TestReportSummaryType, @@ -166,17 +166,17 @@ module Types resolver: Resolvers::Ci::TestSuiteResolver field :ref, GraphQL::Types::String, null: true, - description: 'Reference to the branch from which the pipeline was triggered.' + description: 'Reference to the branch from which the pipeline was triggered.' field :ref_path, GraphQL::Types::String, null: true, - description: 'Reference path to the branch from which the pipeline was triggered.', - method: :source_ref_path + description: 'Reference path to the branch from which the pipeline was triggered.', + method: :source_ref_path field :warning_messages, [Types::Ci::PipelineMessageType], null: true, - description: 'Pipeline warning messages.' + description: 'Pipeline warning messages.' field :merge_request_event_type, Types::Ci::PipelineMergeRequestEventTypeEnum, null: true, - description: "Event type of the pipeline associated with a merge request." + description: "Event type of the pipeline associated with a merge request." def detailed_status object.detailed_status(current_user) @@ -200,7 +200,7 @@ module Types if id pipeline.statuses.id_in(id.model_id) else - pipeline.statuses.by_name(name) + pipeline.latest_statuses.by_name(name) end.take # rubocop: disable CodeReuse/ActiveRecord end diff --git a/app/graphql/types/ci/project_variable_type.rb b/app/graphql/types/ci/project_variable_type.rb new file mode 100644 index 00000000000..625bb7fd4b1 --- /dev/null +++ b/app/graphql/types/ci/project_variable_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Types + module Ci + # rubocop: disable Graphql/AuthorizeTypes + class ProjectVariableType < BaseObject + graphql_name 'CiProjectVariable' + description 'CI/CD variables for a project.' + + implements(VariableInterface) + + field :environment_scope, GraphQL::Types::String, + null: true, + description: 'Scope defining the environments that can use the variable.' + + field :protected, GraphQL::Types::Boolean, + null: true, + description: 'Indicates whether the variable is protected.' + + field :masked, GraphQL::Types::Boolean, + null: true, + description: 'Indicates whether the variable is masked.' + end + end +end diff --git a/app/graphql/types/ci/recent_failures_type.rb b/app/graphql/types/ci/recent_failures_type.rb index f56b0939086..0892cb2735c 100644 --- a/app/graphql/types/ci/recent_failures_type.rb +++ b/app/graphql/types/ci/recent_failures_type.rb @@ -10,10 +10,10 @@ module Types connection_type_class(Types::CountableConnectionType) field :count, GraphQL::Types::Int, null: true, - description: 'Number of times the test case has failed in the past 14 days.' + description: 'Number of times the test case has failed in the past 14 days.' field :base_branch, GraphQL::Types::String, null: true, - description: 'Name of the base branch of the project.' + description: 'Name of the base branch of the project.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/ci/runner_architecture_type.rb b/app/graphql/types/ci/runner_architecture_type.rb index eb576cf09ce..8b0558fc6a6 100644 --- a/app/graphql/types/ci/runner_architecture_type.rb +++ b/app/graphql/types/ci/runner_architecture_type.rb @@ -6,10 +6,12 @@ module Types class RunnerArchitectureType < BaseObject graphql_name 'RunnerArchitecture' - field :download_location, GraphQL::Types::String, null: false, - description: 'Download location for the runner for the platform architecture.' + field :download_location, + GraphQL::Types::String, + null: false, + description: 'Download location for the runner for the platform architecture.' field :name, GraphQL::Types::String, null: false, - description: 'Name of the runner platform architecture.' + description: 'Name of the runner platform architecture.' end end end diff --git a/app/graphql/types/ci/runner_platform_type.rb b/app/graphql/types/ci/runner_platform_type.rb index 3c893615b20..1e481cc08bf 100644 --- a/app/graphql/types/ci/runner_platform_type.rb +++ b/app/graphql/types/ci/runner_platform_type.rb @@ -6,12 +6,14 @@ module Types class RunnerPlatformType < BaseObject graphql_name 'RunnerPlatform' - field :architectures, Types::Ci::RunnerArchitectureType.connection_type, null: true, - description: 'Runner architectures supported for the platform.' + field :architectures, + Types::Ci::RunnerArchitectureType.connection_type, + null: true, + description: 'Runner architectures supported for the platform.' field :human_readable_name, GraphQL::Types::String, null: false, - description: 'Human readable name of the runner platform.' + description: 'Human readable name of the runner platform.' field :name, GraphQL::Types::String, null: false, - description: 'Name slug of the runner platform.' + description: 'Name slug of the runner platform.' end end end diff --git a/app/graphql/types/ci/runner_setup_type.rb b/app/graphql/types/ci/runner_setup_type.rb index b6b020db40e..5328ac8f21f 100644 --- a/app/graphql/types/ci/runner_setup_type.rb +++ b/app/graphql/types/ci/runner_setup_type.rb @@ -7,9 +7,9 @@ module Types graphql_name 'RunnerSetup' field :install_instructions, GraphQL::Types::String, null: false, - description: 'Instructions for installing the runner on the specified architecture.' + description: 'Instructions for installing the runner on the specified architecture.' field :register_instructions, GraphQL::Types::String, null: true, - description: 'Instructions for registering the runner. The actual registration tokens are not included in the commands. Instead, a placeholder `$REGISTRATION_TOKEN` is shown.' + description: 'Instructions for registering the runner. The actual registration tokens are not included in the commands. Instead, a placeholder `$REGISTRATION_TOKEN` is shown.' end end end diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb index ac5ffd39407..0afb61d2b64 100644 --- a/app/graphql/types/ci/runner_type.rb +++ b/app/graphql/types/ci/runner_type.rb @@ -17,77 +17,77 @@ module Types alias_method :runner, :object field :access_level, ::Types::Ci::RunnerAccessLevelEnum, null: false, - description: 'Access level of the runner.' + description: 'Access level of the runner.' field :active, GraphQL::Types::Boolean, null: false, - description: 'Indicates the runner is allowed to receive jobs.', - deprecated: { reason: 'Use paused', milestone: '14.8' } + description: 'Indicates the runner is allowed to receive jobs.', + deprecated: { reason: 'Use paused', milestone: '14.8' } field :admin_url, GraphQL::Types::String, null: true, - description: 'Admin URL of the runner. Only available for administrators.' + description: 'Admin URL of the runner. Only available for administrators.' field :contacted_at, Types::TimeType, null: true, - description: 'Timestamp of last contact from this runner.', - method: :contacted_at + description: 'Timestamp of last contact from this runner.', + method: :contacted_at field :created_at, Types::TimeType, null: true, - description: 'Timestamp of creation of this runner.' + description: 'Timestamp of creation of this runner.' field :description, GraphQL::Types::String, null: true, - description: 'Description of the runner.' + description: 'Description of the runner.' field :edit_admin_url, GraphQL::Types::String, null: true, - description: 'Admin form URL of the runner. Only available for administrators.' + description: 'Admin form URL of the runner. Only available for administrators.' field :executor_name, GraphQL::Types::String, null: true, - description: 'Executor last advertised by the runner.', - method: :executor_name + description: 'Executor last advertised by the runner.', + method: :executor_name field :platform_name, GraphQL::Types::String, null: true, - description: 'Platform provided by the runner.', - method: :platform + description: 'Platform provided by the runner.', + method: :platform field :architecture_name, GraphQL::Types::String, null: true, - description: 'Architecture provided by the the runner.', - method: :architecture + description: 'Architecture provided by the the runner.', + method: :architecture field :maintenance_note, GraphQL::Types::String, null: true, - description: 'Runner\'s maintenance notes.' + description: 'Runner\'s maintenance notes.' field :groups, ::Types::GroupType.connection_type, null: true, - description: 'Groups the runner is associated with. For group runners only.' + description: 'Groups the runner is associated with. For group runners only.' field :id, ::Types::GlobalIDType[::Ci::Runner], null: false, - description: 'ID of the runner.' + description: 'ID of the runner.' field :ip_address, GraphQL::Types::String, null: true, - description: 'IP address of the runner.' + description: 'IP address of the runner.' field :job_count, GraphQL::Types::Int, null: true, - description: "Number of jobs processed by the runner (limited to #{JOB_COUNT_LIMIT}, plus one to indicate that more items exist)." + description: "Number of jobs processed by the runner (limited to #{JOB_COUNT_LIMIT}, plus one to indicate that more items exist)." field :jobs, ::Types::Ci::JobType.connection_type, null: true, - description: 'Jobs assigned to the runner.', - authorize: :read_builds, - resolver: ::Resolvers::Ci::RunnerJobsResolver + description: 'Jobs assigned to the runner.', + authorize: :read_builds, + resolver: ::Resolvers::Ci::RunnerJobsResolver field :locked, GraphQL::Types::Boolean, null: true, - description: 'Indicates the runner is locked.' + description: 'Indicates the runner is locked.' field :maximum_timeout, GraphQL::Types::Int, null: true, - description: 'Maximum timeout (in seconds) for jobs processed by the runner.' + description: 'Maximum timeout (in seconds) for jobs processed by the runner.' field :paused, GraphQL::Types::Boolean, null: false, - description: 'Indicates the runner is paused and not available to run jobs.' + description: 'Indicates the runner is paused and not available to run jobs.' field :project_count, GraphQL::Types::Int, null: true, - description: 'Number of projects that the runner is associated with.' + description: 'Number of projects that the runner is associated with.' field :projects, ::Types::ProjectType.connection_type, null: true, - description: 'Projects the runner is associated with. For project runners only.' + description: 'Projects the runner is associated with. For project runners only.' field :revision, GraphQL::Types::String, null: true, - description: 'Revision of the runner.' + description: 'Revision of the runner.' field :run_untagged, GraphQL::Types::Boolean, null: false, - description: 'Indicates the runner is able to run untagged jobs.' + description: 'Indicates the runner is able to run untagged jobs.' field :runner_type, ::Types::Ci::RunnerTypeEnum, null: false, - description: 'Type of the runner.' + description: 'Type of the runner.' field :short_sha, GraphQL::Types::String, null: true, - description: %q(First eight characters of the runner's token used to authenticate new job requests. Used as the runner's unique ID.) + description: %q(First eight characters of the runner's token used to authenticate new job requests. Used as the runner's unique ID.) field :status, Types::Ci::RunnerStatusEnum, null: false, description: 'Status of the runner.', resolver: ::Resolvers::Ci::RunnerStatusResolver # TODO: Remove :resolver in %17.0 field :tag_list, [GraphQL::Types::String], null: true, - description: 'Tags associated with the runner.' + description: 'Tags associated with the runner.' field :token_expires_at, Types::TimeType, null: true, - description: 'Runner token expiration time.', - method: :token_expires_at + description: 'Runner token expiration time.', + method: :token_expires_at field :version, GraphQL::Types::String, null: true, - description: 'Version of the runner.' + description: 'Version of the runner.' field :owner_project, ::Types::ProjectType, null: true, - description: 'Project that owns the runner. For project runners only.', - resolver: ::Resolvers::Ci::RunnerOwnerProjectResolver + description: 'Project that owns the runner. For project runners only.', + resolver: ::Resolvers::Ci::RunnerOwnerProjectResolver markdown_field :maintenance_note_html, null: true diff --git a/app/graphql/types/ci/runner_upgrade_status_type_enum.rb b/app/graphql/types/ci/runner_upgrade_status_enum.rb index 8e32eee5e6e..34a931c8f79 100644 --- a/app/graphql/types/ci/runner_upgrade_status_type_enum.rb +++ b/app/graphql/types/ci/runner_upgrade_status_enum.rb @@ -2,8 +2,8 @@ module Types module Ci - class RunnerUpgradeStatusTypeEnum < BaseEnum - graphql_name 'CiRunnerUpgradeStatusType' + class RunnerUpgradeStatusEnum < BaseEnum + graphql_name 'CiRunnerUpgradeStatus' ::Ci::RunnerVersion::STATUS_DESCRIPTIONS.each do |status, description| status_name_src = diff --git a/app/graphql/types/ci/runner_web_url_edge.rb b/app/graphql/types/ci/runner_web_url_edge.rb index 7dfcd1f3510..9255e59267c 100644 --- a/app/graphql/types/ci/runner_web_url_edge.rb +++ b/app/graphql/types/ci/runner_web_url_edge.rb @@ -5,11 +5,11 @@ module Types # rubocop: disable Graphql/AuthorizeTypes class RunnerWebUrlEdge < ::Types::BaseEdge field :edit_url, GraphQL::Types::String, null: true, - description: 'Web URL of the runner edit page. The value depends on where you put this field in the query. You can use it for projects or groups.', - extras: [:parent] + description: 'Web URL of the runner edit page. The value depends on where you put this field in the query. You can use it for projects or groups.', + extras: [:parent] field :web_url, GraphQL::Types::String, null: true, - description: 'Web URL of the runner. The value depends on where you put this field in the query. You can use it for projects or groups.', - extras: [:parent] + description: 'Web URL of the runner. The value depends on where you put this field in the query. You can use it for projects or groups.', + extras: [:parent] def initialize(node, connection) super diff --git a/app/graphql/types/ci/stage_type.rb b/app/graphql/types/ci/stage_type.rb index dcb3092d15a..c0f3d1db57b 100644 --- a/app/graphql/types/ci/stage_type.rb +++ b/app/graphql/types/ci/stage_type.rb @@ -7,16 +7,16 @@ module Types authorize :read_build field :detailed_status, Types::Ci::DetailedStatusType, null: true, - description: 'Detailed status of the stage.' + description: 'Detailed status of the stage.' field :groups, type: Ci::GroupType.connection_type, null: true, - extras: [:lookahead], - description: 'Group of jobs for the stage.' + extras: [:lookahead], + description: 'Group of jobs for the stage.' field :id, GraphQL::Types::ID, null: false, - description: 'ID of the stage.' + description: 'ID of the stage.' field :jobs, Types::Ci::JobType.connection_type, null: true, - description: 'Jobs for the stage.' + description: 'Jobs for the stage.' field :name, type: GraphQL::Types::String, null: true, - description: 'Name of the stage.' + description: 'Name of the stage.' field :status, GraphQL::Types::String, null: true, description: 'Status of the pipeline stage.' diff --git a/app/graphql/types/ci/status_action_type.rb b/app/graphql/types/ci/status_action_type.rb index c0f61cf49f2..45773be49e2 100644 --- a/app/graphql/types/ci/status_action_type.rb +++ b/app/graphql/types/ci/status_action_type.rb @@ -6,19 +6,19 @@ module Types graphql_name 'StatusAction' field :button_title, GraphQL::Types::String, null: true, - description: 'Title for the button, for example: Retry this job.' + description: 'Title for the button, for example: Retry this job.' field :icon, GraphQL::Types::String, null: true, - description: 'Icon used in the action button.' + description: 'Icon used in the action button.' field :id, GraphQL::Types::String, null: false, - description: 'ID for a status action.', - extras: [:parent] + description: 'ID for a status action.', + extras: [:parent] field :method, GraphQL::Types::String, null: true, - description: 'Method for the action, for example: :post.', - resolver_method: :action_method + description: 'Method for the action, for example: :post.', + resolver_method: :action_method field :path, GraphQL::Types::String, null: true, - description: 'Path for the action.' + description: 'Path for the action.' field :title, GraphQL::Types::String, null: true, - description: 'Title for the action, for example: Retry.' + description: 'Title for the action, for example: Retry.' def id(parent:) # parent is a SimpleDelegator diff --git a/app/graphql/types/ci/template_type.rb b/app/graphql/types/ci/template_type.rb index 4f1ec6436de..91e10c619c8 100644 --- a/app/graphql/types/ci/template_type.rb +++ b/app/graphql/types/ci/template_type.rb @@ -8,9 +8,9 @@ module Types description 'GitLab CI/CD configuration template.' field :content, GraphQL::Types::String, null: false, - description: 'Contents of the CI template.' + description: 'Contents of the CI template.' field :name, GraphQL::Types::String, null: false, - description: 'Name of the CI template.' + description: 'Name of the CI template.' end end end diff --git a/app/graphql/types/ci/test_case_type.rb b/app/graphql/types/ci/test_case_type.rb index 6e5f55aa3ed..f88923215eb 100644 --- a/app/graphql/types/ci/test_case_type.rb +++ b/app/graphql/types/ci/test_case_type.rb @@ -9,32 +9,36 @@ module Types connection_type_class(Types::CountableConnectionType) - field :status, Types::Ci::TestCaseStatusEnum, null: true, - description: "Status of the test case (#{::Gitlab::Ci::Reports::TestCase::STATUS_TYPES.join(', ')})." + field :status, + Types::Ci::TestCaseStatusEnum, + null: true, + description: "Status of the test case (#{::Gitlab::Ci::Reports::TestCase::STATUS_TYPES.join(', ')})." field :name, GraphQL::Types::String, null: true, - description: 'Name of the test case.' + description: 'Name of the test case.' field :classname, GraphQL::Types::String, null: true, - description: 'Classname of the test case.' + description: 'Classname of the test case.' field :execution_time, GraphQL::Types::Float, null: true, - description: 'Test case execution time in seconds.' + description: 'Test case execution time in seconds.' field :file, GraphQL::Types::String, null: true, - description: 'Path to the file of the test case.' + description: 'Path to the file of the test case.' field :attachment_url, GraphQL::Types::String, null: true, - description: 'URL of the test case attachment file.' + description: 'URL of the test case attachment file.' field :system_output, GraphQL::Types::String, null: true, - description: 'System output of the test case.' + description: 'System output of the test case.' field :stack_trace, GraphQL::Types::String, null: true, - description: 'Stack trace of the test case.' + description: 'Stack trace of the test case.' - field :recent_failures, Types::Ci::RecentFailuresType, null: true, - description: 'Recent failure history of the test case on the base branch.' + field :recent_failures, + Types::Ci::RecentFailuresType, + null: true, + description: 'Recent failure history of the test case on the base branch.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/ci/test_report_summary_type.rb b/app/graphql/types/ci/test_report_summary_type.rb index 87207c8a765..e3577f4fa8f 100644 --- a/app/graphql/types/ci/test_report_summary_type.rb +++ b/app/graphql/types/ci/test_report_summary_type.rb @@ -9,10 +9,12 @@ module Types description 'Test report for a pipeline' field :total, Types::Ci::TestReportTotalType, null: false, - description: 'Total report statistics for a pipeline test report.' + description: 'Total report statistics for a pipeline test report.' - field :test_suites, Types::Ci::TestSuiteSummaryType.connection_type, null: false, - description: 'Test suites belonging to a pipeline test report.' + field :test_suites, + Types::Ci::TestSuiteSummaryType.connection_type, + null: false, + description: 'Test suites belonging to a pipeline test report.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/ci/test_report_total_type.rb b/app/graphql/types/ci/test_report_total_type.rb index 48aea1257c5..54959d5173f 100644 --- a/app/graphql/types/ci/test_report_total_type.rb +++ b/app/graphql/types/ci/test_report_total_type.rb @@ -8,25 +8,25 @@ module Types description 'Total test report statistics.' field :time, GraphQL::Types::Float, null: true, - description: 'Total duration of the tests.' + description: 'Total duration of the tests.' field :count, GraphQL::Types::Int, null: true, - description: 'Total number of the test cases.' + description: 'Total number of the test cases.' field :success, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that succeeded.' + description: 'Total number of test cases that succeeded.' field :failed, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that failed.' + description: 'Total number of test cases that failed.' field :skipped, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that were skipped.' + description: 'Total number of test cases that were skipped.' field :error, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that had an error.' + description: 'Total number of test cases that had an error.' field :suite_error, GraphQL::Types::String, null: true, - description: 'Test suite error message.' + description: 'Test suite error message.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/ci/test_suite_summary_type.rb b/app/graphql/types/ci/test_suite_summary_type.rb index ec7b852213b..8801501c8d4 100644 --- a/app/graphql/types/ci/test_suite_summary_type.rb +++ b/app/graphql/types/ci/test_suite_summary_type.rb @@ -10,31 +10,37 @@ module Types connection_type_class(Types::CountableConnectionType) field :name, GraphQL::Types::String, null: true, - description: 'Name of the test suite.' + description: 'Name of the test suite.' field :total_time, GraphQL::Types::Float, null: true, - description: 'Total duration of the tests in the test suite.' + description: 'Total duration of the tests in the test suite.' field :total_count, GraphQL::Types::Int, null: true, - description: 'Total number of the test cases in the test suite.' + description: 'Total number of the test cases in the test suite.' - field :success_count, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that succeeded in the test suite.' + field :success_count, + GraphQL::Types::Int, + null: true, + description: 'Total number of test cases that succeeded in the test suite.' - field :failed_count, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that failed in the test suite.' + field :failed_count, + GraphQL::Types::Int, + null: true, + description: 'Total number of test cases that failed in the test suite.' - field :skipped_count, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that were skipped in the test suite.' + field :skipped_count, + GraphQL::Types::Int, + null: true, + description: 'Total number of test cases that were skipped in the test suite.' field :error_count, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that had an error.' + description: 'Total number of test cases that had an error.' field :suite_error, GraphQL::Types::String, null: true, - description: 'Test suite error message.' + description: 'Test suite error message.' field :build_ids, [GraphQL::Types::ID], null: true, - description: 'IDs of the builds used to run the test suite.' + description: 'IDs of the builds used to run the test suite.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/ci/test_suite_type.rb b/app/graphql/types/ci/test_suite_type.rb index 7ce479632cc..8845338ed6d 100644 --- a/app/graphql/types/ci/test_suite_type.rb +++ b/app/graphql/types/ci/test_suite_type.rb @@ -10,31 +10,36 @@ module Types connection_type_class(Types::CountableConnectionType) field :name, GraphQL::Types::String, null: true, - description: 'Name of the test suite.' + description: 'Name of the test suite.' field :total_time, GraphQL::Types::Float, null: true, - description: 'Total duration of the tests in the test suite.' + description: 'Total duration of the tests in the test suite.' field :total_count, GraphQL::Types::Int, null: true, - description: 'Total number of the test cases in the test suite.' + description: 'Total number of the test cases in the test suite.' - field :success_count, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that succeeded in the test suite.' + field :success_count, + GraphQL::Types::Int, + null: true, + description: 'Total number of test cases that succeeded in the test suite.' - field :failed_count, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that failed in the test suite.' + field :failed_count, + GraphQL::Types::Int, + null: true, + description: 'Total number of test cases that failed in the test suite.' - field :skipped_count, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that were skipped in the test suite.' + field :skipped_count, + GraphQL::Types::Int, null: true, + description: 'Total number of test cases that were skipped in the test suite.' field :error_count, GraphQL::Types::Int, null: true, - description: 'Total number of test cases that had an error.' + description: 'Total number of test cases that had an error.' field :suite_error, GraphQL::Types::String, null: true, - description: 'Test suite error message.' + description: 'Test suite error message.' field :test_cases, Types::Ci::TestCaseType.connection_type, null: true, - description: 'Test cases in the test suite.' + description: 'Test cases in the test suite.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/ci/variable_input_type.rb b/app/graphql/types/ci/variable_input_type.rb new file mode 100644 index 00000000000..193ca6ffe4e --- /dev/null +++ b/app/graphql/types/ci/variable_input_type.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Types + module Ci + class VariableInputType < BaseInputObject + graphql_name 'CiVariableInput' + description 'Attributes for defining a CI/CD variable.' + + argument :key, GraphQL::Types::String, description: 'Name of the variable.' + argument :value, GraphQL::Types::String, description: 'Value of the variable.' + end + end +end diff --git a/app/graphql/types/ci/variable_interface.rb b/app/graphql/types/ci/variable_interface.rb new file mode 100644 index 00000000000..82c9ba7121c --- /dev/null +++ b/app/graphql/types/ci/variable_interface.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Types + module Ci + module VariableInterface + include Types::BaseInterface + + graphql_name 'CiVariable' + + field :id, GraphQL::Types::ID, + null: false, + description: 'ID of the variable.' + + field :key, GraphQL::Types::String, + null: true, + description: 'Name of the variable.' + + field :value, GraphQL::Types::String, + null: true, + description: 'Value of the variable.' + + field :variable_type, ::Types::Ci::VariableTypeEnum, + null: true, + description: 'Type of the variable.' + + field :raw, GraphQL::Types::Boolean, + null: true, + description: 'Indicates whether the variable is raw.' + end + end +end diff --git a/app/graphql/types/ci/variable_type.rb b/app/graphql/types/ci/variable_type.rb deleted file mode 100644 index 63f89b6d207..00000000000 --- a/app/graphql/types/ci/variable_type.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module Types - module Ci - # rubocop: disable Graphql/AuthorizeTypes - class VariableType < BaseObject - graphql_name 'CiVariable' - - field :id, GraphQL::Types::ID, null: false, - description: 'ID of the variable.' - - field :key, GraphQL::Types::String, null: true, - description: 'Name of the variable.' - - field :value, GraphQL::Types::String, null: true, - description: 'Value of the variable.' - - field :variable_type, ::Types::Ci::VariableTypeEnum, null: true, - description: 'Type of the variable.' - - field :protected, GraphQL::Types::Boolean, null: true, - description: 'Indicates whether the variable is protected.' - - field :masked, GraphQL::Types::Boolean, null: true, - description: 'Indicates whether the variable is masked.' - - field :raw, GraphQL::Types::Boolean, null: true, - description: 'Indicates whether the variable is raw.' - - field :environment_scope, GraphQL::Types::String, null: true, - description: 'Scope defining the environments in which the variable can be used.' - - def environment_scope - if object.respond_to?(:environment_scope) - object.environment_scope - end - end - end - end -end diff --git a/app/graphql/types/ci_configuration/sast/analyzers_entity_input_type.rb b/app/graphql/types/ci_configuration/sast/analyzers_entity_input_type.rb index 68b9a63d8dc..3344693bf46 100644 --- a/app/graphql/types/ci_configuration/sast/analyzers_entity_input_type.rb +++ b/app/graphql/types/ci_configuration/sast/analyzers_entity_input_type.rb @@ -8,10 +8,10 @@ module Types description 'Represents the analyzers entity in SAST CI configuration' argument :name, GraphQL::Types::String, required: true, - description: 'Name of analyzer.' + description: 'Name of analyzer.' argument :enabled, GraphQL::Types::Boolean, required: true, - description: 'State of the analyzer.' + description: 'State of the analyzer.' argument :variables, [::Types::CiConfiguration::Sast::EntityInputType], description: 'List of variables for the analyzer.', diff --git a/app/graphql/types/ci_configuration/sast/analyzers_entity_type.rb b/app/graphql/types/ci_configuration/sast/analyzers_entity_type.rb index 9fdc7c1b000..de160756c8c 100644 --- a/app/graphql/types/ci_configuration/sast/analyzers_entity_type.rb +++ b/app/graphql/types/ci_configuration/sast/analyzers_entity_type.rb @@ -9,19 +9,21 @@ module Types description 'Represents an analyzer entity in SAST CI configuration' field :name, GraphQL::Types::String, null: true, - description: 'Name of the analyzer.' + description: 'Name of the analyzer.' field :label, GraphQL::Types::String, null: true, - description: 'Analyzer label used in the config UI.' + description: 'Analyzer label used in the config UI.' field :enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates whether an analyzer is enabled.' + description: 'Indicates whether an analyzer is enabled.' field :description, GraphQL::Types::String, null: true, - description: 'Analyzer description that is displayed on the form.' + description: 'Analyzer description that is displayed on the form.' - field :variables, ::Types::CiConfiguration::Sast::EntityType.connection_type, null: true, - description: 'List of supported variables.' + field :variables, + ::Types::CiConfiguration::Sast::EntityType.connection_type, + null: true, + description: 'List of supported variables.' end end end diff --git a/app/graphql/types/ci_configuration/sast/entity_input_type.rb b/app/graphql/types/ci_configuration/sast/entity_input_type.rb index f0e3c07d71f..095097fe7b5 100644 --- a/app/graphql/types/ci_configuration/sast/entity_input_type.rb +++ b/app/graphql/types/ci_configuration/sast/entity_input_type.rb @@ -8,13 +8,13 @@ module Types description 'Represents an entity in SAST CI configuration' argument :field, GraphQL::Types::String, required: true, - description: 'CI keyword of entity.' + description: 'CI keyword of entity.' argument :default_value, GraphQL::Types::String, required: true, - description: 'Default value that is used if value is empty.' + description: 'Default value that is used if value is empty.' argument :value, GraphQL::Types::String, required: true, - description: 'Current value of the entity.' + description: 'Current value of the entity.' end end end diff --git a/app/graphql/types/ci_configuration/sast/entity_type.rb b/app/graphql/types/ci_configuration/sast/entity_type.rb index 41b8575d99a..91e80fdd9f8 100644 --- a/app/graphql/types/ci_configuration/sast/entity_type.rb +++ b/app/graphql/types/ci_configuration/sast/entity_type.rb @@ -9,28 +9,30 @@ module Types description 'Represents an entity in SAST CI configuration' field :field, GraphQL::Types::String, null: true, - description: 'CI keyword of entity.' + description: 'CI keyword of entity.' field :label, GraphQL::Types::String, null: true, - description: 'Label for entity used in the form.' + description: 'Label for entity used in the form.' field :type, GraphQL::Types::String, null: true, - description: 'Type of the field value.' + description: 'Type of the field value.' - field :options, ::Types::CiConfiguration::Sast::OptionsEntityType.connection_type, null: true, - description: 'Different possible values of the field.' + field :options, + ::Types::CiConfiguration::Sast::OptionsEntityType.connection_type, + null: true, + description: 'Different possible values of the field.' field :default_value, GraphQL::Types::String, null: true, - description: 'Default value that is used if value is empty.' + description: 'Default value that is used if value is empty.' field :description, GraphQL::Types::String, null: true, - description: 'Entity description that is displayed on the form.' + description: 'Entity description that is displayed on the form.' field :value, GraphQL::Types::String, null: true, - description: 'Current value of the entity.' + description: 'Current value of the entity.' field :size, ::Types::CiConfiguration::Sast::UiComponentSizeEnum, null: true, - description: 'Size of the UI component.' + description: 'Size of the UI component.' end end end diff --git a/app/graphql/types/ci_configuration/sast/options_entity_type.rb b/app/graphql/types/ci_configuration/sast/options_entity_type.rb index 5f365807cfe..2de84adf685 100644 --- a/app/graphql/types/ci_configuration/sast/options_entity_type.rb +++ b/app/graphql/types/ci_configuration/sast/options_entity_type.rb @@ -9,10 +9,10 @@ module Types description 'Represents an entity for options in SAST CI configuration' field :label, GraphQL::Types::String, null: true, - description: 'Label of option entity.' + description: 'Label of option entity.' field :value, GraphQL::Types::String, null: true, - description: 'Value of option entity.' + description: 'Value of option entity.' end end end diff --git a/app/graphql/types/ci_configuration/sast/type.rb b/app/graphql/types/ci_configuration/sast/type.rb index 35d11584ac7..edfdf296929 100644 --- a/app/graphql/types/ci_configuration/sast/type.rb +++ b/app/graphql/types/ci_configuration/sast/type.rb @@ -8,14 +8,20 @@ module Types graphql_name 'SastCiConfiguration' description 'Represents a CI configuration of SAST' - field :global, ::Types::CiConfiguration::Sast::EntityType.connection_type, null: true, - description: 'List of global entities related to SAST configuration.' + field :global, + ::Types::CiConfiguration::Sast::EntityType.connection_type, + null: true, + description: 'List of global entities related to SAST configuration.' - field :pipeline, ::Types::CiConfiguration::Sast::EntityType.connection_type, null: true, - description: 'List of pipeline entities related to SAST configuration.' + field :pipeline, + ::Types::CiConfiguration::Sast::EntityType.connection_type, + null: true, + description: 'List of pipeline entities related to SAST configuration.' - field :analyzers, ::Types::CiConfiguration::Sast::AnalyzersEntityType.connection_type, null: true, - description: 'List of analyzers entities attached to SAST configuration.' + field :analyzers, + ::Types::CiConfiguration::Sast::AnalyzersEntityType.connection_type, + null: true, + description: 'List of analyzers entities attached to SAST configuration.' end end end diff --git a/app/graphql/types/commit_action_type.rb b/app/graphql/types/commit_action_type.rb index 1aa3a4e7ee1..9e808bd3174 100644 --- a/app/graphql/types/commit_action_type.rb +++ b/app/graphql/types/commit_action_type.rb @@ -3,18 +3,18 @@ module Types class CommitActionType < BaseInputObject argument :action, type: Types::CommitActionModeEnum, required: true, - description: 'Action to perform: create, delete, move, update, or chmod.' + description: 'Action to perform: create, delete, move, update, or chmod.' argument :content, type: GraphQL::Types::String, required: false, - description: 'Content of the file.' + description: 'Content of the file.' argument :encoding, type: Types::CommitEncodingEnum, required: false, - description: 'Encoding of the file. Default is text.' + description: 'Encoding of the file. Default is text.' argument :execute_filemode, type: GraphQL::Types::Boolean, required: false, - description: 'Enables/disables the execute flag on the file.' + description: 'Enables/disables the execute flag on the file.' argument :file_path, type: GraphQL::Types::String, required: true, - description: 'Full path to the file.' + description: 'Full path to the file.' argument :last_commit_id, type: GraphQL::Types::String, required: false, - description: 'Last known file commit ID.' + description: 'Last known file commit ID.' argument :previous_path, type: GraphQL::Types::String, required: false, - description: 'Original full path to the file being moved.' + description: 'Original full path to the file being moved.' end end diff --git a/app/graphql/types/commit_type.rb b/app/graphql/types/commit_type.rb index c3a6d6f7faa..dfb02f29fb7 100644 --- a/app/graphql/types/commit_type.rb +++ b/app/graphql/types/commit_type.rb @@ -11,48 +11,48 @@ module Types implements(Types::TodoableInterface) field :id, type: GraphQL::Types::ID, null: false, - description: 'ID (global ID) of the commit.' + description: 'ID (global ID) of the commit.' field :sha, type: GraphQL::Types::String, null: false, - description: 'SHA1 ID of the commit.' + description: 'SHA1 ID of the commit.' field :short_id, type: GraphQL::Types::String, null: false, - description: 'Short SHA1 ID of the commit.' + description: 'Short SHA1 ID of the commit.' field :title, type: GraphQL::Types::String, null: true, calls_gitaly: true, - description: 'Title of the commit message.' + description: 'Title of the commit message.' field :full_title, type: GraphQL::Types::String, null: true, calls_gitaly: true, - description: 'Full title of the commit message.' + description: 'Full title of the commit message.' field :description, type: GraphQL::Types::String, null: true, - description: 'Description of the commit message.' + description: 'Description of the commit message.' field :message, type: GraphQL::Types::String, null: true, - description: 'Raw commit message.' + description: 'Raw commit message.' field :authored_date, type: Types::TimeType, null: true, - description: 'Timestamp of when the commit was authored.' + description: 'Timestamp of when the commit was authored.' field :web_url, type: GraphQL::Types::String, null: false, - description: 'Web URL of the commit.' + description: 'Web URL of the commit.' field :web_path, type: GraphQL::Types::String, null: false, - description: 'Web path of the commit.' + description: 'Web path of the commit.' field :signature_html, type: GraphQL::Types::String, null: true, calls_gitaly: true, - description: 'Rendered HTML of the commit signature.' + description: 'Rendered HTML of the commit signature.' field :author_email, type: GraphQL::Types::String, null: true, - description: "Commit author's email." + description: "Commit author's email." field :author_gravatar, type: GraphQL::Types::String, null: true, - description: 'Commit authors gravatar.' + description: 'Commit authors gravatar.' field :author_name, type: GraphQL::Types::String, null: true, - description: 'Commit authors name.' + description: 'Commit authors name.' # models/commit lazy loads the author by email field :author, type: Types::UserType, null: true, - description: 'Author of the commit.' + description: 'Author of the commit.' field :pipelines, null: true, diff --git a/app/graphql/types/concerns/gitlab_style_deprecations.rb b/app/graphql/types/concerns/gitlab_style_deprecations.rb index cd8e393b235..e404f1fcad9 100644 --- a/app/graphql/types/concerns/gitlab_style_deprecations.rb +++ b/app/graphql/types/concerns/gitlab_style_deprecations.rb @@ -14,7 +14,10 @@ module GitlabStyleDeprecations 'See https://docs.gitlab.com/ee/development/api_graphql_styleguide.html#deprecating-schema-items' end - deprecation = ::Gitlab::Graphql::Deprecation.parse(kwargs.delete(:deprecated)) + # GitLab allows items to be marked as "alpha", which leverages GraphQL deprecations. + deprecation_args = kwargs.extract!(:alpha, :deprecated) + + deprecation = ::Gitlab::Graphql::Deprecation.parse(**deprecation_args) return unless deprecation raise ArgumentError, "Bad deprecation. #{deprecation.errors.full_messages.to_sentence}" unless deprecation.valid? diff --git a/app/graphql/types/countable_connection_type.rb b/app/graphql/types/countable_connection_type.rb index 0f24964daa6..4c216ceceb6 100644 --- a/app/graphql/types/countable_connection_type.rb +++ b/app/graphql/types/countable_connection_type.rb @@ -4,7 +4,7 @@ module Types # rubocop: disable Graphql/AuthorizeTypes class CountableConnectionType < GraphQL::Types::Relay::BaseConnection field :count, GraphQL::Types::Int, null: false, - description: 'Total count of collection.' + description: 'Total count of collection.' def count # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/graphql/types/customer_relations/contact_sort_enum.rb b/app/graphql/types/customer_relations/contact_sort_enum.rb new file mode 100644 index 00000000000..221dedacb6a --- /dev/null +++ b/app/graphql/types/customer_relations/contact_sort_enum.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Types + module CustomerRelations + class ContactSortEnum < SortEnum + graphql_name 'ContactSort' + description 'Values for sorting contacts' + + sortable_fields = ['First name', 'Last name', 'Email', 'Phone', 'Description', 'Organization'] + + sortable_fields.each do |field| + value "#{field.upcase.tr(' ', '_')}_ASC", + value: { field: field.downcase.tr(' ', '_'), direction: :asc }, + description: "#{field} by ascending order." + value "#{field.upcase.tr(' ', '_')}_DESC", + value: { field: field.downcase.tr(' ', '_'), direction: :desc }, + description: "#{field} by descending order." + end + end + end +end diff --git a/app/graphql/types/customer_relations/contact_state_counts_type.rb b/app/graphql/types/customer_relations/contact_state_counts_type.rb new file mode 100644 index 00000000000..96230f8a952 --- /dev/null +++ b/app/graphql/types/customer_relations/contact_state_counts_type.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Types + module CustomerRelations + class ContactStateCountsType < Types::BaseObject + graphql_name 'ContactStateCounts' + description 'Represents the total number of contacts for the represented states.' + + authorize :read_crm_contact + + def self.available_contact_states + @available_contact_states ||= ::CustomerRelations::Contact.states.keys.push('all') + end + + available_contact_states.each do |state| + field state, + GraphQL::Types::Int, + null: true, + description: "Number of contacts with state `#{state.upcase}`" + end + end + end +end diff --git a/app/graphql/types/customer_relations/contact_state_enum.rb b/app/graphql/types/customer_relations/contact_state_enum.rb index 445d2a41401..1e5cae8528f 100644 --- a/app/graphql/types/customer_relations/contact_state_enum.rb +++ b/app/graphql/types/customer_relations/contact_state_enum.rb @@ -5,12 +5,16 @@ module Types class ContactStateEnum < BaseEnum graphql_name 'CustomerRelationsContactState' + value 'all', + description: "All available contacts.", + value: :all + value 'active', - description: "Active contact.", + description: "Active contacts.", value: :active value 'inactive', - description: "Inactive contact.", + description: "Inactive contacts.", value: :inactive end end diff --git a/app/graphql/types/design_management/design_collection_type.rb b/app/graphql/types/design_management/design_collection_type.rb index 91978aa37b0..38864075288 100644 --- a/app/graphql/types/design_management/design_collection_type.rb +++ b/app/graphql/types/design_management/design_collection_type.rb @@ -9,9 +9,9 @@ module Types authorize :read_design field :issue, Types::IssueType, null: false, - description: 'Issue associated with the design collection.' + description: 'Issue associated with the design collection.' field :project, Types::ProjectType, null: false, - description: 'Project associated with the design collection.' + description: 'Project associated with the design collection.' field :designs, Types::DesignManagement::DesignType.connection_type, diff --git a/app/graphql/types/design_management/design_fields.rb b/app/graphql/types/design_management/design_fields.rb index c3a35cfe1ad..f9e9b270a36 100644 --- a/app/graphql/types/design_management/design_fields.rb +++ b/app/graphql/types/design_management/design_fields.rb @@ -13,7 +13,10 @@ module Types field :filename, GraphQL::Types::String, null: false, description: 'Filename of the design.' field :full_path, GraphQL::Types::String, null: false, description: 'Full path to the design file.' field :image, GraphQL::Types::String, null: false, extras: [:parent], description: 'URL of the full-sized image.' - field :image_v432x230, GraphQL::Types::String, null: true, extras: [:parent], + field :image_v432x230, + GraphQL::Types::String, + null: true, + extras: [:parent], description: 'The URL of the design resized to fit within the bounds of 432x230. ' \ 'This will be `null` if the image has not been generated' field :diff_refs, Types::DiffRefsType, diff --git a/app/graphql/types/design_management/version_type.rb b/app/graphql/types/design_management/version_type.rb index cfd2b887dc3..2cbe50afae6 100644 --- a/app/graphql/types/design_management/version_type.rb +++ b/app/graphql/types/design_management/version_type.rb @@ -12,9 +12,9 @@ module Types authorize :read_design field :id, GraphQL::Types::ID, null: false, - description: 'ID of the design version.' + description: 'ID of the design version.' field :sha, GraphQL::Types::ID, null: false, - description: 'SHA of the design version.' + description: 'SHA of the design version.' field :designs, ::Types::DesignManagement::DesignType.connection_type, @@ -35,7 +35,7 @@ module Types field :author, Types::UserType, null: false, description: 'Author of the version.' field :created_at, Types::TimeType, null: false, - description: 'Timestamp of when the version was created.' + description: 'Timestamp of when the version was created.' end end end diff --git a/app/graphql/types/diff_paths_input_type.rb b/app/graphql/types/diff_paths_input_type.rb index c5c75105fda..94e86285b86 100644 --- a/app/graphql/types/diff_paths_input_type.rb +++ b/app/graphql/types/diff_paths_input_type.rb @@ -3,8 +3,8 @@ module Types class DiffPathsInputType < BaseInputObject argument :new_path, GraphQL::Types::String, required: false, - description: 'Path of the file on the HEAD SHA.' + description: 'Path of the file on the HEAD SHA.' argument :old_path, GraphQL::Types::String, required: false, - description: 'Path of the file on the start SHA.' + description: 'Path of the file on the start SHA.' end end diff --git a/app/graphql/types/diff_refs_type.rb b/app/graphql/types/diff_refs_type.rb index a03d72a4dc2..6caf2eb87e6 100644 --- a/app/graphql/types/diff_refs_type.rb +++ b/app/graphql/types/diff_refs_type.rb @@ -7,11 +7,11 @@ module Types graphql_name 'DiffRefs' field :base_sha, GraphQL::Types::String, null: true, - description: 'Merge base of the branch the comment was made on.' + description: 'Merge base of the branch the comment was made on.' field :head_sha, GraphQL::Types::String, null: false, - description: 'SHA of the HEAD at the time the comment was made.' + description: 'SHA of the HEAD at the time the comment was made.' field :start_sha, GraphQL::Types::String, null: false, - description: 'SHA of the branch being compared against.' + description: 'SHA of the branch being compared against.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/diff_stats_summary_type.rb b/app/graphql/types/diff_stats_summary_type.rb index 95705ddecf3..44b92789408 100644 --- a/app/graphql/types/diff_stats_summary_type.rb +++ b/app/graphql/types/diff_stats_summary_type.rb @@ -9,13 +9,13 @@ module Types description 'Aggregated summary of changes' field :additions, GraphQL::Types::Int, null: false, - description: 'Number of lines added.' + description: 'Number of lines added.' field :changes, GraphQL::Types::Int, null: false, - description: 'Number of lines changed.' + description: 'Number of lines changed.' field :deletions, GraphQL::Types::Int, null: false, - description: 'Number of lines deleted.' + description: 'Number of lines deleted.' field :file_count, GraphQL::Types::Int, null: false, - description: 'Number of files changed.' + description: 'Number of files changed.' def changes object[:additions] + object[:deletions] diff --git a/app/graphql/types/diff_stats_type.rb b/app/graphql/types/diff_stats_type.rb index da366fec8c3..a6b7f8e9084 100644 --- a/app/graphql/types/diff_stats_type.rb +++ b/app/graphql/types/diff_stats_type.rb @@ -9,11 +9,11 @@ module Types description 'Changes to a single file' field :additions, GraphQL::Types::Int, null: false, - description: 'Number of lines added to this file.' + description: 'Number of lines added to this file.' field :deletions, GraphQL::Types::Int, null: false, - description: 'Number of lines deleted from this file.' + description: 'Number of lines deleted from this file.' field :path, GraphQL::Types::String, null: false, - description: 'File path, relative to repository root.' + description: 'File path, relative to repository root.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/environment_type.rb b/app/graphql/types/environment_type.rb index aba83f559fa..2a7076cc3c9 100644 --- a/app/graphql/types/environment_type.rb +++ b/app/graphql/types/environment_type.rb @@ -10,20 +10,20 @@ module Types authorize :read_environment field :name, GraphQL::Types::String, null: false, - description: 'Human-readable name of the environment.' + description: 'Human-readable name of the environment.' field :id, GraphQL::Types::ID, null: false, - description: 'ID of the environment.' + description: 'ID of the environment.' field :state, GraphQL::Types::String, null: false, - description: 'State of the environment, for example: available/stopped.' + description: 'State of the environment, for example: available/stopped.' field :path, GraphQL::Types::String, null: false, - description: 'Path to the environment.' + description: 'Path to the environment.' field :metrics_dashboard, Types::Metrics::DashboardType, null: true, - description: 'Metrics dashboard schema for the environment.', - resolver: Resolvers::Metrics::DashboardResolver + description: 'Metrics dashboard schema for the environment.', + resolver: Resolvers::Metrics::DashboardResolver field :latest_opened_most_severe_alert, Types::AlertManagement::AlertType, diff --git a/app/graphql/types/evidence_type.rb b/app/graphql/types/evidence_type.rb index ed644a4b2c6..0d73a935e50 100644 --- a/app/graphql/types/evidence_type.rb +++ b/app/graphql/types/evidence_type.rb @@ -10,12 +10,12 @@ module Types present_using Releases::EvidencePresenter field :collected_at, Types::TimeType, null: true, - description: 'Timestamp when the evidence was collected.' + description: 'Timestamp when the evidence was collected.' field :filepath, GraphQL::Types::String, null: true, - description: 'URL from where the evidence can be downloaded.' + description: 'URL from where the evidence can be downloaded.' field :id, GraphQL::Types::ID, null: false, - description: 'ID of the evidence.' + description: 'ID of the evidence.' field :sha, GraphQL::Types::String, null: true, - description: 'SHA1 ID of the evidence hash.' + description: 'SHA1 ID of the evidence hash.' end end diff --git a/app/graphql/types/global_id_type.rb b/app/graphql/types/global_id_type.rb index 145a5a22460..a71c2fb0e6c 100644 --- a/app/graphql/types/global_id_type.rb +++ b/app/graphql/types/global_id_type.rb @@ -50,7 +50,7 @@ module Types #{ if deprecation = Gitlab::GlobalId::Deprecations.deprecation_by(model_name) 'The older format `"' + - ::Gitlab::GlobalId.build(model_name: deprecation.old_model_name, id: 1).to_s + + ::Gitlab::GlobalId.build(model_name: deprecation.old_name, id: 1).to_s + '"` was deprecated in ' + deprecation.milestone + '.' end} diff --git a/app/graphql/types/grafana_integration_type.rb b/app/graphql/types/grafana_integration_type.rb index 2bbc0d34db6..982ba803603 100644 --- a/app/graphql/types/grafana_integration_type.rb +++ b/app/graphql/types/grafana_integration_type.rb @@ -7,14 +7,14 @@ module Types authorize :admin_operations field :created_at, Types::TimeType, null: false, - description: 'Timestamp of the issue\'s creation.' + description: 'Timestamp of the issue\'s creation.' field :enabled, GraphQL::Types::Boolean, null: false, - description: 'Indicates whether Grafana integration is enabled.' + description: 'Indicates whether Grafana integration is enabled.' field :grafana_url, GraphQL::Types::String, null: false, - description: 'URL for the Grafana host for the Grafana integration.' + description: 'URL for the Grafana host for the Grafana integration.' field :id, GraphQL::Types::ID, null: false, - description: 'Internal ID of the Grafana integration.' + description: 'Internal ID of the Grafana integration.' field :updated_at, Types::TimeType, null: false, - description: 'Timestamp of the issue\'s last activity.' + description: 'Timestamp of the issue\'s last activity.' end end diff --git a/app/graphql/types/group_invitation_type.rb b/app/graphql/types/group_invitation_type.rb index 48281dcfd9f..2b874e23c64 100644 --- a/app/graphql/types/group_invitation_type.rb +++ b/app/graphql/types/group_invitation_type.rb @@ -11,7 +11,7 @@ module Types implements InvitationInterface field :group, Types::GroupType, null: true, - description: 'Group that a User is invited to.' + description: 'Group that a User is invited to.' def group Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, object.source_id).find diff --git a/app/graphql/types/group_member_type.rb b/app/graphql/types/group_member_type.rb index c4582f31bec..2745853c9bb 100644 --- a/app/graphql/types/group_member_type.rb +++ b/app/graphql/types/group_member_type.rb @@ -11,7 +11,7 @@ module Types implements MemberInterface field :group, Types::GroupType, null: true, - description: 'Group that a User is a member of.' + description: 'Group that a User is a member of.' field :notification_email, resolver: Resolvers::GroupMembers::NotificationEmailResolver, diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb index 52e9f808066..235a2bc2a34 100644 --- a/app/graphql/types/group_type.rb +++ b/app/graphql/types/group_type.rb @@ -22,7 +22,7 @@ module Types type: Types::CustomEmojiType.connection_type, null: true, description: 'Custom emoji within this namespace.', - feature_flag: :custom_emoji + _deprecated_feature_flag: :custom_emoji field :share_with_group_lock, type: GraphQL::Types::Boolean, @@ -85,6 +85,7 @@ module Types field :milestones, description: 'Milestones of the group.', + extras: [:lookahead], resolver: Resolvers::GroupMilestonesResolver field :boards, @@ -183,10 +184,10 @@ module Types resolver: Resolvers::GroupLabelsResolver field :timelogs, ::Types::TimelogType.connection_type, null: false, - description: 'Time logged on issues and merge requests in the group and its subgroups.', - extras: [:lookahead], - complexity: 5, - resolver: ::Resolvers::TimelogResolver + description: 'Time logged on issues and merge requests in the group and its subgroups.', + extras: [:lookahead], + complexity: 5, + resolver: ::Resolvers::TimelogResolver field :descendant_groups, Types::GroupType.connection_type, null: true, @@ -195,7 +196,7 @@ module Types resolver: Resolvers::GroupsResolver field :ci_variables, - Types::Ci::VariableType.connection_type, + Types::Ci::GroupVariableType.connection_type, null: true, description: "List of the group's CI/CD variables.", authorize: :admin_group, @@ -216,6 +217,12 @@ module Types description: "Find contacts of this group.", resolver: Resolvers::Crm::ContactsResolver + field :contact_state_counts, + Types::CustomerRelations::ContactStateCountsType, + null: true, + description: 'Counts of contacts by state for the group.', + resolver: Resolvers::Crm::ContactStateCountsResolver + field :work_item_types, Types::WorkItems::TypeType.connection_type, resolver: Resolvers::WorkItems::TypesResolver, description: 'Work item types available to the group.' \ diff --git a/app/graphql/types/invitation_interface.rb b/app/graphql/types/invitation_interface.rb index 1f0746d7726..bbecf5b5f54 100644 --- a/app/graphql/types/invitation_interface.rb +++ b/app/graphql/types/invitation_interface.rb @@ -5,25 +5,25 @@ module Types include BaseInterface field :email, GraphQL::Types::String, null: false, - description: 'Email of the member to invite.' + description: 'Email of the member to invite.' field :access_level, Types::AccessLevelType, null: true, - description: 'GitLab::Access level.' + description: 'GitLab::Access level.' field :created_by, Types::UserType, null: true, - description: 'User that authorized membership.' + description: 'User that authorized membership.' field :created_at, Types::TimeType, null: true, - description: 'Date and time the membership was created.' + description: 'Date and time the membership was created.' field :updated_at, Types::TimeType, null: true, - description: 'Date and time the membership was last updated.' + description: 'Date and time the membership was last updated.' field :expires_at, Types::TimeType, null: true, - description: 'Date and time the membership expires.' + description: 'Date and time the membership expires.' field :user, Types::UserType, null: true, - description: 'User that is associated with the member object.' + description: 'User that is associated with the member object.' definition_methods do def resolve_type(object, context) diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 58729b34fc7..d897f3cde48 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -17,101 +17,101 @@ module Types present_using IssuePresenter field :description, GraphQL::Types::String, null: true, - description: 'Description of the issue.' + description: 'Description of the issue.' field :id, GraphQL::Types::ID, null: false, - description: "ID of the issue." + description: "ID of the issue." field :iid, GraphQL::Types::ID, null: false, - description: "Internal ID of the issue." + description: "Internal ID of the issue." field :state, IssueStateEnum, null: false, - description: 'State of the issue.' + description: 'State of the issue.' field :title, GraphQL::Types::String, null: false, - description: 'Title of the issue.' + description: 'Title of the issue.' field :reference, GraphQL::Types::String, null: false, - description: 'Internal reference of the issue. Returned in shortened format by default.', - method: :to_reference do + description: 'Internal reference of the issue. Returned in shortened format by default.', + method: :to_reference do argument :full, GraphQL::Types::Boolean, required: false, default_value: false, - description: 'Boolean option specifying whether the reference should be returned in full.' + description: 'Boolean option specifying whether the reference should be returned in full.' end field :author, Types::UserType, null: false, - description: 'User that created the issue.' + description: 'User that created the issue.' field :assignees, Types::UserType.connection_type, null: true, - description: 'Assignees of the issue.' + description: 'Assignees of the issue.' field :updated_by, Types::UserType, null: true, - description: 'User that last updated the issue.' + description: 'User that last updated the issue.' field :labels, Types::LabelType.connection_type, null: true, - description: 'Labels of the issue.' + description: 'Labels of the issue.' field :milestone, Types::MilestoneType, null: true, - description: 'Milestone of the issue.' + description: 'Milestone of the issue.' field :confidential, GraphQL::Types::Boolean, null: false, - description: 'Indicates the issue is confidential.' + description: 'Indicates the issue is confidential.' field :discussion_locked, GraphQL::Types::Boolean, null: false, - description: 'Indicates discussion is locked on the issue.' + description: 'Indicates discussion is locked on the issue.' field :due_date, Types::TimeType, null: true, - description: 'Due date of the issue.' + description: 'Due date of the issue.' field :hidden, GraphQL::Types::Boolean, null: true, resolver_method: :hidden?, - description: 'Indicates the issue is hidden because the author has been banned. ' \ + description: 'Indicates the issue is hidden because the author has been banned. ' \ 'Will always return `null` if `ban_user_feature_flag` feature flag is disabled.' field :downvotes, GraphQL::Types::Int, null: false, - description: 'Number of downvotes the issue has received.' + description: 'Number of downvotes the issue has received.' field :merge_requests_count, GraphQL::Types::Int, null: false, - description: 'Number of merge requests that close the issue on merge.', - resolver: Resolvers::MergeRequestsCountResolver + description: 'Number of merge requests that close the issue on merge.', + resolver: Resolvers::MergeRequestsCountResolver field :relative_position, GraphQL::Types::Int, null: true, - description: 'Relative position of the issue (used for positioning in epic tree and issue boards).' + description: 'Relative position of the issue (used for positioning in epic tree and issue boards).' field :upvotes, GraphQL::Types::Int, null: false, - description: 'Number of upvotes the issue has received.' + description: 'Number of upvotes the issue has received.' field :user_discussions_count, GraphQL::Types::Int, null: false, - description: 'Number of user discussions in the issue.', - resolver: Resolvers::UserDiscussionsCountResolver + description: 'Number of user discussions in the issue.', + resolver: Resolvers::UserDiscussionsCountResolver field :user_notes_count, GraphQL::Types::Int, null: false, - description: 'Number of user notes of the issue.', - resolver: Resolvers::UserNotesCountResolver + description: 'Number of user notes of the issue.', + resolver: Resolvers::UserNotesCountResolver field :web_path, GraphQL::Types::String, null: false, method: :issue_path, - description: 'Web path of the issue.' + description: 'Web path of the issue.' field :web_url, GraphQL::Types::String, null: false, - description: 'Web URL of the issue.' + description: 'Web URL of the issue.' field :emails_disabled, GraphQL::Types::Boolean, null: false, - method: :project_emails_disabled?, - description: 'Indicates if a project has email notifications disabled: `true` if email notifications are disabled.' + method: :project_emails_disabled?, + description: 'Indicates if a project has email notifications disabled: `true` if email notifications are disabled.' field :human_time_estimate, GraphQL::Types::String, null: true, - description: 'Human-readable time estimate of the issue.' + description: 'Human-readable time estimate of the issue.' field :human_total_time_spent, GraphQL::Types::String, null: true, - description: 'Human-readable total time reported as spent on the issue.' + description: 'Human-readable total time reported as spent on the issue.' field :participants, Types::UserType.connection_type, null: true, complexity: 5, - description: 'List of participants in the issue.', - resolver: Resolvers::Users::ParticipantsResolver + description: 'List of participants in the issue.', + resolver: Resolvers::Users::ParticipantsResolver field :subscribed, GraphQL::Types::Boolean, method: :subscribed?, null: false, complexity: 5, - description: 'Indicates the currently logged in user is subscribed to the issue.' + description: 'Indicates the currently logged in user is subscribed to the issue.' field :time_estimate, GraphQL::Types::Int, null: false, - description: 'Time estimate of the issue.' + description: 'Time estimate of the issue.' field :total_time_spent, GraphQL::Types::Int, null: false, - description: 'Total time reported as spent on the issue.' + description: 'Total time reported as spent on the issue.' field :closed_at, Types::TimeType, null: true, - description: 'Timestamp of when the issue was closed.' + description: 'Timestamp of when the issue was closed.' field :created_at, Types::TimeType, null: false, - description: 'Timestamp of when the issue was created.' + description: 'Timestamp of when the issue was created.' field :updated_at, Types::TimeType, null: false, - description: 'Timestamp of when the issue was last updated.' + description: 'Timestamp of when the issue was last updated.' field :task_completion_status, Types::TaskCompletionStatus, null: false, - description: 'Task completion status of the issue.' + description: 'Task completion status of the issue.' field :design_collection, Types::DesignManagement::DesignCollectionType, null: true, - description: 'Collection of design images associated with this issue.' + description: 'Collection of design images associated with this issue.' field :type, Types::IssueTypeEnum, null: true, - method: :issue_type, - description: 'Type of the issue.' + method: :issue_type, + description: 'Type of the issue.' field :alert_management_alert, Types::AlertManagement::AlertType, @@ -119,31 +119,31 @@ module Types description: 'Alert associated to this issue.' field :severity, Types::IssuableSeverityEnum, null: true, - description: 'Severity level of the incident.' + description: 'Severity level of the incident.' field :moved, GraphQL::Types::Boolean, method: :moved?, null: true, - description: 'Indicates if issue got moved from other project.' + description: 'Indicates if issue got moved from other project.' field :moved_to, Types::IssueType, null: true, - description: 'Updated Issue after it got moved to another project.' + description: 'Updated Issue after it got moved to another project.' field :closed_as_duplicate_of, Types::IssueType, null: true, - description: 'Issue this issue was closed as a duplicate of.' + description: 'Issue this issue was closed as a duplicate of.' field :create_note_email, GraphQL::Types::String, null: true, - description: 'User specific email address for the issue.' + description: 'User specific email address for the issue.' field :timelogs, Types::TimelogType.connection_type, null: false, - description: 'Timelogs on the issue.' + description: 'Timelogs on the issue.' field :project_id, GraphQL::Types::Int, null: false, method: :project_id, - description: 'ID of the issue project.' + description: 'ID of the issue project.' field :customer_relations_contacts, Types::CustomerRelations::ContactType.connection_type, null: true, - description: 'Customer relations contacts of the issue.' + description: 'Customer relations contacts of the issue.' field :escalation_status, Types::IncidentManagement::EscalationStatusEnum, null: true, - description: 'Escalation status of the issue.' + description: 'Escalation status of the issue.' markdown_field :title_html, null: true markdown_field :description_html, null: true diff --git a/app/graphql/types/issue_type_enum.rb b/app/graphql/types/issue_type_enum.rb index bc21b802179..1044c2ceea4 100644 --- a/app/graphql/types/issue_type_enum.rb +++ b/app/graphql/types/issue_type_enum.rb @@ -11,6 +11,6 @@ module Types value 'TASK', value: 'task', description: 'Task issue type. Available only when feature flag `work_items` is enabled.', - deprecated: { milestone: '15.2', reason: :alpha } + alpha: { milestone: '15.2' } end end diff --git a/app/graphql/types/jira_import_type.rb b/app/graphql/types/jira_import_type.rb index 8477f0b97f0..bcbecff1ad8 100644 --- a/app/graphql/types/jira_import_type.rb +++ b/app/graphql/types/jira_import_type.rb @@ -7,19 +7,19 @@ module Types graphql_name 'JiraImport' field :created_at, Types::TimeType, null: true, - description: 'Timestamp of when the Jira import was created.' + description: 'Timestamp of when the Jira import was created.' field :failed_to_import_count, GraphQL::Types::Int, null: false, - description: 'Count of issues that failed to import.' + description: 'Count of issues that failed to import.' field :imported_issues_count, GraphQL::Types::Int, null: false, - description: 'Count of issues that were successfully imported.' + description: 'Count of issues that were successfully imported.' field :jira_project_key, GraphQL::Types::String, null: false, - description: 'Project key for the imported Jira project.' + description: 'Project key for the imported Jira project.' field :scheduled_at, Types::TimeType, null: true, - description: 'Timestamp of when the Jira import was scheduled.' + description: 'Timestamp of when the Jira import was scheduled.' field :scheduled_by, Types::UserType, null: true, - description: 'User that started the Jira import.' + description: 'User that started the Jira import.' field :total_issue_count, GraphQL::Types::Int, null: false, - description: 'Total count of issues that were attempted to import.' + description: 'Total count of issues that were attempted to import.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/jira_user_type.rb b/app/graphql/types/jira_user_type.rb index aba05385ece..aa070d2c4c9 100644 --- a/app/graphql/types/jira_user_type.rb +++ b/app/graphql/types/jira_user_type.rb @@ -7,16 +7,18 @@ module Types graphql_name 'JiraUser' field :gitlab_id, GraphQL::Types::Int, null: true, - description: 'ID of the matched GitLab user.' + description: 'ID of the matched GitLab user.' field :gitlab_name, GraphQL::Types::String, null: true, - description: 'Name of the matched GitLab user.' + description: 'Name of the matched GitLab user.' field :gitlab_username, GraphQL::Types::String, null: true, - description: 'Username of the matched GitLab user.' + description: 'Username of the matched GitLab user.' field :jira_account_id, GraphQL::Types::String, null: false, - description: 'Account ID of the Jira user.' + description: 'Account ID of the Jira user.' field :jira_display_name, GraphQL::Types::String, null: false, - description: 'Display name of the Jira user.' - field :jira_email, GraphQL::Types::String, null: true, + description: 'Display name of the Jira user.' + field :jira_email, + GraphQL::Types::String, + null: true, description: 'Email of the Jira user, returned only for users with public emails.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/label_type.rb b/app/graphql/types/label_type.rb index b5b3e20bcbc..05b703e60af 100644 --- a/app/graphql/types/label_type.rb +++ b/app/graphql/types/label_type.rb @@ -9,19 +9,21 @@ module Types authorize :read_label field :color, GraphQL::Types::String, null: false, - description: 'Background color of the label.' + description: 'Background color of the label.' field :created_at, Types::TimeType, null: false, - description: 'When this label was created.' - field :description, GraphQL::Types::String, null: true, + description: 'When this label was created.' + field :description, + GraphQL::Types::String, + null: true, description: 'Description of the label (Markdown rendered as HTML for caching).' field :id, GraphQL::Types::ID, null: false, - description: 'Label ID.' + description: 'Label ID.' field :text_color, GraphQL::Types::String, null: false, - description: 'Text color of the label.' + description: 'Text color of the label.' field :title, GraphQL::Types::String, null: false, - description: 'Content of the label.' + description: 'Content of the label.' field :updated_at, Types::TimeType, null: false, - description: 'When this label was last updated.' + description: 'When this label was last updated.' markdown_field :description_html, null: true end diff --git a/app/graphql/types/member_interface.rb b/app/graphql/types/member_interface.rb index 67d0e18b522..edadbcddfb3 100644 --- a/app/graphql/types/member_interface.rb +++ b/app/graphql/types/member_interface.rb @@ -5,25 +5,25 @@ module Types include BaseInterface field :id, GraphQL::Types::ID, null: false, - description: 'ID of the member.' + description: 'ID of the member.' field :access_level, Types::AccessLevelType, null: true, - description: 'GitLab::Access level.' + description: 'GitLab::Access level.' field :created_by, Types::UserType, null: true, - description: 'User that authorized membership.' + description: 'User that authorized membership.' field :created_at, Types::TimeType, null: true, - description: 'Date and time the membership was created.' + description: 'Date and time the membership was created.' field :updated_at, Types::TimeType, null: true, - description: 'Date and time the membership was last updated.' + description: 'Date and time the membership was last updated.' field :expires_at, Types::TimeType, null: true, - description: 'Date and time the membership expires.' + description: 'Date and time the membership expires.' field :user, Types::UserType, null: true, - description: 'User that is associated with the member object.' + description: 'User that is associated with the member object.' field :merge_request_interaction, Types::UserMergeRequestInteractionType, null: true, diff --git a/app/graphql/types/merge_request_connection_type.rb b/app/graphql/types/merge_request_connection_type.rb index 9596c812c69..f77b66954c1 100644 --- a/app/graphql/types/merge_request_connection_type.rb +++ b/app/graphql/types/merge_request_connection_type.rb @@ -3,7 +3,9 @@ module Types # rubocop: disable Graphql/AuthorizeTypes class MergeRequestConnectionType < Types::CountableConnectionType - field :total_time_to_merge, GraphQL::Types::Float, null: true, + field :total_time_to_merge, + GraphQL::Types::Float, + null: true, description: 'Total sum of time to merge, in seconds, for the collection of merge requests.' # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index cc3df474bef..d88653f2f8c 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -17,93 +17,98 @@ module Types present_using MergeRequestPresenter field :created_at, Types::TimeType, null: false, - description: 'Timestamp of when the merge request was created.' + description: 'Timestamp of when the merge request was created.' field :description, GraphQL::Types::String, null: true, - description: 'Description of the merge request (Markdown rendered as HTML for caching).' + description: 'Description of the merge request (Markdown rendered as HTML for caching).' field :diff_head_sha, GraphQL::Types::String, null: true, - description: 'Diff head SHA of the merge request.' + description: 'Diff head SHA of the merge request.' field :diff_refs, Types::DiffRefsType, null: true, - description: 'References of the base SHA, the head SHA, and the start SHA for this merge request.' + description: 'References of the base SHA, the head SHA, and the start SHA for this merge request.' field :diff_stats, [Types::DiffStatsType], null: true, calls_gitaly: true, - description: 'Details about which files were changed in this merge request.' do + description: 'Details about which files were changed in this merge request.' do argument :path, GraphQL::Types::String, required: false, description: 'Specific file path.' end field :draft, GraphQL::Types::Boolean, method: :draft?, null: false, - description: 'Indicates if the merge request is a draft.' + description: 'Indicates if the merge request is a draft.' field :id, GraphQL::Types::ID, null: false, - description: 'ID of the merge request.' + description: 'ID of the merge request.' field :iid, GraphQL::Types::String, null: false, - description: 'Internal ID of the merge request.' + description: 'Internal ID of the merge request.' field :merge_when_pipeline_succeeds, GraphQL::Types::Boolean, null: true, - description: 'Indicates if the merge has been set to be merged when its pipeline succeeds (MWPS).' + description: 'Indicates if the merge has been set to be merged when its pipeline succeeds (MWPS).' field :merged_at, Types::TimeType, null: true, complexity: 5, - description: 'Timestamp of when the merge request was merged, null if not merged.' + description: 'Timestamp of when the merge request was merged, null if not merged.' field :project, Types::ProjectType, null: false, - description: 'Alias for target_project.' + description: 'Alias for target_project.' field :project_id, GraphQL::Types::Int, null: false, method: :target_project_id, - description: 'ID of the merge request project.' + description: 'ID of the merge request project.' field :source_branch, GraphQL::Types::String, null: false, - description: 'Source branch of the merge request.' + description: 'Source branch of the merge request.' field :source_branch_protected, GraphQL::Types::Boolean, null: false, calls_gitaly: true, - description: 'Indicates if the source branch is protected.' + description: 'Indicates if the source branch is protected.' field :source_project, Types::ProjectType, null: true, - description: 'Source project of the merge request.' + description: 'Source project of the merge request.' field :source_project_id, GraphQL::Types::Int, null: true, - description: 'ID of the merge request source project.' + description: 'ID of the merge request source project.' field :state, MergeRequestStateEnum, null: false, - description: 'State of the merge request.' + description: 'State of the merge request.' field :target_branch, GraphQL::Types::String, null: false, - description: 'Target branch of the merge request.' + description: 'Target branch of the merge request.' field :target_project, Types::ProjectType, null: false, - description: 'Target project of the merge request.' + description: 'Target project of the merge request.' field :target_project_id, GraphQL::Types::Int, null: false, - description: 'ID of the merge request target project.' + description: 'ID of the merge request target project.' field :title, GraphQL::Types::String, null: false, - description: 'Title of the merge request.' + description: 'Title of the merge request.' field :updated_at, Types::TimeType, null: false, - description: 'Timestamp of when the merge request was last updated.' + description: 'Timestamp of when the merge request was last updated.' field :allow_collaboration, GraphQL::Types::Boolean, null: true, - description: 'Indicates if members of the target project can push to the fork.' + description: 'Indicates if members of the target project can push to the fork.' field :default_merge_commit_message, GraphQL::Types::String, null: true, calls_gitaly: true, - description: 'Default merge commit message of the merge request.' + description: 'Default merge commit message of the merge request.' field :default_squash_commit_message, GraphQL::Types::String, null: true, calls_gitaly: true, - description: 'Default squash commit message of the merge request.' + description: 'Default squash commit message of the merge request.' field :diff_stats_summary, Types::DiffStatsSummaryType, null: true, calls_gitaly: true, - description: 'Summary of which files were changed in this merge request.' + description: 'Summary of which files were changed in this merge request.' field :diverged_from_target_branch, GraphQL::Types::Boolean, null: false, calls_gitaly: true, method: :diverged_from_target_branch?, description: 'Indicates if the source branch is behind the target branch.' field :downvotes, GraphQL::Types::Int, null: false, - description: 'Number of downvotes for the merge request.' + description: 'Number of downvotes for the merge request.' field :force_remove_source_branch, GraphQL::Types::Boolean, method: :force_remove_source_branch?, null: true, - description: 'Indicates if the project settings will lead to source branch deletion after merge.' + description: 'Indicates if the project settings will lead to source branch deletion after merge.' field :in_progress_merge_commit_sha, GraphQL::Types::String, null: true, - description: 'Commit SHA of the merge request if merge is in progress.' + description: 'Commit SHA of the merge request if merge is in progress.' field :merge_commit_sha, GraphQL::Types::String, null: true, - description: 'SHA of the merge request commit (set once merged).' + description: 'SHA of the merge request commit (set once merged).' field :merge_error, GraphQL::Types::String, null: true, - description: 'Error message due to a merge error.' + description: 'Error message due to a merge error.' field :merge_ongoing, GraphQL::Types::Boolean, method: :merge_ongoing?, null: false, - description: 'Indicates if a merge is currently occurring.' + description: 'Indicates if a merge is currently occurring.' field :merge_status, GraphQL::Types::String, method: :public_merge_status, null: true, - description: 'Status of the merge request.', - deprecated: { reason: :renamed, replacement: 'MergeRequest.mergeStatusEnum', milestone: '14.0' } + description: 'Status of the merge request.', + deprecated: { reason: :renamed, replacement: 'MergeRequest.mergeStatusEnum', milestone: '14.0' } field :merge_status_enum, ::Types::MergeRequests::MergeStatusEnum, method: :public_merge_status, null: true, description: 'Merge status of the merge request.' + + field :detailed_merge_status, ::Types::MergeRequests::DetailedMergeStatusEnum, method: :detailed_merge_status, null: true, + calls_gitaly: true, + description: 'Detailed merge status of the merge request.', alpha: { milestone: '15.3' } + field :mergeable_discussions_state, GraphQL::Types::Boolean, null: true, - calls_gitaly: true, - description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.' + calls_gitaly: true, + description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.' field :rebase_commit_sha, GraphQL::Types::String, null: true, - description: 'Rebase commit SHA of the merge request.' + description: 'Rebase commit SHA of the merge request.' field :rebase_in_progress, GraphQL::Types::Boolean, method: :rebase_in_progress?, null: false, calls_gitaly: true, - description: 'Indicates if there is a rebase currently in progress for the merge request.' + description: 'Indicates if there is a rebase currently in progress for the merge request.' field :should_be_rebased, GraphQL::Types::Boolean, method: :should_be_rebased?, null: false, calls_gitaly: true, - description: 'Indicates if the merge request will be rebased.' + description: 'Indicates if the merge request will be rebased.' field :should_remove_source_branch, GraphQL::Types::Boolean, method: :should_remove_source_branch?, null: true, - description: 'Indicates if the source branch of the merge request will be deleted after merge.' + description: 'Indicates if the source branch of the merge request will be deleted after merge.' field :source_branch_exists, GraphQL::Types::Boolean, null: false, calls_gitaly: true, method: :source_branch_exists?, @@ -113,18 +118,18 @@ module Types method: :target_branch_exists?, description: 'Indicates if the target branch of the merge request exists.' field :upvotes, GraphQL::Types::Int, null: false, - description: 'Number of upvotes for the merge request.' + description: 'Number of upvotes for the merge request.' field :user_discussions_count, GraphQL::Types::Int, null: true, - description: 'Number of user discussions in the merge request.', - resolver: Resolvers::UserDiscussionsCountResolver + description: 'Number of user discussions in the merge request.', + resolver: Resolvers::UserDiscussionsCountResolver field :user_notes_count, GraphQL::Types::Int, null: true, - description: 'User notes count of the merge request.', - resolver: Resolvers::UserNotesCountResolver + description: 'User notes count of the merge request.', + resolver: Resolvers::UserNotesCountResolver field :web_url, GraphQL::Types::String, null: true, - description: 'Web URL of the merge request.' + description: 'Web URL of the merge request.' field :head_pipeline, Types::Ci::PipelineType, null: true, method: :actual_head_pipeline, - description: 'Pipeline running on the branch HEAD of the merge request.' + description: 'Pipeline running on the branch HEAD of the merge request.' field :pipelines, null: true, description: 'Pipelines for the merge request. Note: for performance reasons, no more than the most recent 500 pipelines will be returned.', @@ -136,72 +141,72 @@ module Types complexity: 5, description: 'Assignees of the merge request.' field :author, Types::MergeRequests::AuthorType, null: true, - description: 'User who created this merge request.' + description: 'User who created this merge request.' field :discussion_locked, GraphQL::Types::Boolean, description: 'Indicates if comments on the merge request are locked to members only.', null: false field :human_time_estimate, GraphQL::Types::String, null: true, - description: 'Human-readable time estimate of the merge request.' + description: 'Human-readable time estimate of the merge request.' field :human_total_time_spent, GraphQL::Types::String, null: true, - description: 'Human-readable total time reported as spent on the merge request.' + description: 'Human-readable total time reported as spent on the merge request.' field :labels, Types::LabelType.connection_type, null: true, complexity: 5, - description: 'Labels of the merge request.' + description: 'Labels of the merge request.' field :milestone, Types::MilestoneType, null: true, - description: 'Milestone of the merge request.' + description: 'Milestone of the merge request.' field :participants, Types::MergeRequests::ParticipantType.connection_type, null: true, complexity: 15, - description: 'Participants in the merge request. This includes the author, assignees, reviewers, and users mentioned in notes.', - resolver: Resolvers::Users::ParticipantsResolver + description: 'Participants in the merge request. This includes the author, assignees, reviewers, and users mentioned in notes.', + resolver: Resolvers::Users::ParticipantsResolver field :reference, GraphQL::Types::String, null: false, method: :to_reference, - description: 'Internal reference of the merge request. Returned in shortened format by default.' do + description: 'Internal reference of the merge request. Returned in shortened format by default.' do argument :full, GraphQL::Types::Boolean, required: false, default_value: false, - description: 'Boolean option specifying whether the reference should be returned in full.' + description: 'Boolean option specifying whether the reference should be returned in full.' end field :auto_merge_enabled, GraphQL::Types::Boolean, null: false, - description: 'Indicates if auto merge is enabled for the merge request.' + description: 'Indicates if auto merge is enabled for the merge request.' field :commit_count, GraphQL::Types::Int, null: true, method: :commits_count, - description: 'Number of commits in the merge request.' + description: 'Number of commits in the merge request.' field :conflicts, GraphQL::Types::Boolean, null: false, method: :cannot_be_merged?, - description: 'Indicates if the merge request has conflicts.' + description: 'Indicates if the merge request has conflicts.' field :reviewers, type: Types::MergeRequests::ReviewerType.connection_type, null: true, complexity: 5, description: 'Users from whom a review has been requested.' field :subscribed, GraphQL::Types::Boolean, method: :subscribed?, null: false, complexity: 5, - description: 'Indicates if the currently logged in user is subscribed to this merge request.' + description: 'Indicates if the currently logged in user is subscribed to this merge request.' field :task_completion_status, Types::TaskCompletionStatus, null: false, - description: Types::TaskCompletionStatus.description + description: Types::TaskCompletionStatus.description field :time_estimate, GraphQL::Types::Int, null: false, - description: 'Time estimate of the merge request.' + description: 'Time estimate of the merge request.' field :total_time_spent, GraphQL::Types::Int, null: false, - description: 'Total time reported as spent on the merge request.' + description: 'Total time reported as spent on the merge request.' field :approved_by, Types::UserType.connection_type, null: true, - description: 'Users who approved the merge request.', method: :approved_by_users + description: 'Users who approved the merge request.', method: :approved_by_users field :auto_merge_strategy, GraphQL::Types::String, null: true, - description: 'Selected auto merge strategy.' + description: 'Selected auto merge strategy.' field :available_auto_merge_strategies, [GraphQL::Types::String], null: true, calls_gitaly: true, - description: 'Array of available auto merge strategies.' + description: 'Array of available auto merge strategies.' field :commits, Types::CommitType.connection_type, null: true, - calls_gitaly: true, description: 'Merge request commits.' + calls_gitaly: true, description: 'Merge request commits.' field :committers, Types::UserType.connection_type, null: true, complexity: 5, - calls_gitaly: true, description: 'Users who have added commits to the merge request.' + calls_gitaly: true, description: 'Users who have added commits to the merge request.' field :commits_without_merge_commits, Types::CommitType.connection_type, null: true, - calls_gitaly: true, description: 'Merge request commits excluding merge commits.' + calls_gitaly: true, description: 'Merge request commits excluding merge commits.' field :has_ci, GraphQL::Types::Boolean, null: false, method: :has_ci?, - description: 'Indicates if the merge request has CI.' + description: 'Indicates if the merge request has CI.' field :merge_user, Types::UserType, null: true, - description: 'User who merged this merge request or set it to merge when pipeline succeeds.' + description: 'User who merged this merge request or set it to merge when pipeline succeeds.' field :mergeable, GraphQL::Types::Boolean, null: false, method: :mergeable?, calls_gitaly: true, - description: 'Indicates if the merge request is mergeable.' + description: 'Indicates if the merge request is mergeable.' field :security_auto_fix, GraphQL::Types::Boolean, null: true, - description: 'Indicates if the merge request is created by @GitLab-Security-Bot.' + description: 'Indicates if the merge request is created by @GitLab-Security-Bot.' field :squash, GraphQL::Types::Boolean, null: false, - description: 'Indicates if squash on merge is enabled.' + description: 'Indicates if squash on merge is enabled.' field :squash_on_merge, GraphQL::Types::Boolean, null: false, method: :squash_on_merge?, - description: 'Indicates if squash on merge is enabled.' + description: 'Indicates if squash on merge is enabled.' field :timelogs, Types::TimelogType.connection_type, null: false, - description: 'Timelogs on the merge request.' + description: 'Timelogs on the merge request.' markdown_field :title_html, null: true markdown_field :description_html, null: true diff --git a/app/graphql/types/merge_requests/detailed_merge_status_enum.rb b/app/graphql/types/merge_requests/detailed_merge_status_enum.rb new file mode 100644 index 00000000000..58104159303 --- /dev/null +++ b/app/graphql/types/merge_requests/detailed_merge_status_enum.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module Types + module MergeRequests + class DetailedMergeStatusEnum < BaseEnum + graphql_name 'DetailedMergeStatus' + description 'Detailed representation of whether a GitLab merge request can be merged.' + + value 'UNCHECKED', + value: :unchecked, + description: 'Merge status has not been checked.' + value 'CHECKING', + value: :checking, + description: 'Currently checking for mergeability.' + value 'MERGEABLE', + value: :mergeable, + description: 'Branch can be merged.' + value 'BROKEN_STATUS', + value: :broken_status, + description: 'Can not merge the source into the target branch, potential conflict.' + value 'CI_MUST_PASS', + value: :ci_must_pass, + description: 'Pipeline must succeed before merging.' + value 'DISCUSSIONS_NOT_RESOLVED', + value: :discussions_not_resolved, + description: 'Discussions must be resolved before merging.' + value 'DRAFT_STATUS', + value: :draft_status, + description: 'Merge request must not be draft before merging.' + value 'NOT_OPEN', + value: :not_open, + description: 'Merge request must be open before merging.' + value 'NOT_APPROVED', + value: :not_approved, + description: 'Merge request must be approved before merging.' + value 'BLOCKED_STATUS', + value: :merge_request_blocked, + description: 'Merge request is blocked by another merge request.' + value 'POLICIES_DENIED', + value: :policies_denied, + description: 'There are denied policies for the merge request.' + end + end +end diff --git a/app/graphql/types/metadata/kas_type.rb b/app/graphql/types/metadata/kas_type.rb index 6a8d54b6c7d..e29635aedcf 100644 --- a/app/graphql/types/metadata/kas_type.rb +++ b/app/graphql/types/metadata/kas_type.rb @@ -8,11 +8,11 @@ module Types authorize :read_instance_metadata field :enabled, GraphQL::Types::Boolean, null: false, - description: 'Indicates whether the Kubernetes Agent Server is enabled.' + description: 'Indicates whether the Kubernetes Agent Server is enabled.' field :external_url, GraphQL::Types::String, null: true, - description: 'URL used by the Agents to communicate with KAS.' + description: 'URL used by the Agents to communicate with KAS.' field :version, GraphQL::Types::String, null: true, - description: 'KAS version.' + description: 'KAS version.' end end end diff --git a/app/graphql/types/metadata_type.rb b/app/graphql/types/metadata_type.rb index 6fb141a50c9..b00fcfd38ad 100644 --- a/app/graphql/types/metadata_type.rb +++ b/app/graphql/types/metadata_type.rb @@ -7,10 +7,10 @@ module Types authorize :read_instance_metadata field :kas, ::Types::Metadata::KasType, null: false, - description: 'Metadata about KAS.' + description: 'Metadata about KAS.' field :revision, GraphQL::Types::String, null: false, - description: 'Revision.' + description: 'Revision.' field :version, GraphQL::Types::String, null: false, - description: 'Version.' + description: 'Version.' end end diff --git a/app/graphql/types/metrics/dashboard_type.rb b/app/graphql/types/metrics/dashboard_type.rb index 04cac55894e..5570b904d79 100644 --- a/app/graphql/types/metrics/dashboard_type.rb +++ b/app/graphql/types/metrics/dashboard_type.rb @@ -8,12 +8,16 @@ module Types graphql_name 'MetricsDashboard' field :path, GraphQL::Types::String, null: true, - description: 'Path to a file with the dashboard definition.' + description: 'Path to a file with the dashboard definition.' - field :schema_validation_warnings, [GraphQL::Types::String], null: true, + field :schema_validation_warnings, + [GraphQL::Types::String], + null: true, description: 'Dashboard schema validation warnings.' - field :annotations, Types::Metrics::Dashboards::AnnotationType.connection_type, null: true, + field :annotations, + Types::Metrics::Dashboards::AnnotationType.connection_type, + null: true, description: 'Annotations added to the dashboard.', resolver: Resolvers::Metrics::Dashboards::AnnotationResolver diff --git a/app/graphql/types/metrics/dashboards/annotation_type.rb b/app/graphql/types/metrics/dashboards/annotation_type.rb index 0621cf4d674..ec479078272 100644 --- a/app/graphql/types/metrics/dashboards/annotation_type.rb +++ b/app/graphql/types/metrics/dashboards/annotation_type.rb @@ -8,20 +8,22 @@ module Types authorize :read_metrics_dashboard_annotation field :description, GraphQL::Types::String, null: true, - description: 'Description of the annotation.' + description: 'Description of the annotation.' field :id, GraphQL::Types::ID, null: false, - description: 'ID of the annotation.' + description: 'ID of the annotation.' - field :panel_id, GraphQL::Types::String, null: true, + field :panel_id, + GraphQL::Types::String, + null: true, description: 'ID of a dashboard panel to which the annotation should be scoped.', method: :panel_xid field :starting_at, Types::TimeType, null: true, - description: 'Timestamp marking start of annotated time span.' + description: 'Timestamp marking start of annotated time span.' field :ending_at, Types::TimeType, null: true, - description: 'Timestamp marking end of annotated time span.' + description: 'Timestamp marking end of annotated time span.' end end end diff --git a/app/graphql/types/milestone_stats_type.rb b/app/graphql/types/milestone_stats_type.rb index 6d8b7deb8e7..36448c4987b 100644 --- a/app/graphql/types/milestone_stats_type.rb +++ b/app/graphql/types/milestone_stats_type.rb @@ -7,10 +7,14 @@ module Types authorize :read_milestone - field :total_issues_count, GraphQL::Types::Int, null: true, + field :total_issues_count, + GraphQL::Types::Int, + null: true, description: 'Total number of issues associated with the milestone.' - field :closed_issues_count, GraphQL::Types::Int, null: true, + field :closed_issues_count, + GraphQL::Types::Int, + null: true, description: 'Number of closed issues associated with the milestone.' end end diff --git a/app/graphql/types/milestone_type.rb b/app/graphql/types/milestone_type.rb index 7741fd723f0..447528917f0 100644 --- a/app/graphql/types/milestone_type.rb +++ b/app/graphql/types/milestone_type.rb @@ -12,52 +12,52 @@ module Types alias_method :milestone, :object field :id, GraphQL::Types::ID, null: false, - description: 'ID of the milestone.' + description: 'ID of the milestone.' field :iid, GraphQL::Types::ID, null: false, - description: "Internal ID of the milestone." + description: "Internal ID of the milestone." field :title, GraphQL::Types::String, null: false, - description: 'Title of the milestone.' + description: 'Title of the milestone.' field :description, GraphQL::Types::String, null: true, - description: 'Description of the milestone.' + description: 'Description of the milestone.' field :state, Types::MilestoneStateEnum, null: false, - description: 'State of the milestone.' + description: 'State of the milestone.' field :expired, GraphQL::Types::Boolean, null: false, - description: 'Expired state of the milestone (a milestone is expired when the due date is past the current date). Defaults to `false` when due date has not been set.' + description: 'Expired state of the milestone (a milestone is expired when the due date is past the current date). Defaults to `false` when due date has not been set.' field :web_path, GraphQL::Types::String, null: false, method: :milestone_path, - description: 'Web path of the milestone.' + description: 'Web path of the milestone.' field :due_date, Types::TimeType, null: true, - description: 'Timestamp of the milestone due date.' + description: 'Timestamp of the milestone due date.' field :start_date, Types::TimeType, null: true, - description: 'Timestamp of the milestone start date.' + description: 'Timestamp of the milestone start date.' field :created_at, Types::TimeType, null: false, - description: 'Timestamp of milestone creation.' + description: 'Timestamp of milestone creation.' field :updated_at, Types::TimeType, null: false, - description: 'Timestamp of last milestone update.' + description: 'Timestamp of last milestone update.' field :project_milestone, GraphQL::Types::Boolean, null: false, - description: 'Indicates if milestone is at project level.', - method: :project_milestone? + description: 'Indicates if milestone is at project level.', + method: :project_milestone? field :group_milestone, GraphQL::Types::Boolean, null: false, - description: 'Indicates if milestone is at group level.', - method: :group_milestone? + description: 'Indicates if milestone is at group level.', + method: :group_milestone? field :subgroup_milestone, GraphQL::Types::Boolean, null: false, - description: 'Indicates if milestone is at subgroup level.', - method: :subgroup_milestone? + description: 'Indicates if milestone is at subgroup level.', + method: :subgroup_milestone? field :stats, Types::MilestoneStatsType, null: true, - description: 'Milestone statistics.' + description: 'Milestone statistics.' field :releases, ::Types::ReleaseType.connection_type, null: true, diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index 46ab3f3f432..499c2e786bf 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -37,8 +37,8 @@ module Types mount_mutation Mutations::Clusters::AgentTokens::Create mount_mutation Mutations::Clusters::AgentTokens::Revoke mount_mutation Mutations::Commits::Create, calls_gitaly: true - mount_mutation Mutations::CustomEmoji::Create, feature_flag: :custom_emoji - mount_mutation Mutations::CustomEmoji::Destroy, feature_flag: :custom_emoji + mount_mutation Mutations::CustomEmoji::Create, _deprecated_feature_flag: :custom_emoji + mount_mutation Mutations::CustomEmoji::Destroy, _deprecated_feature_flag: :custom_emoji mount_mutation Mutations::CustomerRelations::Contacts::Create mount_mutation Mutations::CustomerRelations::Contacts::Update mount_mutation Mutations::CustomerRelations::Organizations::Create @@ -72,10 +72,8 @@ module Types mount_mutation Mutations::MergeRequests::SetSubscription mount_mutation Mutations::MergeRequests::SetDraft, calls_gitaly: true mount_mutation Mutations::MergeRequests::SetAssignees + mount_mutation Mutations::MergeRequests::SetReviewers mount_mutation Mutations::MergeRequests::ReviewerRereview - mount_mutation Mutations::MergeRequests::RequestAttention - mount_mutation Mutations::MergeRequests::RemoveAttentionRequest - mount_mutation Mutations::MergeRequests::ToggleAttentionRequested mount_mutation Mutations::Metrics::Dashboard::Annotations::Create mount_mutation Mutations::Metrics::Dashboard::Annotations::Delete mount_mutation Mutations::Notes::Create::Note, calls_gitaly: true @@ -94,6 +92,7 @@ module Types mount_mutation Mutations::Terraform::State::Delete mount_mutation Mutations::Terraform::State::Lock mount_mutation Mutations::Terraform::State::Unlock + mount_mutation Mutations::Timelogs::Create mount_mutation Mutations::Timelogs::Delete mount_mutation Mutations::Todos::Create mount_mutation Mutations::Todos::MarkDone @@ -129,6 +128,7 @@ module Types mount_mutation Mutations::Ci::JobTokenScope::RemoveProject mount_mutation Mutations::Ci::Runner::Update mount_mutation Mutations::Ci::Runner::Delete + mount_mutation Mutations::Ci::Runner::BulkDelete, alpha: { milestone: '15.3' } mount_mutation Mutations::Ci::RunnersRegistrationToken::Reset mount_mutation Mutations::Namespace::PackageSettings::Update mount_mutation Mutations::Groups::Update @@ -139,17 +139,18 @@ module Types mount_mutation Mutations::Packages::DestroyFiles mount_mutation Mutations::Packages::Cleanup::Policy::Update mount_mutation Mutations::Echo - mount_mutation Mutations::WorkItems::Create, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::CreateFromTask, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::Delete, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::DeleteTask, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::Update, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::UpdateWidgets, deprecated: { milestone: '15.1', reason: :alpha } - mount_mutation Mutations::WorkItems::UpdateTask, deprecated: { milestone: '15.1', reason: :alpha } + mount_mutation Mutations::WorkItems::Create, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::CreateFromTask, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::Delete, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::DeleteTask, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::Update, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::UpdateWidgets, alpha: { milestone: '15.1' } + mount_mutation Mutations::WorkItems::UpdateTask, alpha: { milestone: '15.1' } mount_mutation Mutations::SavedReplies::Create mount_mutation Mutations::SavedReplies::Update mount_mutation Mutations::Pages::MarkOnboardingComplete mount_mutation Mutations::SavedReplies::Destroy + mount_mutation Mutations::Uploads::Delete end end diff --git a/app/graphql/types/namespace_type.rb b/app/graphql/types/namespace_type.rb index de6a078c6ef..0f634e7c2d3 100644 --- a/app/graphql/types/namespace_type.rb +++ b/app/graphql/types/namespace_type.rb @@ -7,38 +7,45 @@ module Types authorize :read_namespace field :id, GraphQL::Types::ID, null: false, - description: 'ID of the namespace.' + description: 'ID of the namespace.' field :full_name, GraphQL::Types::String, null: false, - description: 'Full name of the namespace.' + description: 'Full name of the namespace.' field :full_path, GraphQL::Types::ID, null: false, - description: 'Full path of the namespace.' + description: 'Full path of the namespace.' field :name, GraphQL::Types::String, null: false, - description: 'Name of the namespace.' + description: 'Name of the namespace.' field :path, GraphQL::Types::String, null: false, - description: 'Path of the namespace.' + description: 'Path of the namespace.' - field :cross_project_pipeline_available, GraphQL::Types::Boolean, null: false, + field :cross_project_pipeline_available, + GraphQL::Types::Boolean, + null: false, resolver_method: :cross_project_pipeline_available?, description: 'Indicates if the cross_project_pipeline feature is available for the namespace.' field :description, GraphQL::Types::String, null: true, - description: 'Description of the namespace.' + description: 'Description of the namespace.' - field :lfs_enabled, GraphQL::Types::Boolean, null: true, method: :lfs_enabled?, + field :lfs_enabled, + GraphQL::Types::Boolean, + null: true, + method: :lfs_enabled?, description: 'Indicates if Large File Storage (LFS) is enabled for namespace.' - field :request_access_enabled, GraphQL::Types::Boolean, null: true, + field :request_access_enabled, + GraphQL::Types::Boolean, + null: true, description: 'Indicates if users can request access to namespace.' field :visibility, GraphQL::Types::String, null: true, - description: 'Visibility of the namespace.' + description: 'Visibility of the namespace.' field :root_storage_statistics, Types::RootStorageStatisticsType, null: true, description: 'Aggregated storage statistics of the namespace. Only available for root namespaces.' field :projects, Types::ProjectType.connection_type, null: false, - description: 'Projects within this namespace.', - resolver: ::Resolvers::NamespaceProjectsResolver + description: 'Projects within this namespace.', + resolver: ::Resolvers::NamespaceProjectsResolver field :package_settings, Types::Namespace::PackageSettingsType, @@ -50,8 +57,18 @@ module Types null: true, description: "Shared runners availability for the namespace and its descendants." + field :timelog_categories, + Types::TimeTracking::TimelogCategoryType.connection_type, + null: true, + description: "Timelog categories for the namespace.", + alpha: { milestone: '15.3' } + markdown_field :description_html, null: true + def timelog_categories + object.timelog_categories if Feature.enabled?(:timelog_categories) + end + def cross_project_pipeline_available? object.licensed_feature_available?(:cross_project_pipelines) end diff --git a/app/graphql/types/notes/diff_image_position_input_type.rb b/app/graphql/types/notes/diff_image_position_input_type.rb index d535dea2e07..8c82f4fec2e 100644 --- a/app/graphql/types/notes/diff_image_position_input_type.rb +++ b/app/graphql/types/notes/diff_image_position_input_type.rb @@ -5,13 +5,21 @@ module Types class DiffImagePositionInputType < DiffPositionBaseInputType graphql_name 'DiffImagePositionInput' - argument :height, GraphQL::Types::Int, required: true, + argument :height, + GraphQL::Types::Int, + required: true, description: copy_field_description(Types::Notes::DiffPositionType, :height) - argument :width, GraphQL::Types::Int, required: true, + argument :width, + GraphQL::Types::Int, + required: true, description: copy_field_description(Types::Notes::DiffPositionType, :width) - argument :x, GraphQL::Types::Int, required: true, + argument :x, + GraphQL::Types::Int, + required: true, description: copy_field_description(Types::Notes::DiffPositionType, :x) - argument :y, GraphQL::Types::Int, required: true, + argument :y, + GraphQL::Types::Int, + required: true, description: copy_field_description(Types::Notes::DiffPositionType, :y) end end diff --git a/app/graphql/types/notes/diff_position_base_input_type.rb b/app/graphql/types/notes/diff_position_base_input_type.rb index 2780dbab573..433cd442235 100644 --- a/app/graphql/types/notes/diff_position_base_input_type.rb +++ b/app/graphql/types/notes/diff_position_base_input_type.rb @@ -4,11 +4,11 @@ module Types module Notes class DiffPositionBaseInputType < BaseInputObject argument :base_sha, GraphQL::Types::String, required: false, - description: copy_field_description(Types::DiffRefsType, :base_sha) + description: copy_field_description(Types::DiffRefsType, :base_sha) argument :head_sha, GraphQL::Types::String, required: true, - description: copy_field_description(Types::DiffRefsType, :head_sha) + description: copy_field_description(Types::DiffRefsType, :head_sha) argument :start_sha, GraphQL::Types::String, required: true, - description: copy_field_description(Types::DiffRefsType, :start_sha) + description: copy_field_description(Types::DiffRefsType, :start_sha) argument :paths, Types::DiffPathsInputType, diff --git a/app/graphql/types/notes/diff_position_input_type.rb b/app/graphql/types/notes/diff_position_input_type.rb index ccde4188f29..5823a4f19cc 100644 --- a/app/graphql/types/notes/diff_position_input_type.rb +++ b/app/graphql/types/notes/diff_position_input_type.rb @@ -6,9 +6,9 @@ module Types graphql_name 'DiffPositionInput' argument :new_line, GraphQL::Types::Int, required: false, - description: "#{copy_field_description(Types::Notes::DiffPositionType, :new_line)} Please see the [REST API Documentation](https://docs.gitlab.com/ee/api/discussions.html#create-a-new-thread-in-the-merge-request-diff) for more information on how to use this field." + description: "#{copy_field_description(Types::Notes::DiffPositionType, :new_line)} Please see the [REST API Documentation](https://docs.gitlab.com/ee/api/discussions.html#create-a-new-thread-in-the-merge-request-diff) for more information on how to use this field." argument :old_line, GraphQL::Types::Int, required: false, - description: "#{copy_field_description(Types::Notes::DiffPositionType, :old_line)} Please see the [REST API Documentation](https://docs.gitlab.com/ee/api/discussions.html#create-a-new-thread-in-the-merge-request-diff) for more information on how to use this field." + description: "#{copy_field_description(Types::Notes::DiffPositionType, :old_line)} Please see the [REST API Documentation](https://docs.gitlab.com/ee/api/discussions.html#create-a-new-thread-in-the-merge-request-diff) for more information on how to use this field." end end end diff --git a/app/graphql/types/notes/diff_position_type.rb b/app/graphql/types/notes/diff_position_type.rb index 531bd0edac0..dd343cf45e4 100644 --- a/app/graphql/types/notes/diff_position_type.rb +++ b/app/graphql/types/notes/diff_position_type.rb @@ -7,33 +7,35 @@ module Types class DiffPositionType < BaseObject graphql_name 'DiffPosition' - field :diff_refs, Types::DiffRefsType, null: false, + field :diff_refs, + Types::DiffRefsType, + null: false, description: 'Information about the branch, HEAD, and base at the time of commenting.' field :file_path, GraphQL::Types::String, null: false, - description: 'Path of the file that was changed.' + description: 'Path of the file that was changed.' field :new_path, GraphQL::Types::String, null: true, - description: 'Path of the file on the HEAD SHA.' + description: 'Path of the file on the HEAD SHA.' field :old_path, GraphQL::Types::String, null: true, - description: 'Path of the file on the start SHA.' + description: 'Path of the file on the start SHA.' field :position_type, Types::Notes::PositionTypeEnum, null: false, - description: 'Type of file the position refers to.' + description: 'Type of file the position refers to.' # Fields for text positions field :new_line, GraphQL::Types::Int, null: true, - description: 'Line on HEAD SHA that was changed.' + description: 'Line on HEAD SHA that was changed.' field :old_line, GraphQL::Types::Int, null: true, - description: 'Line on start SHA that was changed.' + description: 'Line on start SHA that was changed.' # Fields for image positions field :height, GraphQL::Types::Int, null: true, - description: 'Total height of the image.' + description: 'Total height of the image.' field :width, GraphQL::Types::Int, null: true, - description: 'Total width of the image.' + description: 'Total width of the image.' field :x, GraphQL::Types::Int, null: true, - description: 'X position of the note.' + description: 'X position of the note.' field :y, GraphQL::Types::Int, null: true, - description: 'Y position of the note.' + description: 'Y position of the note.' def old_line object.old_line if object.on_text? diff --git a/app/graphql/types/notes/discussion_type.rb b/app/graphql/types/notes/discussion_type.rb index 89778b2a99a..5e40c8008a9 100644 --- a/app/graphql/types/notes/discussion_type.rb +++ b/app/graphql/types/notes/discussion_type.rb @@ -12,15 +12,15 @@ module Types implements(Types::ResolvableInterface) field :created_at, Types::TimeType, null: false, - description: "Timestamp of the discussion's creation." + description: "Timestamp of the discussion's creation." field :id, DiscussionID, null: false, - description: "ID of this discussion." + description: "ID of this discussion." field :noteable, Types::NoteableType, null: true, - description: 'Object which the discussion belongs to.' + description: 'Object which the discussion belongs to.' field :notes, Types::Notes::NoteType.connection_type, null: false, - description: 'All notes in the discussion.' + description: 'All notes in the discussion.' field :reply_id, DiscussionID, null: false, - description: 'ID used to reply to this discussion.' + description: 'ID used to reply to this discussion.' # DiscussionID.coerce_result is suitable here, but will always mark this # as being a 'Discussion'. Using `GlobalId.build` guarantees that we get diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb index 32f3ff7f556..c254460a51f 100644 --- a/app/graphql/types/notes/note_type.rb +++ b/app/graphql/types/notes/note_type.rb @@ -12,7 +12,7 @@ module Types implements(Types::ResolvableInterface) field :id, ::Types::GlobalIDType[::Note], null: false, - description: 'ID of the note.' + description: 'ID of the note.' field :project, Types::ProjectType, null: true, @@ -25,7 +25,9 @@ module Types field :system, GraphQL::Types::Boolean, null: false, description: 'Indicates whether this note was created by the system or by a user.' - field :system_note_icon_name, GraphQL::Types::String, null: true, + field :system_note_icon_name, + GraphQL::Types::String, + null: true, description: 'Name of the icon corresponding to a system note.' field :body, GraphQL::Types::String, @@ -34,16 +36,26 @@ module Types description: 'Content of the note.' field :confidential, GraphQL::Types::Boolean, null: true, - description: 'Indicates if this note is confidential.', - method: :confidential? + description: 'Indicates if this note is confidential.', + method: :confidential?, + deprecated: { + reason: :renamed, + replacement: 'internal', + milestone: '15.3' + } + + field :internal, GraphQL::Types::Boolean, null: true, + description: 'Indicates if this note is internal.', + method: :confidential? + field :created_at, Types::TimeType, null: false, - description: 'Timestamp of the note creation.' + description: 'Timestamp of the note creation.' field :discussion, Types::Notes::DiscussionType, null: true, - description: 'Discussion this note is a part of.' + description: 'Discussion this note is a part of.' field :position, Types::Notes::DiffPositionType, null: true, - description: 'Position of this note on a diff.' + description: 'Position of this note on a diff.' field :updated_at, Types::TimeType, null: false, - description: "Timestamp of the note's last activity." + description: "Timestamp of the note's last activity." field :url, GraphQL::Types::String, null: true, description: 'URL to view this Note in the Web UI.' diff --git a/app/graphql/types/packages/package_base_type.rb b/app/graphql/types/packages/package_base_type.rb index 06ccde94cd4..2dc4a2a2bb6 100644 --- a/app/graphql/types/packages/package_base_type.rb +++ b/app/graphql/types/packages/package_base_type.rb @@ -10,12 +10,12 @@ module Types authorize :read_package - field :id, ::Types::GlobalIDType[::Packages::Package], null: false, - description: 'ID of the package.' + field :id, ::Types::GlobalIDType[::Packages::Package], null: false, description: 'ID of the package.' field :can_destroy, GraphQL::Types::Boolean, null: false, description: 'Whether the user can destroy the package.' field :created_at, Types::TimeType, null: false, description: 'Date of creation.' - field :metadata, Types::Packages::MetadataType, null: true, + field :metadata, Types::Packages::MetadataType, + null: true, description: 'Package metadata.' field :name, GraphQL::Types::String, null: false, description: 'Name of the package.' field :package_type, Types::Packages::PackageTypeEnum, null: false, description: 'Package type.' diff --git a/app/graphql/types/packages/package_details_type.rb b/app/graphql/types/packages/package_details_type.rb index ae57e103f40..0413177ef14 100644 --- a/app/graphql/types/packages/package_details_type.rb +++ b/app/graphql/types/packages/package_details_type.rb @@ -11,7 +11,7 @@ module Types authorize :read_package field :versions, ::Types::Packages::PackageBaseType.connection_type, null: true, - description: 'Other versions of the package.' + description: 'Other versions of the package.' field :package_files, Types::Packages::PackageFileType.connection_type, null: true, method: :installable_package_files, description: 'Package files.' diff --git a/app/graphql/types/packages/package_file_type.rb b/app/graphql/types/packages/package_file_type.rb index b058dc0ab0d..3ee0d983745 100644 --- a/app/graphql/types/packages/package_file_type.rb +++ b/app/graphql/types/packages/package_file_type.rb @@ -11,7 +11,7 @@ module Types field :download_path, GraphQL::Types::String, null: false, description: 'Download path of the package file.' field :file_md5, GraphQL::Types::String, null: true, description: 'Md5 of the package file.' field :file_metadata, Types::Packages::FileMetadataType, null: true, - description: 'File metadata.' + description: 'File metadata.' field :file_name, GraphQL::Types::String, null: false, description: 'Name of the package file.' field :file_sha1, GraphQL::Types::String, null: true, description: 'Sha1 of the package file.' field :file_sha256, GraphQL::Types::String, null: true, description: 'Sha256 of the package file.' diff --git a/app/graphql/types/permission_types/group_enum.rb b/app/graphql/types/permission_types/group_enum.rb index 8b0fee8898c..f636d43790f 100644 --- a/app/graphql/types/permission_types/group_enum.rb +++ b/app/graphql/types/permission_types/group_enum.rb @@ -7,7 +7,8 @@ module Types description 'User permission on groups' value 'CREATE_PROJECTS', value: :create_projects, description: 'Groups where the user can create projects.' - value 'TRANSFER_PROJECTS', value: :transfer_projects, + value 'TRANSFER_PROJECTS', + value: :transfer_projects, description: 'Groups where the user can transfer projects to.' end end diff --git a/app/graphql/types/project_invitation_type.rb b/app/graphql/types/project_invitation_type.rb index b76f05e289f..b5760a911be 100644 --- a/app/graphql/types/project_invitation_type.rb +++ b/app/graphql/types/project_invitation_type.rb @@ -12,7 +12,7 @@ module Types authorize :admin_project field :project, Types::ProjectType, null: true, - description: 'Project ID for the project of the invitation.' + description: 'Project ID for the project of the invitation.' def project Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.source_id).find diff --git a/app/graphql/types/project_member_type.rb b/app/graphql/types/project_member_type.rb index 1f00df84641..2eba0d2dea2 100644 --- a/app/graphql/types/project_member_type.rb +++ b/app/graphql/types/project_member_type.rb @@ -12,7 +12,7 @@ module Types authorize :read_project field :project, Types::ProjectType, null: true, - description: 'Project that User is a member of.' + description: 'Project that User is a member of.' def project Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.source_id).find diff --git a/app/graphql/types/project_statistics_type.rb b/app/graphql/types/project_statistics_type.rb index 5ab3cc33e85..c43baf1280b 100644 --- a/app/graphql/types/project_statistics_type.rb +++ b/app/graphql/types/project_statistics_type.rb @@ -7,27 +7,31 @@ module Types authorize :read_statistics field :commit_count, GraphQL::Types::Float, null: false, - description: 'Commit count of the project.' + description: 'Commit count of the project.' field :build_artifacts_size, GraphQL::Types::Float, null: false, - description: 'Build artifacts size of the project in bytes.' - field :lfs_objects_size, GraphQL::Types::Float, null: false, + description: 'Build artifacts size of the project in bytes.' + field :lfs_objects_size, + GraphQL::Types::Float, + null: false, description: 'Large File Storage (LFS) object size of the project in bytes.' field :packages_size, GraphQL::Types::Float, null: false, - description: 'Packages size of the project in bytes.' + description: 'Packages size of the project in bytes.' field :pipeline_artifacts_size, GraphQL::Types::Float, null: true, - description: 'CI Pipeline artifacts size in bytes.' + description: 'CI Pipeline artifacts size in bytes.' field :repository_size, GraphQL::Types::Float, null: false, - description: 'Repository size of the project in bytes.' + description: 'Repository size of the project in bytes.' field :snippets_size, GraphQL::Types::Float, null: true, - description: 'Snippets size of the project in bytes.' + description: 'Snippets size of the project in bytes.' field :storage_size, GraphQL::Types::Float, null: false, - description: 'Storage size of the project in bytes.' + description: 'Storage size of the project in bytes.' field :uploads_size, GraphQL::Types::Float, null: true, - description: 'Uploads size of the project in bytes.' + description: 'Uploads size of the project in bytes.' field :wiki_size, GraphQL::Types::Float, null: true, - description: 'Wiki size of the project in bytes.' - field :container_registry_size, GraphQL::Types::Float, null: true, + description: 'Wiki size of the project in bytes.' + field :container_registry_size, + GraphQL::Types::Float, + null: true, description: 'Container Registry size of the project in bytes.' end end diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 7e3800c6a13..ecc6c9d7811 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -11,118 +11,118 @@ module Types expose_permissions Types::PermissionTypes::Project field :id, GraphQL::Types::ID, null: false, - description: 'ID of the project.' + description: 'ID of the project.' field :ci_config_path_or_default, GraphQL::Types::String, null: false, - description: 'Path of the CI configuration file.' + description: 'Path of the CI configuration file.' field :full_path, GraphQL::Types::ID, null: false, - description: 'Full path of the project.' + description: 'Full path of the project.' field :path, GraphQL::Types::String, null: false, - description: 'Path of the project.' + description: 'Path of the project.' field :sast_ci_configuration, Types::CiConfiguration::Sast::Type, null: true, - calls_gitaly: true, - description: 'SAST CI configuration for the project.' + calls_gitaly: true, + description: 'SAST CI configuration for the project.' field :name, GraphQL::Types::String, null: false, - description: 'Name of the project (without namespace).' + description: 'Name of the project (without namespace).' field :name_with_namespace, GraphQL::Types::String, null: false, - description: 'Full name of the project with its namespace.' + description: 'Full name of the project with its namespace.' field :description, GraphQL::Types::String, null: true, - description: 'Short description of the project.' + description: 'Short description of the project.' field :tag_list, GraphQL::Types::String, null: true, - deprecated: { reason: 'Use `topics`', milestone: '13.12' }, - description: 'List of project topics (not Git tags).', method: :topic_list + deprecated: { reason: 'Use `topics`', milestone: '13.12' }, + description: 'List of project topics (not Git tags).', method: :topic_list field :topics, [GraphQL::Types::String], null: true, - description: 'List of project topics.', method: :topic_list + description: 'List of project topics.', method: :topic_list field :http_url_to_repo, GraphQL::Types::String, null: true, - description: 'URL to connect to the project via HTTPS.' + description: 'URL to connect to the project via HTTPS.' field :ssh_url_to_repo, GraphQL::Types::String, null: true, - description: 'URL to connect to the project via SSH.' + description: 'URL to connect to the project via SSH.' field :web_url, GraphQL::Types::String, null: true, - description: 'Web URL of the project.' + description: 'Web URL of the project.' field :forks_count, GraphQL::Types::Int, null: false, calls_gitaly: true, # 4 times - description: 'Number of times the project has been forked.' + description: 'Number of times the project has been forked.' field :star_count, GraphQL::Types::Int, null: false, - description: 'Number of times the project has been starred.' + description: 'Number of times the project has been starred.' field :created_at, Types::TimeType, null: true, - description: 'Timestamp of the project creation.' + description: 'Timestamp of the project creation.' field :last_activity_at, Types::TimeType, null: true, - description: 'Timestamp of the project last activity.' + description: 'Timestamp of the project last activity.' field :archived, GraphQL::Types::Boolean, null: true, - description: 'Indicates the archived status of the project.' + description: 'Indicates the archived status of the project.' field :visibility, GraphQL::Types::String, null: true, - description: 'Visibility of the project.' + description: 'Visibility of the project.' field :lfs_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if the project has Large File Storage (LFS) enabled.' + description: 'Indicates if the project has Large File Storage (LFS) enabled.' field :merge_requests_ff_only_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if no merge commits should be created and all merges should instead be fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.' + description: 'Indicates if no merge commits should be created and all merges should instead be fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.' field :shared_runners_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if shared runners are enabled for the project.' + description: 'Indicates if shared runners are enabled for the project.' field :service_desk_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if the project has Service Desk enabled.' + description: 'Indicates if the project has Service Desk enabled.' field :service_desk_address, GraphQL::Types::String, null: true, - description: 'E-mail address of the Service Desk.' + description: 'E-mail address of the Service Desk.' field :avatar_url, GraphQL::Types::String, null: true, calls_gitaly: true, - description: 'URL to avatar image file of the project.' + description: 'URL to avatar image file of the project.' field :jobs_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if CI/CD pipeline jobs are enabled for the current user.' + description: 'Indicates if CI/CD pipeline jobs are enabled for the current user.' field :public_jobs, GraphQL::Types::Boolean, method: :public_builds, null: true, - description: 'Indicates if there is public access to pipelines and job details of the project, including output logs and artifacts.' + description: 'Indicates if there is public access to pipelines and job details of the project, including output logs and artifacts.' field :open_issues_count, GraphQL::Types::Int, null: true, - description: 'Number of open issues for the project.' + description: 'Number of open issues for the project.' field :allow_merge_on_skipped_pipeline, GraphQL::Types::Boolean, null: true, - description: 'If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of the project can also be merged with skipped jobs.' + description: 'If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of the project can also be merged with skipped jobs.' field :autoclose_referenced_issues, GraphQL::Types::Boolean, null: true, - description: 'Indicates if issues referenced by merge requests and commits within the default branch are closed automatically.' + description: 'Indicates if issues referenced by merge requests and commits within the default branch are closed automatically.' field :import_status, GraphQL::Types::String, null: true, - description: 'Status of import background job of the project.' + description: 'Status of import background job of the project.' field :jira_import_status, GraphQL::Types::String, null: true, - description: 'Status of Jira import background job of the project.' + description: 'Status of Jira import background job of the project.' field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::Types::Boolean, null: true, - description: 'Indicates if merge requests of the project can only be merged when all the discussions are resolved.' + description: 'Indicates if merge requests of the project can only be merged when all the discussions are resolved.' field :only_allow_merge_if_pipeline_succeeds, GraphQL::Types::Boolean, null: true, - description: 'Indicates if merge requests of the project can only be merged with successful jobs.' + description: 'Indicates if merge requests of the project can only be merged with successful jobs.' field :printing_merge_request_link_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if a link to create or view a merge request should display after a push to Git repositories of the project from the command line.' + description: 'Indicates if a link to create or view a merge request should display after a push to Git repositories of the project from the command line.' field :remove_source_branch_after_merge, GraphQL::Types::Boolean, null: true, - description: 'Indicates if `Delete source branch` option should be enabled by default for all new merge requests of the project.' + description: 'Indicates if `Delete source branch` option should be enabled by default for all new merge requests of the project.' field :request_access_enabled, GraphQL::Types::Boolean, null: true, - description: 'Indicates if users can request member access to the project.' + description: 'Indicates if users can request member access to the project.' field :squash_read_only, GraphQL::Types::Boolean, null: false, method: :squash_readonly?, - description: 'Indicates if `squashReadOnly` is enabled.' + description: 'Indicates if `squashReadOnly` is enabled.' field :suggestion_commit_message, GraphQL::Types::String, null: true, - description: 'Commit message used to apply merge request suggestions.' + description: 'Commit message used to apply merge request suggestions.' # No, the quotes are not a typo. Used to get around circular dependencies. # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27536#note_871009675 field :group, 'Types::GroupType', null: true, - description: 'Group of the project.' + description: 'Group of the project.' field :namespace, Types::NamespaceType, null: true, - description: 'Namespace of the project.' + description: 'Namespace of the project.' field :statistics, Types::ProjectStatisticsType, null: true, description: 'Statistics of the project.' field :repository, Types::RepositoryType, null: true, - description: 'Git repository of the project.' + description: 'Git repository of the project.' field :merge_requests, Types::MergeRequestType.connection_type, @@ -147,7 +147,7 @@ module Types field :work_items, Types::WorkItemType.connection_type, null: true, - deprecated: { milestone: '15.1', reason: :alpha }, + alpha: { milestone: '15.1' }, description: 'Work items of the project.', extras: [:lookahead], resolver: Resolvers::WorkItemsResolver @@ -160,8 +160,8 @@ module Types resolver: Resolvers::IssueStatusCountsResolver field :milestones, Types::MilestoneType.connection_type, null: true, - description: 'Milestones of the project.', - resolver: Resolvers::ProjectMilestonesResolver + description: 'Milestones of the project.', + resolver: Resolvers::ProjectMilestonesResolver field :project_members, description: 'Members of the project.', @@ -221,7 +221,7 @@ module Types resolver: Resolvers::Ci::ProjectPipelineCountsResolver field :ci_variables, - Types::Ci::VariableType.connection_type, + Types::Ci::ProjectVariableType.connection_type, null: true, description: "List of the project's CI/CD variables.", authorize: :admin_build, @@ -355,7 +355,7 @@ module Types resolver: Resolvers::ContainerRepositoriesResolver field :container_repositories_count, GraphQL::Types::Int, null: false, - description: 'Number of container repositories in the project.' + description: 'Number of container repositories in the project.' field :label, Types::LabelType, @@ -379,23 +379,23 @@ module Types resolver: Resolvers::Terraform::StatesResolver field :pipeline_analytics, Types::Ci::AnalyticsType, null: true, - description: 'Pipeline analytics.', - resolver: Resolvers::ProjectPipelineStatisticsResolver + description: 'Pipeline analytics.', + resolver: Resolvers::ProjectPipelineStatisticsResolver field :ci_template, Types::Ci::TemplateType, null: true, - description: 'Find a single CI/CD template by name.', - resolver: Resolvers::Ci::TemplateResolver + description: 'Find a single CI/CD template by name.', + resolver: Resolvers::Ci::TemplateResolver field :ci_job_token_scope, Types::Ci::JobTokenScopeType, null: true, - description: 'The CI Job Tokens scope of access.', - resolver: Resolvers::Ci::JobTokenScopeResolver + description: 'The CI Job Tokens scope of access.', + resolver: Resolvers::Ci::JobTokenScopeResolver field :timelogs, Types::TimelogType.connection_type, null: true, - description: 'Time logged on issues and merge requests in the project.', - extras: [:lookahead], - complexity: 5, - resolver: ::Resolvers::TimelogResolver + description: 'Time logged on issues and merge requests in the project.', + extras: [:lookahead], + complexity: 5, + resolver: ::Resolvers::TimelogResolver field :agent_configurations, ::Types::Kas::AgentConfigurationType.connection_type, @@ -438,6 +438,20 @@ module Types ' Returns `null` if `work_items` feature flag is disabled.' \ ' This flag is disabled by default, because the feature is experimental and is subject to change without notice.' + field :timelog_categories, + Types::TimeTracking::TimelogCategoryType.connection_type, + null: true, + description: "Timelog categories for the project.", + alpha: { milestone: '15.3' } + + field :fork_targets, Types::NamespaceType.connection_type, + resolver: Resolvers::Projects::ForkTargetsResolver, + description: 'Namespaces in which the current user can fork the project into.' + + def timelog_categories + object.project_namespace.timelog_categories if Feature.enabled?(:timelog_categories) + end + def label(title:) BatchLoader::GraphQL.for(title).batch(key: project) do |titles, loader, args| LabelsFinder @@ -455,7 +469,7 @@ module Types container_registry: 'Container Registry is' }.each do |feature, name_string| field "#{feature}_enabled", GraphQL::Types::Boolean, null: true, - description: "Indicates if #{name_string} enabled for the current user" + description: "Indicates if #{name_string} enabled for the current user" define_method "#{feature}_enabled" do object.feature_available?(feature, context[:current_user]) diff --git a/app/graphql/types/projects/service_type.rb b/app/graphql/types/projects/service_type.rb index 88b7b95aa57..1416d93d3b4 100644 --- a/app/graphql/types/projects/service_type.rb +++ b/app/graphql/types/projects/service_type.rb @@ -9,11 +9,11 @@ module Types # TODO: Add all the fields that we want to expose for the project services integrations # https://gitlab.com/gitlab-org/gitlab/-/issues/213088 field :type, GraphQL::Types::String, null: true, - description: 'Class name of the service.' + description: 'Class name of the service.' field :service_type, ::Types::Projects::ServiceTypeEnum, null: true, - description: 'Type of the service.' + description: 'Type of the service.' field :active, GraphQL::Types::Boolean, null: true, - description: 'Indicates if the service is active.' + description: 'Indicates if the service is active.' def type enum = ::Types::Projects::ServiceTypeEnum.coerce_result(service_type, context) diff --git a/app/graphql/types/projects/services/jira_project_type.rb b/app/graphql/types/projects/services/jira_project_type.rb index 0ff1b9d8903..1c5b97802e3 100644 --- a/app/graphql/types/projects/services/jira_project_type.rb +++ b/app/graphql/types/projects/services/jira_project_type.rb @@ -8,12 +8,12 @@ module Types graphql_name 'JiraProject' field :key, GraphQL::Types::String, null: false, - description: 'Key of the Jira project.' + description: 'Key of the Jira project.' field :name, GraphQL::Types::String, null: true, - description: 'Name of the Jira project.' + description: 'Name of the Jira project.' field :project_id, GraphQL::Types::Int, null: false, - description: 'ID of the Jira project.', - method: :id + description: 'ID of the Jira project.', + method: :id end # rubocop:enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/projects/topic_type.rb b/app/graphql/types/projects/topic_type.rb index bde6d79ddbf..da7df6df4a2 100644 --- a/app/graphql/types/projects/topic_type.rb +++ b/app/graphql/types/projects/topic_type.rb @@ -7,20 +7,20 @@ module Types graphql_name 'Topic' field :id, GraphQL::Types::ID, null: false, - description: 'ID of the topic.' + description: 'ID of the topic.' field :name, GraphQL::Types::String, null: false, - description: 'Name of the topic.' + description: 'Name of the topic.' field :title, GraphQL::Types::String, null: false, - method: :title_or_name, - description: 'Title of the topic.' + method: :title_or_name, + description: 'Title of the topic.' field :description, GraphQL::Types::String, null: true, - description: 'Description of the topic.' + description: 'Description of the topic.' field :avatar_url, GraphQL::Types::String, null: true, - description: 'URL to avatar image file of the topic.' + description: 'URL to avatar image file of the topic.' markdown_field :description_html, null: true diff --git a/app/graphql/types/prometheus_alert_type.rb b/app/graphql/types/prometheus_alert_type.rb index 789f1d6eb5f..fddb8b73768 100644 --- a/app/graphql/types/prometheus_alert_type.rb +++ b/app/graphql/types/prometheus_alert_type.rb @@ -10,7 +10,7 @@ module Types present_using PrometheusAlertPresenter field :id, GraphQL::Types::ID, null: false, - description: 'ID of the alert condition.' + description: 'ID of the alert condition.' field :humanized_text, GraphQL::Types::String, diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 9207a867639..84355390ea0 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -91,7 +91,7 @@ module Types field :work_item, Types::WorkItemType, null: true, resolver: Resolvers::WorkItemResolver, - deprecated: { milestone: '15.1', reason: :alpha }, + alpha: { milestone: '15.1' }, description: 'Find a work item. Returns `null` if `work_items` feature flag is disabled.' field :merge_request, Types::MergeRequestType, @@ -124,7 +124,7 @@ module Types description: "Find runners visible to the current user." field :ci_variables, - Types::Ci::VariableType.connection_type, + Types::Ci::InstanceVariableType.connection_type, null: true, description: "List of the instance's CI/CD variables." @@ -184,7 +184,7 @@ module Types end def ci_variables - return unless current_user.can_admin_all_resources? + return unless current_user&.can_admin_all_resources? ::Ci::InstanceVariable.all end diff --git a/app/graphql/types/release_asset_link_type.rb b/app/graphql/types/release_asset_link_type.rb index 29738de27e5..e171c683e7d 100644 --- a/app/graphql/types/release_asset_link_type.rb +++ b/app/graphql/types/release_asset_link_type.rb @@ -10,19 +10,21 @@ module Types present_using Releases::LinkPresenter field :external, GraphQL::Types::Boolean, null: true, method: :external?, - description: 'Indicates the link points to an external resource.' + description: 'Indicates the link points to an external resource.' field :id, GraphQL::Types::ID, null: false, - description: 'ID of the link.' - field :link_type, Types::ReleaseAssetLinkTypeEnum, null: true, + description: 'ID of the link.' + field :link_type, + Types::ReleaseAssetLinkTypeEnum, + null: true, description: 'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`.' field :name, GraphQL::Types::String, null: true, - description: 'Name of the link.' + description: 'Name of the link.' field :url, GraphQL::Types::String, null: true, - description: 'URL of the link.' + description: 'URL of the link.' field :direct_asset_path, GraphQL::Types::String, null: true, method: :filepath, - description: 'Relative path for the direct asset link.' + description: 'Relative path for the direct asset link.' field :direct_asset_url, GraphQL::Types::String, null: true, - description: 'Direct asset URL of the link.' + description: 'Direct asset URL of the link.' end end diff --git a/app/graphql/types/release_assets_type.rb b/app/graphql/types/release_assets_type.rb index ea6ee0b5fd9..396ba112130 100644 --- a/app/graphql/types/release_assets_type.rb +++ b/app/graphql/types/release_assets_type.rb @@ -12,10 +12,10 @@ module Types present_using ReleasePresenter field :count, GraphQL::Types::Int, null: true, method: :assets_count, - description: 'Number of assets of the release.' + description: 'Number of assets of the release.' field :links, Types::ReleaseAssetLinkType.connection_type, null: true, method: :sorted_links, - description: 'Asset links of the release.' + description: 'Asset links of the release.' field :sources, Types::ReleaseSourceType.connection_type, null: true, - description: 'Sources of the release.' + description: 'Sources of the release.' end end diff --git a/app/graphql/types/release_links_type.rb b/app/graphql/types/release_links_type.rb index b7a1a5a9dbe..6bc767152e8 100644 --- a/app/graphql/types/release_links_type.rb +++ b/app/graphql/types/release_links_type.rb @@ -10,25 +10,35 @@ module Types present_using ReleasePresenter - field :closed_issues_url, GraphQL::Types::String, null: true, + field :closed_issues_url, + GraphQL::Types::String, + null: true, description: 'HTTP URL of the issues page, filtered by this release and `state=closed`.', authorize: :download_code - field :closed_merge_requests_url, GraphQL::Types::String, null: true, + field :closed_merge_requests_url, + GraphQL::Types::String, + null: true, description: 'HTTP URL of the merge request page , filtered by this release and `state=closed`.', authorize: :download_code field :edit_url, GraphQL::Types::String, null: true, - description: "HTTP URL of the release's edit page.", - authorize: :update_release - field :merged_merge_requests_url, GraphQL::Types::String, null: true, + description: "HTTP URL of the release's edit page.", + authorize: :update_release + field :merged_merge_requests_url, + GraphQL::Types::String, + null: true, description: 'HTTP URL of the merge request page , filtered by this release and `state=merged`.', authorize: :download_code - field :opened_issues_url, GraphQL::Types::String, null: true, + field :opened_issues_url, + GraphQL::Types::String, + null: true, description: 'HTTP URL of the issues page, filtered by this release and `state=open`.', authorize: :download_code - field :opened_merge_requests_url, GraphQL::Types::String, null: true, + field :opened_merge_requests_url, + GraphQL::Types::String, + null: true, description: 'HTTP URL of the merge request page, filtered by this release and `state=open`.', authorize: :download_code field :self_url, GraphQL::Types::String, null: true, - description: 'HTTP URL of the release.' + description: 'HTTP URL of the release.' end end diff --git a/app/graphql/types/release_source_type.rb b/app/graphql/types/release_source_type.rb index fd29a69d72a..e05a2926ac1 100644 --- a/app/graphql/types/release_source_type.rb +++ b/app/graphql/types/release_source_type.rb @@ -8,8 +8,8 @@ module Types authorize :download_code field :format, GraphQL::Types::String, null: true, - description: 'Format of the source.' + description: 'Format of the source.' field :url, GraphQL::Types::String, null: true, - description: 'Download URL of the source.' + description: 'Download URL of the source.' end end diff --git a/app/graphql/types/release_type.rb b/app/graphql/types/release_type.rb index d906c577aa5..d70fe05c906 100644 --- a/app/graphql/types/release_type.rb +++ b/app/graphql/types/release_type.rb @@ -17,38 +17,40 @@ module Types null: false, description: 'Global ID of the release.' field :assets, Types::ReleaseAssetsType, null: true, method: :itself, - description: 'Assets of the release.' + description: 'Assets of the release.' field :created_at, Types::TimeType, null: true, - description: 'Timestamp of when the release was created.' - field :description, GraphQL::Types::String, null: true, + description: 'Timestamp of when the release was created.' + field :description, + GraphQL::Types::String, + null: true, description: 'Description (also known as "release notes") of the release.' field :evidences, Types::EvidenceType.connection_type, null: true, - description: 'Evidence for the release.' + description: 'Evidence for the release.' field :links, Types::ReleaseLinksType, null: true, method: :itself, - description: 'Links of the release.' + description: 'Links of the release.' field :milestones, Types::MilestoneType.connection_type, null: true, - description: 'Milestones associated to the release.', - resolver: ::Resolvers::ReleaseMilestonesResolver + description: 'Milestones associated to the release.', + resolver: ::Resolvers::ReleaseMilestonesResolver field :name, GraphQL::Types::String, null: true, - description: 'Name of the release.' + description: 'Name of the release.' field :released_at, Types::TimeType, null: true, - description: 'Timestamp of when the release was released.' + description: 'Timestamp of when the release was released.' field :tag_name, GraphQL::Types::String, null: true, method: :tag, - description: 'Name of the tag associated with the release.' + description: 'Name of the tag associated with the release.' field :tag_path, GraphQL::Types::String, null: true, - description: 'Relative web path to the tag associated with the release.', - authorize: :download_code + description: 'Relative web path to the tag associated with the release.', + authorize: :download_code field :upcoming_release, GraphQL::Types::Boolean, null: true, method: :upcoming_release?, - description: 'Indicates the release is an upcoming release.' + description: 'Indicates the release is an upcoming release.' field :historical_release, GraphQL::Types::Boolean, null: true, method: :historical_release?, - description: 'Indicates the release is an historical release.' + description: 'Indicates the release is an historical release.' field :author, Types::UserType, null: true, - description: 'User that created the release.' + description: 'User that created the release.' field :commit, Types::CommitType, null: true, - complexity: 10, calls_gitaly: true, - description: 'Commit associated with the release.' + complexity: 10, calls_gitaly: true, + description: 'Commit associated with the release.' markdown_field :description_html, null: true diff --git a/app/graphql/types/repository/blob_type.rb b/app/graphql/types/repository/blob_type.rb index dd5c70887de..8c90a8df611 100644 --- a/app/graphql/types/repository/blob_type.rb +++ b/app/graphql/types/repository/blob_type.rb @@ -9,108 +9,108 @@ module Types present_using BlobPresenter field :id, GraphQL::Types::ID, null: false, - description: 'ID of the blob.' + description: 'ID of the blob.' field :oid, GraphQL::Types::String, null: false, method: :id, - description: 'OID of the blob.' + description: 'OID of the blob.' field :path, GraphQL::Types::String, null: false, - description: 'Path of the blob.' + description: 'Path of the blob.' field :name, GraphQL::Types::String, description: 'Blob name.', null: true field :mode, type: GraphQL::Types::String, - description: 'Blob mode.', - null: true + description: 'Blob mode.', + null: true field :lfs_oid, GraphQL::Types::String, null: true, - calls_gitaly: true, - description: 'LFS OID of the blob.' + calls_gitaly: true, + description: 'LFS OID of the blob.' field :web_path, GraphQL::Types::String, null: true, - description: 'Web path of the blob.' + description: 'Web path of the blob.' field :ide_edit_path, GraphQL::Types::String, null: true, - description: 'Web path to edit this blob in the Web IDE.' + description: 'Web path to edit this blob in the Web IDE.' field :fork_and_edit_path, GraphQL::Types::String, null: true, - description: 'Web path to edit this blob using a forked project.' + description: 'Web path to edit this blob using a forked project.' field :ide_fork_and_edit_path, GraphQL::Types::String, null: true, - description: 'Web path to edit this blob in the Web IDE using a forked project.' + description: 'Web path to edit this blob in the Web IDE using a forked project.' field :fork_and_view_path, GraphQL::Types::String, null: true, - description: 'Web path to view this blob using a forked project.' + description: 'Web path to view this blob using a forked project.' field :size, GraphQL::Types::Int, null: true, - description: 'Size (in bytes) of the blob.' + description: 'Size (in bytes) of the blob.' field :raw_size, GraphQL::Types::Int, null: true, - description: 'Size (in bytes) of the blob, or the blob target if stored externally.' + description: 'Size (in bytes) of the blob, or the blob target if stored externally.' field :raw_blob, GraphQL::Types::String, null: true, method: :data, - description: 'Raw content of the blob.' + description: 'Raw content of the blob.' field :raw_text_blob, GraphQL::Types::String, null: true, method: :text_only_data, - description: 'Raw content of the blob, if the blob is text data.' + description: 'Raw content of the blob, if the blob is text data.' field :stored_externally, GraphQL::Types::Boolean, null: true, method: :stored_externally?, - description: "Whether the blob's content is stored externally (for instance, in LFS)." + description: "Whether the blob's content is stored externally (for instance, in LFS)." field :external_storage, GraphQL::Types::String, null: true, method: :external_storage, - description: "External storage being used, if enabled (for instance, 'LFS')." + description: "External storage being used, if enabled (for instance, 'LFS')." field :edit_blob_path, GraphQL::Types::String, null: true, - description: 'Web path to edit the blob in the old-style editor.' + description: 'Web path to edit the blob in the old-style editor.' field :raw_path, GraphQL::Types::String, null: true, - description: 'Web path to download the raw blob.' + description: 'Web path to download the raw blob.' field :external_storage_url, GraphQL::Types::String, null: true, - description: 'Web path to download the raw blob via external storage, if enabled.' + description: 'Web path to download the raw blob via external storage, if enabled.' field :replace_path, GraphQL::Types::String, null: true, - description: 'Web path to replace the blob content.' + description: 'Web path to replace the blob content.' field :pipeline_editor_path, GraphQL::Types::String, null: true, - description: 'Web path to edit .gitlab-ci.yml file.' + description: 'Web path to edit .gitlab-ci.yml file.' field :gitpod_blob_url, GraphQL::Types::String, null: true, - description: 'URL to the blob within Gitpod.' + description: 'URL to the blob within Gitpod.' field :find_file_path, GraphQL::Types::String, null: true, - description: 'Web path to find file.' + description: 'Web path to find file.' field :blame_path, GraphQL::Types::String, null: true, - description: 'Web path to blob blame page.' + description: 'Web path to blob blame page.' field :history_path, GraphQL::Types::String, null: true, - description: 'Web path to blob history page.' + description: 'Web path to blob history page.' field :permalink_path, GraphQL::Types::String, null: true, - description: 'Web path to blob permalink.', - calls_gitaly: true + description: 'Web path to blob permalink.', + calls_gitaly: true field :environment_formatted_external_url, GraphQL::Types::String, null: true, - description: 'Environment on which the blob is available.', - calls_gitaly: true + description: 'Environment on which the blob is available.', + calls_gitaly: true field :environment_external_url_for_route_map, GraphQL::Types::String, null: true, - description: 'Web path to blob on an environment.', - calls_gitaly: true + description: 'Web path to blob on an environment.', + calls_gitaly: true field :file_type, GraphQL::Types::String, null: true, - description: 'Expected format of the blob based on the extension.' + description: 'Expected format of the blob based on the extension.' field :simple_viewer, type: Types::BlobViewerType, - description: 'Blob content simple viewer.', - null: false + description: 'Blob content simple viewer.', + null: false field :rich_viewer, type: Types::BlobViewerType, - description: 'Blob content rich viewer.', - null: true + description: 'Blob content rich viewer.', + null: true field :plain_data, GraphQL::Types::String, description: 'Blob plain highlighted data.', @@ -118,14 +118,14 @@ module Types calls_gitaly: true field :can_modify_blob, GraphQL::Types::Boolean, null: true, method: :can_modify_blob?, - calls_gitaly: true, - description: 'Whether the current user can modify the blob.' + calls_gitaly: true, + description: 'Whether the current user can modify the blob.' field :can_current_user_push_to_branch, GraphQL::Types::Boolean, null: true, method: :can_current_user_push_to_branch?, - description: 'Whether the current user can push to the branch.' + description: 'Whether the current user can push to the branch.' field :archived, GraphQL::Types::Boolean, null: true, method: :archived?, - description: 'Whether the current project is archived.' + description: 'Whether the current project is archived.' field :language, GraphQL::Types::String, description: 'Blob language.', @@ -134,10 +134,10 @@ module Types calls_gitaly: true field :code_navigation_path, GraphQL::Types::String, null: true, calls_gitaly: true, - description: 'Web path for code navigation.' + description: 'Web path for code navigation.' field :project_blob_path_root, GraphQL::Types::String, null: true, - description: 'Web path for the root of the blob.' + description: 'Web path for the root of the blob.' def raw_text_blob object.data unless object.binary? diff --git a/app/graphql/types/repository_type.rb b/app/graphql/types/repository_type.rb index aa02f0058da..ba94f59ab6c 100644 --- a/app/graphql/types/repository_type.rb +++ b/app/graphql/types/repository_type.rb @@ -7,24 +7,24 @@ module Types authorize :download_code field :blobs, Types::Repository::BlobType.connection_type, null: true, resolver: Resolvers::BlobsResolver, calls_gitaly: true, - description: 'Blobs contained within the repository' + description: 'Blobs contained within the repository' field :branch_names, [GraphQL::Types::String], null: true, calls_gitaly: true, - complexity: 170, description: 'Names of branches available in this repository that match the search pattern.', - resolver: Resolvers::RepositoryBranchNamesResolver + complexity: 170, description: 'Names of branches available in this repository that match the search pattern.', + resolver: Resolvers::RepositoryBranchNamesResolver field :disk_path, GraphQL::Types::String, description: 'Shows a disk path of the repository.', null: true, authorize: :read_storage_disk_path field :empty, GraphQL::Types::Boolean, null: false, method: :empty?, calls_gitaly: true, - description: 'Indicates repository has no visible content.' + description: 'Indicates repository has no visible content.' field :exists, GraphQL::Types::Boolean, null: false, method: :exists?, calls_gitaly: true, - description: 'Indicates a corresponding Git repository exists on disk.' + description: 'Indicates a corresponding Git repository exists on disk.' field :paginated_tree, Types::Tree::TreeType.connection_type, null: true, resolver: Resolvers::PaginatedTreeResolver, calls_gitaly: true, - max_page_size: 100, - description: 'Paginated tree of the repository.' + max_page_size: 100, + description: 'Paginated tree of the repository.' field :root_ref, GraphQL::Types::String, null: true, calls_gitaly: true, - description: 'Default branch of the repository.' + description: 'Default branch of the repository.' field :tree, Types::Tree::TreeType, null: true, resolver: Resolvers::TreeResolver, calls_gitaly: true, - description: 'Tree of the repository.' + description: 'Tree of the repository.' end end diff --git a/app/graphql/types/resolvable_interface.rb b/app/graphql/types/resolvable_interface.rb index 42784aa5e00..2869d2cfd0f 100644 --- a/app/graphql/types/resolvable_interface.rb +++ b/app/graphql/types/resolvable_interface.rb @@ -17,12 +17,12 @@ module Types end field :resolved, GraphQL::Types::Boolean, null: false, - description: 'Indicates if the object is resolved.', - method: :resolved? + description: 'Indicates if the object is resolved.', + method: :resolved? field :resolvable, GraphQL::Types::Boolean, null: false, - description: 'Indicates if the object can be resolved.', - method: :resolvable? + description: 'Indicates if the object can be resolved.', + method: :resolvable? field :resolved_at, Types::TimeType, null: true, - description: 'Timestamp of when the object was resolved.' + description: 'Timestamp of when the object was resolved.' end end diff --git a/app/graphql/types/snippet_type.rb b/app/graphql/types/snippet_type.rb index 7b96cc34941..5ee0500b1e0 100644 --- a/app/graphql/types/snippet_type.rb +++ b/app/graphql/types/snippet_type.rb @@ -54,28 +54,28 @@ module Types null: false field :web_url, type: GraphQL::Types::String, - description: 'Web URL of the snippet.', - null: false + description: 'Web URL of the snippet.', + null: false field :raw_url, type: GraphQL::Types::String, - description: 'Raw URL of the snippet.', - null: false + description: 'Raw URL of the snippet.', + null: false field :blobs, type: Types::Snippets::BlobType.connection_type, - description: 'Snippet blobs.', - calls_gitaly: true, - null: true, - resolver: Resolvers::Snippets::BlobsResolver + description: 'Snippet blobs.', + calls_gitaly: true, + null: true, + resolver: Resolvers::Snippets::BlobsResolver field :ssh_url_to_repo, type: GraphQL::Types::String, - description: 'SSH URL to the snippet repository.', - calls_gitaly: true, - null: true + description: 'SSH URL to the snippet repository.', + calls_gitaly: true, + null: true field :http_url_to_repo, type: GraphQL::Types::String, - description: 'HTTP URL to the snippet repository.', - calls_gitaly: true, - null: true + description: 'HTTP URL to the snippet repository.', + calls_gitaly: true, + null: true markdown_field :description_html, null: true, method: :description diff --git a/app/graphql/types/snippets/blob_connection_type.rb b/app/graphql/types/snippets/blob_connection_type.rb index 15d26af7374..476a6f04b4a 100644 --- a/app/graphql/types/snippets/blob_connection_type.rb +++ b/app/graphql/types/snippets/blob_connection_type.rb @@ -4,7 +4,9 @@ module Types module Snippets # rubocop: disable Graphql/AuthorizeTypes class BlobConnectionType < GraphQL::Types::Relay::BaseConnection - field :has_unretrievable_blobs, GraphQL::Types::Boolean, null: false, + field :has_unretrievable_blobs, + GraphQL::Types::Boolean, + null: false, description: 'Indicates if the snippet has unretrievable blobs.', resolver_method: :unretrievable_blobs? diff --git a/app/graphql/types/snippets/blob_type.rb b/app/graphql/types/snippets/blob_type.rb index 80702c71f63..bb4a0a64de8 100644 --- a/app/graphql/types/snippets/blob_type.rb +++ b/app/graphql/types/snippets/blob_type.rb @@ -44,25 +44,25 @@ module Types null: true field :simple_viewer, type: Types::Snippets::BlobViewerType, - description: 'Blob content simple viewer.', - null: false + description: 'Blob content simple viewer.', + null: false field :rich_viewer, type: Types::Snippets::BlobViewerType, - description: 'Blob content rich viewer.', - null: true + description: 'Blob content rich viewer.', + null: true field :mode, type: GraphQL::Types::String, - description: 'Blob mode.', - null: true + description: 'Blob mode.', + null: true field :external_storage, type: GraphQL::Types::String, - description: 'Blob external storage.', - null: true + description: 'Blob external storage.', + null: true field :rendered_as_text, type: GraphQL::Types::Boolean, - description: 'Shows whether the blob is rendered as text.', - method: :rendered_as_text?, - null: false + description: 'Shows whether the blob is rendered as text.', + method: :rendered_as_text?, + null: false end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/subscription_type.rb b/app/graphql/types/subscription_type.rb index de3f71090f6..9b5f028a857 100644 --- a/app/graphql/types/subscription_type.rb +++ b/app/graphql/types/subscription_type.rb @@ -5,15 +5,18 @@ module Types graphql_name 'Subscription' field :issuable_assignees_updated, subscription: Subscriptions::IssuableUpdated, null: true, - description: 'Triggered when the assignees of an issuable are updated.' + description: 'Triggered when the assignees of an issuable are updated.' field :issue_crm_contacts_updated, subscription: Subscriptions::IssuableUpdated, null: true, - description: 'Triggered when the crm contacts of an issuable are updated.' + description: 'Triggered when the crm contacts of an issuable are updated.' field :issuable_title_updated, subscription: Subscriptions::IssuableUpdated, null: true, - description: 'Triggered when the title of an issuable is updated.' + description: 'Triggered when the title of an issuable is updated.' field :issuable_labels_updated, subscription: Subscriptions::IssuableUpdated, null: true, - description: 'Triggered when the labels of an issuable are updated.' + description: 'Triggered when the labels of an issuable are updated.' + + field :issuable_dates_updated, subscription: Subscriptions::IssuableUpdated, null: true, + description: 'Triggered when the due date or start date of an issuable is updated.' end end diff --git a/app/graphql/types/task_completion_status.rb b/app/graphql/types/task_completion_status.rb index 9a979b04d37..c7da2f2cf01 100644 --- a/app/graphql/types/task_completion_status.rb +++ b/app/graphql/types/task_completion_status.rb @@ -9,9 +9,9 @@ module Types description 'Completion status of tasks' field :completed_count, GraphQL::Types::Int, null: false, - description: 'Number of completed tasks.' + description: 'Number of completed tasks.' field :count, GraphQL::Types::Int, null: false, - description: 'Number of total tasks.' + description: 'Number of total tasks.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/time_tracking/timelog_category_type.rb b/app/graphql/types/time_tracking/timelog_category_type.rb new file mode 100644 index 00000000000..c73a6fbd43b --- /dev/null +++ b/app/graphql/types/time_tracking/timelog_category_type.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module Types + module TimeTracking + class TimelogCategoryType < BaseObject + graphql_name 'TimeTrackingTimelogCategory' + + authorize :read_timelog_category + + field :id, + GraphQL::Types::ID, + null: false, + description: 'Internal ID of the timelog category.' + + field :name, + GraphQL::Types::String, + null: false, + description: 'Name of the category.' + + field :description, + GraphQL::Types::String, + null: true, + description: 'Description of the category.' + + field :color, + Types::ColorType, + null: true, + description: 'Color assigned to the category.' + + field :billable, + GraphQL::Types::Boolean, + null: true, + description: 'Whether the category is billable or not.' + + field :billing_rate, + GraphQL::Types::Float, + null: true, + description: 'Billing rate for the category.' + + field :created_at, + Types::TimeType, + null: false, + description: 'When the category was created.' + + field :updated_at, + Types::TimeType, + null: false, + description: 'When the category was last updated.' + end + end +end diff --git a/app/graphql/types/tree/blob_type.rb b/app/graphql/types/tree/blob_type.rb index 284542e1d2a..3db64d812c5 100644 --- a/app/graphql/types/tree/blob_type.rb +++ b/app/graphql/types/tree/blob_type.rb @@ -10,14 +10,14 @@ module Types present_using BlobPresenter field :lfs_oid, GraphQL::Types::String, null: true, - calls_gitaly: true, - description: 'LFS ID of the blob.' + calls_gitaly: true, + description: 'LFS ID of the blob.' field :mode, GraphQL::Types::String, null: true, - description: 'Blob mode in numeric format.' + description: 'Blob mode in numeric format.' field :web_path, GraphQL::Types::String, null: true, - description: 'Web path of the blob.' + description: 'Web path of the blob.' field :web_url, GraphQL::Types::String, null: true, - description: 'Web URL of the blob.' + description: 'Web URL of the blob.' def lfs_oid Gitlab::Graphql::Loaders::BatchLfsOidLoader.new(object.repository, object.id).find diff --git a/app/graphql/types/tree/entry_type.rb b/app/graphql/types/tree/entry_type.rb index 1c612f91a5b..4b4119dcab9 100644 --- a/app/graphql/types/tree/entry_type.rb +++ b/app/graphql/types/tree/entry_type.rb @@ -5,17 +5,17 @@ module Types include Types::BaseInterface field :id, GraphQL::Types::ID, null: false, - description: 'ID of the entry.' + description: 'ID of the entry.' field :sha, GraphQL::Types::String, null: false, - description: 'Last commit SHA for the entry.', method: :id + description: 'Last commit SHA for the entry.', method: :id field :name, GraphQL::Types::String, null: false, - description: 'Name of the entry.' + description: 'Name of the entry.' field :type, Tree::TypeEnum, null: false, - description: 'Type of tree entry.' + description: 'Type of tree entry.' field :path, GraphQL::Types::String, null: false, - description: 'Path of the entry.' + description: 'Path of the entry.' field :flat_path, GraphQL::Types::String, null: false, - description: 'Flat path of the entry.' + description: 'Flat path of the entry.' end end end diff --git a/app/graphql/types/tree/submodule_type.rb b/app/graphql/types/tree/submodule_type.rb index 8f462011f0f..57597d9884c 100644 --- a/app/graphql/types/tree/submodule_type.rb +++ b/app/graphql/types/tree/submodule_type.rb @@ -9,9 +9,9 @@ module Types implements Types::Tree::EntryType field :tree_url, type: GraphQL::Types::String, null: true, - description: 'Tree URL for the sub-module.' + description: 'Tree URL for the sub-module.' field :web_url, type: GraphQL::Types::String, null: true, - description: 'Web URL for the sub-module.' + description: 'Web URL for the sub-module.' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/tree/tree_entry_type.rb b/app/graphql/types/tree/tree_entry_type.rb index 28024fd010b..1de78250812 100644 --- a/app/graphql/types/tree/tree_entry_type.rb +++ b/app/graphql/types/tree/tree_entry_type.rb @@ -11,9 +11,9 @@ module Types present_using TreeEntryPresenter field :web_path, GraphQL::Types::String, null: true, - description: 'Web path for the tree entry (directory).' + description: 'Web path for the tree entry (directory).' field :web_url, GraphQL::Types::String, null: true, - description: 'Web URL for the tree entry (directory).' + description: 'Web URL for the tree entry (directory).' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/tree/tree_type.rb b/app/graphql/types/tree/tree_type.rb index 011cff0c89c..51dc8cdb7bb 100644 --- a/app/graphql/types/tree/tree_type.rb +++ b/app/graphql/types/tree/tree_type.rb @@ -12,15 +12,15 @@ module Types description: 'Last commit for the tree.' field :trees, Types::Tree::TreeEntryType.connection_type, null: false, - description: 'Trees of the tree.' + description: 'Trees of the tree.' field :submodules, Types::Tree::SubmoduleType.connection_type, null: false, - description: 'Sub-modules of the tree.', - calls_gitaly: true + description: 'Sub-modules of the tree.', + calls_gitaly: true field :blobs, Types::Tree::BlobType.connection_type, null: false, - description: 'Blobs of the tree.', - calls_gitaly: true + description: 'Blobs of the tree.', + calls_gitaly: true def trees Gitlab::Graphql::Representation::TreeEntry.decorate(object.trees, object.repository) diff --git a/app/graphql/types/upload_type.rb b/app/graphql/types/upload_type.rb new file mode 100644 index 00000000000..0bb7f68cdba --- /dev/null +++ b/app/graphql/types/upload_type.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Types + class UploadType < BaseObject + graphql_name 'FileUpload' + + authorize :read_upload + + field :id, Types::GlobalIDType[::Upload], + null: false, + description: 'Global ID of the upload.' + field :path, GraphQL::Types::String, + null: false, + description: 'Path of the upload.' + field :size, GraphQL::Types::Int, + null: false, + description: 'Size of the upload in bytes.' + end +end diff --git a/app/graphql/types/user_callout_type.rb b/app/graphql/types/user_callout_type.rb index 526027322ef..f509900e91d 100644 --- a/app/graphql/types/user_callout_type.rb +++ b/app/graphql/types/user_callout_type.rb @@ -5,8 +5,8 @@ module Types graphql_name 'UserCallout' field :dismissed_at, Types::TimeType, null: true, - description: 'Date when the callout was dismissed.' + description: 'Date when the callout was dismissed.' field :feature_name, UserCalloutFeatureNameEnum, null: true, - description: 'Name of the feature that the callout is for.' + description: 'Name of the feature that the callout is for.' end end diff --git a/app/graphql/types/user_interface.rb b/app/graphql/types/user_interface.rb index edbc8aee9c5..f49b3eee4f5 100644 --- a/app/graphql/types/user_interface.rb +++ b/app/graphql/types/user_interface.rb @@ -122,13 +122,15 @@ module Types 'Will not return saved replies if `saved_replies` feature flag is disabled.' field :gitpod_enabled, GraphQL::Types::Boolean, null: true, - description: 'Whether Gitpod is enabled at the user level.' + description: 'Whether Gitpod is enabled at the user level.' - field :preferences_gitpod_path, GraphQL::Types::String, null: true, + field :preferences_gitpod_path, + GraphQL::Types::String, + null: true, description: 'Web path to the Gitpod section within user preferences.' field :profile_enable_gitpod_path, GraphQL::Types::String, null: true, - description: 'Web path to enable Gitpod for the user.' + description: 'Web path to enable Gitpod for the user.' definition_methods do def resolve_type(object, context) diff --git a/app/graphql/types/user_status_type.rb b/app/graphql/types/user_status_type.rb index 68c00bffe48..199c7d31083 100644 --- a/app/graphql/types/user_status_type.rb +++ b/app/graphql/types/user_status_type.rb @@ -6,12 +6,12 @@ module Types graphql_name 'UserStatus' markdown_field :message_html, null: true, - description: 'HTML of the user status message' + description: 'HTML of the user status message' field :availability, Types::AvailabilityEnum, null: false, - description: 'User availability status.' + description: 'User availability status.' field :emoji, GraphQL::Types::String, null: true, - description: 'String representation of emoji.' + description: 'String representation of emoji.' field :message, GraphQL::Types::String, null: true, - description: 'User status message.' + description: 'User status message.' end end diff --git a/app/graphql/types/work_item_type.rb b/app/graphql/types/work_item_type.rb index 18b9bfd1c9a..7904841863b 100644 --- a/app/graphql/types/work_item_type.rb +++ b/app/graphql/types/work_item_type.rb @@ -6,22 +6,37 @@ module Types authorize :read_work_item + field :closed_at, Types::TimeType, null: true, + description: 'Timestamp of when the work item was closed.' + field :confidential, GraphQL::Types::Boolean, null: false, + description: 'Indicates the work item is confidential.' + field :created_at, Types::TimeType, null: false, + description: 'Timestamp of when the work item was created.' field :description, GraphQL::Types::String, null: true, - description: 'Description of the work item.' + description: 'Description of the work item.' field :id, Types::GlobalIDType[::WorkItem], null: false, - description: 'Global ID of the work item.' + description: 'Global ID of the work item.' field :iid, GraphQL::Types::ID, null: false, - description: 'Internal ID of the work item.' - field :lock_version, GraphQL::Types::Int, null: false, + description: 'Internal ID of the work item.' + field :lock_version, + GraphQL::Types::Int, + null: false, description: 'Lock version of the work item. Incremented each time the work item is updated.' + field :project, Types::ProjectType, null: false, + description: 'Project the work item belongs to.', + alpha: { milestone: '15.3' } field :state, WorkItemStateEnum, null: false, - description: 'State of the work item.' + description: 'State of the work item.' field :title, GraphQL::Types::String, null: false, - description: 'Title of the work item.' - field :widgets, [Types::WorkItems::WidgetInterface], null: true, + description: 'Title of the work item.' + field :updated_at, Types::TimeType, null: false, + description: 'Timestamp of when the work item was last updated.' + field :widgets, + [Types::WorkItems::WidgetInterface], + null: true, description: 'Collection of widgets that belong to the work item.' field :work_item_type, Types::WorkItems::TypeType, null: false, - description: 'Type assigned to the work item.' + description: 'Type assigned to the work item.' markdown_field :title_html, null: true markdown_field :description_html, null: true diff --git a/app/graphql/types/work_items/type_type.rb b/app/graphql/types/work_items/type_type.rb index f31bd7ee9ba..4d008a21b9c 100644 --- a/app/graphql/types/work_items/type_type.rb +++ b/app/graphql/types/work_items/type_type.rb @@ -8,11 +8,11 @@ module Types authorize :read_work_item_type field :icon_name, GraphQL::Types::String, null: true, - description: 'Icon name of the work item type.' + description: 'Icon name of the work item type.' field :id, Types::GlobalIDType[::WorkItems::Type], null: false, - description: 'Global ID of the work item type.' + description: 'Global ID of the work item type.' field :name, GraphQL::Types::String, null: false, - description: 'Name of the work item type.' + description: 'Name of the work item type.' end end end diff --git a/app/graphql/types/work_items/widget_interface.rb b/app/graphql/types/work_items/widget_interface.rb index 1b752393296..eca8c8d845a 100644 --- a/app/graphql/types/work_items/widget_interface.rb +++ b/app/graphql/types/work_items/widget_interface.rb @@ -7,8 +7,21 @@ module Types graphql_name 'WorkItemWidget' - field :type, ::Types::WorkItems::WidgetTypeEnum, null: true, - description: 'Widget type.' + field :type, ::Types::WorkItems::WidgetTypeEnum, + null: true, + description: 'Widget type.' + + ORPHAN_TYPES = [ + ::Types::WorkItems::Widgets::DescriptionType, + ::Types::WorkItems::Widgets::HierarchyType, + ::Types::WorkItems::Widgets::LabelsType, + ::Types::WorkItems::Widgets::AssigneesType, + ::Types::WorkItems::Widgets::StartAndDueDateType + ].freeze + + def self.ce_orphan_types + ORPHAN_TYPES + end def self.resolve_type(object, context) case object @@ -18,17 +31,18 @@ module Types ::Types::WorkItems::Widgets::HierarchyType when ::WorkItems::Widgets::Assignees ::Types::WorkItems::Widgets::AssigneesType - when ::WorkItems::Widgets::Weight - ::Types::WorkItems::Widgets::WeightType + when ::WorkItems::Widgets::Labels + ::Types::WorkItems::Widgets::LabelsType + when ::WorkItems::Widgets::StartAndDueDate + ::Types::WorkItems::Widgets::StartAndDueDateType else raise "Unknown GraphQL type for widget #{object}" end end - orphan_types ::Types::WorkItems::Widgets::DescriptionType, - ::Types::WorkItems::Widgets::HierarchyType, - ::Types::WorkItems::Widgets::AssigneesType, - ::Types::WorkItems::Widgets::WeightType + orphan_types(*ORPHAN_TYPES) end end end + +Types::WorkItems::WidgetInterface.prepend_mod diff --git a/app/graphql/types/work_items/widgets/assignees_input_type.rb b/app/graphql/types/work_items/widgets/assignees_input_type.rb new file mode 100644 index 00000000000..ee61bc73054 --- /dev/null +++ b/app/graphql/types/work_items/widgets/assignees_input_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Types + module WorkItems + module Widgets + class AssigneesInputType < BaseInputObject + graphql_name 'WorkItemWidgetAssigneesInput' + + argument :assignee_ids, [::Types::GlobalIDType[::User]], + required: true, + description: 'Global IDs of assignees.', + prepare: ->(ids, _) { ids.map(&:model_id) } + end + end + end +end diff --git a/app/graphql/types/work_items/widgets/assignees_type.rb b/app/graphql/types/work_items/widgets/assignees_type.rb index 08ee06fdfa0..74da3264567 100644 --- a/app/graphql/types/work_items/widgets/assignees_type.rb +++ b/app/graphql/types/work_items/widgets/assignees_type.rb @@ -12,14 +12,17 @@ module Types implements Types::WorkItems::WidgetInterface - field :assignees, Types::UserType.connection_type, null: true, - description: 'Assignees of the work item.' + field :assignees, Types::UserType.connection_type, + null: true, + description: 'Assignees of the work item.' - field :allows_multiple_assignees, GraphQL::Types::Boolean, null: true, method: :allows_multiple_assignees?, - description: 'Indicates whether multiple assignees are allowed.' + field :allows_multiple_assignees, GraphQL::Types::Boolean, + null: true, method: :allows_multiple_assignees?, + description: 'Indicates whether multiple assignees are allowed.' - field :can_invite_members, GraphQL::Types::Boolean, null: false, resolver_method: :can_invite_members?, - description: 'Indicates whether the current user can invite members to the work item\'s project.' + field :can_invite_members, GraphQL::Types::Boolean, + null: false, resolver_method: :can_invite_members?, + description: 'Indicates whether the current user can invite members to the work item\'s project.' def can_invite_members? Ability.allowed?(current_user, :admin_project_member, object.work_item.project) diff --git a/app/graphql/types/work_items/widgets/description_type.rb b/app/graphql/types/work_items/widgets/description_type.rb index 79192d7c3d4..4c365a67bfd 100644 --- a/app/graphql/types/work_items/widgets/description_type.rb +++ b/app/graphql/types/work_items/widgets/description_type.rb @@ -12,8 +12,9 @@ module Types implements Types::WorkItems::WidgetInterface - field :description, GraphQL::Types::String, null: true, - description: 'Description of the work item.' + field :description, GraphQL::Types::String, + null: true, + description: 'Description of the work item.' markdown_field :description_html, null: true do |resolved_object| resolved_object.work_item diff --git a/app/graphql/types/work_items/widgets/hierarchy_type.rb b/app/graphql/types/work_items/widgets/hierarchy_type.rb index 057d5fbf056..0ccd8af7dc8 100644 --- a/app/graphql/types/work_items/widgets/hierarchy_type.rb +++ b/app/graphql/types/work_items/widgets/hierarchy_type.rb @@ -12,13 +12,13 @@ module Types implements Types::WorkItems::WidgetInterface - field :parent, ::Types::WorkItemType, null: true, - description: 'Parent work item.', - complexity: 5 + field :parent, ::Types::WorkItemType, + null: true, complexity: 5, + description: 'Parent work item.' - field :children, ::Types::WorkItemType.connection_type, null: true, - description: 'Child work items.', - complexity: 5 + field :children, ::Types::WorkItemType.connection_type, + null: true, complexity: 5, + description: 'Child work items.' def children object.children.inc_relations_for_permission_check diff --git a/app/graphql/types/work_items/widgets/labels_type.rb b/app/graphql/types/work_items/widgets/labels_type.rb new file mode 100644 index 00000000000..20574b3e3bc --- /dev/null +++ b/app/graphql/types/work_items/widgets/labels_type.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Types + module WorkItems + module Widgets + # Disabling widget level authorization as it might be too granular + # and we already authorize the parent work item + # rubocop:disable Graphql/AuthorizeTypes + class LabelsType < BaseObject + graphql_name 'WorkItemWidgetLabels' + description 'Represents the labels widget' + + implements Types::WorkItems::WidgetInterface + + field :labels, Types::LabelType.connection_type, + null: true, + description: 'Labels assigned to the work item.' + + field :allows_scoped_labels, GraphQL::Types::Boolean, + null: true, + method: :allows_scoped_labels?, + description: 'Indicates whether a scoped label is allowed.' + end + # rubocop:enable Graphql/AuthorizeTypes + end + end +end diff --git a/app/graphql/types/work_items/widgets/start_and_due_date_type.rb b/app/graphql/types/work_items/widgets/start_and_due_date_type.rb new file mode 100644 index 00000000000..d4dbc969937 --- /dev/null +++ b/app/graphql/types/work_items/widgets/start_and_due_date_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Types + module WorkItems + module Widgets + # Disabling widget level authorization as it might be too granular + # and we already authorize the parent work item + # rubocop:disable Graphql/AuthorizeTypes + class StartAndDueDateType < BaseObject + graphql_name 'WorkItemWidgetStartAndDueDate' + description 'Represents a start and due date widget' + + implements Types::WorkItems::WidgetInterface + + field :due_date, Types::DateType, + null: true, + description: 'Due date of the work item.' + field :start_date, Types::DateType, + null: true, + description: 'Start date of the work item.' + end + # rubocop:enable Graphql/AuthorizeTypes + end + end +end diff --git a/app/graphql/types/work_items/widgets/start_and_due_date_update_input_type.rb b/app/graphql/types/work_items/widgets/start_and_due_date_update_input_type.rb new file mode 100644 index 00000000000..bccd4afe8f3 --- /dev/null +++ b/app/graphql/types/work_items/widgets/start_and_due_date_update_input_type.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Types + module WorkItems + module Widgets + class StartAndDueDateUpdateInputType < BaseInputObject + graphql_name 'WorkItemWidgetStartAndDueDateUpdateInput' + + argument :due_date, Types::DateType, + required: false, + description: 'Due date for the work item.' + argument :start_date, Types::DateType, + required: false, + description: 'Start date for the work item.' + end + end + end +end diff --git a/app/graphql/types/work_items/widgets/weight_input_type.rb b/app/graphql/types/work_items/widgets/weight_input_type.rb deleted file mode 100644 index a01c63222a5..00000000000 --- a/app/graphql/types/work_items/widgets/weight_input_type.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Types - module WorkItems - module Widgets - class WeightInputType < BaseInputObject - graphql_name 'WorkItemWidgetWeightInput' - - argument :weight, GraphQL::Types::Int, - required: true, - description: 'Weight of the work item.' - end - end - end -end diff --git a/app/graphql/types/work_items/widgets/weight_type.rb b/app/graphql/types/work_items/widgets/weight_type.rb deleted file mode 100644 index c8eaf560268..00000000000 --- a/app/graphql/types/work_items/widgets/weight_type.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module Types - module WorkItems - module Widgets - # Disabling widget level authorization as it might be too granular - # and we already authorize the parent work item - # rubocop:disable Graphql/AuthorizeTypes - class WeightType < BaseObject - graphql_name 'WorkItemWidgetWeight' - description 'Represents a weight widget' - - implements Types::WorkItems::WidgetInterface - - field :weight, GraphQL::Types::Int, null: true, - description: 'Weight of the work item.' - end - # rubocop:enable Graphql/AuthorizeTypes - end - end -end |