diff options
Diffstat (limited to 'app/graphql')
99 files changed, 859 insertions, 183 deletions
diff --git a/app/graphql/mutations/admin/sidekiq_queues/delete_jobs.rb b/app/graphql/mutations/admin/sidekiq_queues/delete_jobs.rb index d943816089f..c4f91d0c15c 100644 --- a/app/graphql/mutations/admin/sidekiq_queues/delete_jobs.rb +++ b/app/graphql/mutations/admin/sidekiq_queues/delete_jobs.rb @@ -8,13 +8,18 @@ module Mutations ADMIN_MESSAGE = 'You must be an admin to use this mutation' - Gitlab::ApplicationContext::KNOWN_KEYS.each do |key| + ::Gitlab::ApplicationContext::KNOWN_KEYS.each do |key| argument key, GraphQL::Types::String, required: false, - description: "Delete jobs matching #{key} in the context metadata" + description: "Delete jobs matching #{key} in the context metadata." end + argument ::Gitlab::SidekiqQueue::WORKER_KEY, + GraphQL::Types::String, + required: false, + description: 'Delete jobs with the given worker class.' + argument :queue_name, GraphQL::Types::String, required: true, diff --git a/app/graphql/mutations/custom_emoji/destroy.rb b/app/graphql/mutations/custom_emoji/destroy.rb new file mode 100644 index 00000000000..863b8152cc7 --- /dev/null +++ b/app/graphql/mutations/custom_emoji/destroy.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Mutations + module CustomEmoji + class Destroy < BaseMutation + graphql_name 'DestroyCustomEmoji' + + authorize :delete_custom_emoji + + field :custom_emoji, + Types::CustomEmojiType, + null: true, + description: 'Deleted custom emoji.' + + argument :id, ::Types::GlobalIDType[::CustomEmoji], + required: true, + description: 'Global ID of the custom emoji to destroy.' + + def resolve(id:) + custom_emoji = authorized_find!(id: id) + + custom_emoji.destroy! + + { + custom_emoji: custom_emoji + } + end + + private + + def find_object(id:) + GitlabSchema.object_from_id(id, expected_type: ::CustomEmoji) + end + end + end +end diff --git a/app/graphql/mutations/customer_relations/organizations/create.rb b/app/graphql/mutations/customer_relations/organizations/create.rb new file mode 100644 index 00000000000..3fa7b0327ca --- /dev/null +++ b/app/graphql/mutations/customer_relations/organizations/create.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module Mutations + module CustomerRelations + module Organizations + class Create < BaseMutation + include ResolvesIds + include Gitlab::Graphql::Authorize::AuthorizeResource + + graphql_name 'CustomerRelationsOrganizationCreate' + + field :organization, + Types::CustomerRelations::OrganizationType, + null: true, + description: 'Organization after the mutation.' + + argument :group_id, ::Types::GlobalIDType[::Group], + required: true, + description: 'Group for the organization.' + + argument :name, + GraphQL::Types::String, + required: true, + description: 'Name of the organization.' + + argument :default_rate, + GraphQL::Types::Float, + required: false, + description: 'Standard billing rate for the organization.' + + argument :description, + GraphQL::Types::String, + required: false, + description: 'Description or notes for the organization.' + + authorize :admin_organization + + def resolve(args) + group = authorized_find!(id: args[:group_id]) + + raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless Feature.enabled?(:customer_relations, group, default_enabled: :yaml) + + result = ::CustomerRelations::Organizations::CreateService.new(group: group, current_user: current_user, params: args).execute + { organization: result.payload, errors: result.errors } + end + + def find_object(id:) + GitlabSchema.object_from_id(id, expected_type: ::Group) + end + end + end + end +end diff --git a/app/graphql/mutations/customer_relations/organizations/update.rb b/app/graphql/mutations/customer_relations/organizations/update.rb new file mode 100644 index 00000000000..c6ae62193f9 --- /dev/null +++ b/app/graphql/mutations/customer_relations/organizations/update.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +module Mutations + module CustomerRelations + module Organizations + class Update < Mutations::BaseMutation + include ResolvesIds + + graphql_name 'CustomerRelationsOrganizationUpdate' + + authorize :admin_organization + + field :organization, + Types::CustomerRelations::OrganizationType, + null: false, + description: 'Organization after the mutation.' + + argument :id, ::Types::GlobalIDType[::CustomerRelations::Organization], + required: true, + description: 'Global ID of the organization.' + + argument :name, + GraphQL::Types::String, + required: false, + description: 'Name of the organization.' + + argument :default_rate, + GraphQL::Types::Float, + required: false, + description: 'Standard billing rate for the organization.' + + argument :description, + GraphQL::Types::String, + required: false, + description: 'Description or notes for the organization.' + + def resolve(args) + organization = ::Gitlab::Graphql::Lazy.force(GitlabSchema.object_from_id(args.delete(:id), expected_type: ::CustomerRelations::Organization)) + raise_resource_not_available_error! unless organization + + group = organization.group + raise Gitlab::Graphql::Errors::ResourceNotAvailable, 'Feature disabled' unless Feature.enabled?(:customer_relations, group, default_enabled: :yaml) + + authorize!(group) + + result = ::CustomerRelations::Organizations::UpdateService.new(group: group, current_user: current_user, params: args).execute(organization) + { organization: result.payload, errors: result.errors } + end + end + end + end +end diff --git a/app/graphql/mutations/dependency_proxy/image_ttl_group_policy/update.rb b/app/graphql/mutations/dependency_proxy/image_ttl_group_policy/update.rb new file mode 100644 index 00000000000..a5eb114b2da --- /dev/null +++ b/app/graphql/mutations/dependency_proxy/image_ttl_group_policy/update.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module Mutations + module DependencyProxy + module ImageTtlGroupPolicy + class Update < Mutations::BaseMutation + include Mutations::ResolvesGroup + + graphql_name 'UpdateDependencyProxyImageTtlGroupPolicy' + + authorize :admin_dependency_proxy + + argument :group_path, + GraphQL::Types::ID, + required: true, + description: 'Group path for the group dependency proxy image TTL policy.' + + argument :enabled, + GraphQL::Types::Boolean, + required: false, + description: copy_field_description(Types::DependencyProxy::ImageTtlGroupPolicyType, :enabled) + + argument :ttl, + GraphQL::Types::Int, + required: false, + description: copy_field_description(Types::DependencyProxy::ImageTtlGroupPolicyType, :ttl) + + field :dependency_proxy_image_ttl_policy, + Types::DependencyProxy::ImageTtlGroupPolicyType, + null: true, + description: 'Group image TTL policy after mutation.' + + def resolve(group_path:, **args) + group = authorized_find!(group_path: group_path) + + result = ::DependencyProxy::ImageTtlGroupPolicies::UpdateService + .new(container: group, current_user: current_user, params: args) + .execute + + { + dependency_proxy_image_ttl_policy: result.payload[:dependency_proxy_image_ttl_policy], + errors: result.errors + } + end + + private + + def find_object(group_path:) + resolve_group(full_path: group_path) + end + end + end + end +end diff --git a/app/graphql/queries/repository/files.query.graphql b/app/graphql/queries/repository/files.query.graphql index 232d98a932c..a83880ce696 100644 --- a/app/graphql/queries/repository/files.query.graphql +++ b/app/graphql/queries/repository/files.query.graphql @@ -23,6 +23,7 @@ query getFiles( $nextPageCursor: String ) { project(fullPath: $projectPath) { + id __typename repository { __typename diff --git a/app/graphql/queries/repository/paginated_tree.query.graphql b/app/graphql/queries/repository/paginated_tree.query.graphql new file mode 100644 index 00000000000..e82bc6d0734 --- /dev/null +++ b/app/graphql/queries/repository/paginated_tree.query.graphql @@ -0,0 +1,54 @@ +fragment TreeEntry on Entry { + __typename + id + sha + name + flatPath + type +} + +query getPaginatedTree($projectPath: ID!, $path: String, $ref: String!, $nextPageCursor: String) { + project(fullPath: $projectPath) { + id + __typename + repository { + __typename + paginatedTree(path: $path, ref: $ref, after: $nextPageCursor) { + __typename + pageInfo { + __typename + endCursor + startCursor + hasNextPage + } + nodes { + __typename + trees { + __typename + nodes { + ...TreeEntry + webPath + } + } + submodules { + __typename + nodes { + ...TreeEntry + webUrl + treeUrl + } + } + blobs { + __typename + nodes { + ...TreeEntry + mode + webPath + lfsOid + } + } + } + } + } + } +} diff --git a/app/graphql/queries/repository/path_last_commit.query.graphql b/app/graphql/queries/repository/path_last_commit.query.graphql index d845f7c6224..b5c5f653429 100644 --- a/app/graphql/queries/repository/path_last_commit.query.graphql +++ b/app/graphql/queries/repository/path_last_commit.query.graphql @@ -1,5 +1,6 @@ query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) { project(fullPath: $projectPath) { + id __typename repository { __typename diff --git a/app/graphql/queries/repository/permissions.query.graphql b/app/graphql/queries/repository/permissions.query.graphql index c0262a882cd..6d2ae362e31 100644 --- a/app/graphql/queries/repository/permissions.query.graphql +++ b/app/graphql/queries/repository/permissions.query.graphql @@ -1,5 +1,6 @@ query getPermissions($projectPath: ID!) { project(fullPath: $projectPath) { + id __typename userPermissions { __typename diff --git a/app/graphql/resolvers/base_resolver.rb b/app/graphql/resolvers/base_resolver.rb index 48563633d11..20ed089d159 100644 --- a/app/graphql/resolvers/base_resolver.rb +++ b/app/graphql/resolvers/base_resolver.rb @@ -124,6 +124,16 @@ module Resolvers [args[:iid], args[:iids]].any? ? 0 : 0.01 end + def self.before_connection_authorization(&block) + @before_connection_authorization_block = block + end + + # rubocop: disable Style/TrivialAccessors + def self.before_connection_authorization_block + @before_connection_authorization_block + end + # rubocop: enable Style/TrivialAccessors + def offset_pagination(relation) ::Gitlab::Graphql::Pagination::OffsetPaginatedRelation.new(relation) end diff --git a/app/graphql/resolvers/board_list_issues_resolver.rb b/app/graphql/resolvers/board_list_issues_resolver.rb index 25fb35ec74b..7c85dd8fb9b 100644 --- a/app/graphql/resolvers/board_list_issues_resolver.rb +++ b/app/graphql/resolvers/board_list_issues_resolver.rb @@ -13,15 +13,29 @@ module Resolvers alias_method :list, :object def resolve(**args) - filter_params = item_filters(args[:filters]).merge(board_id: list.board.id, id: list.id) + filters = item_filters(args[:filters]) + mutually_exclusive_milestone_args!(filters) + + filter_params = filters.merge(board_id: list.board.id, id: list.id) service = ::Boards::Issues::ListService.new(list.board.resource_parent, context[:current_user], filter_params) + pagination_connections = Gitlab::Graphql::Pagination::Keyset::Connection.new(service.execute) + + ::Boards::Issues::ListService.initialize_relative_positions(list.board, current_user, pagination_connections.items) - service.execute + pagination_connections end # https://gitlab.com/gitlab-org/gitlab/-/issues/235681 def self.complexity_multiplier(args) 0.005 end + + private + + def mutually_exclusive_milestone_args!(filters) + if filters[:milestone_title] && filters[:milestone_wildcard_id] + raise ::Gitlab::Graphql::Errors::ArgumentError, 'Incompatible arguments: milestoneTitle, milestoneWildcardId.' + end + end end end diff --git a/app/graphql/resolvers/ci/group_runners_resolver.rb b/app/graphql/resolvers/ci/group_runners_resolver.rb new file mode 100644 index 00000000000..e9c399d3855 --- /dev/null +++ b/app/graphql/resolvers/ci/group_runners_resolver.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Resolvers + module Ci + class GroupRunnersResolver < RunnersResolver + type Types::Ci::RunnerType.connection_type, null: true + + argument :membership, ::Types::Ci::RunnerMembershipFilterEnum, + required: false, + default_value: :descendants, + description: 'Control which runners to include in the results.' + + protected + + def runners_finder_params(params) + super(params).merge(membership: params[:membership]) + end + + def parent_param + raise 'Expected group missing' unless parent.is_a?(Group) + + { group: parent } + end + end + end +end diff --git a/app/graphql/resolvers/ci/runners_resolver.rb b/app/graphql/resolvers/ci/runners_resolver.rb index 1957c4ec058..07105701daa 100644 --- a/app/graphql/resolvers/ci/runners_resolver.rb +++ b/app/graphql/resolvers/ci/runners_resolver.rb @@ -34,7 +34,7 @@ module Resolvers .execute) end - private + protected def runners_finder_params(params) { @@ -47,6 +47,19 @@ module Resolvers tag_name: node_selection&.selects?(:tag_list) } }.compact + .merge(parent_param) + end + + def parent_param + return {} unless parent + + raise "Unexpected parent type: #{parent.class}" + end + + private + + def parent + object.respond_to?(:sync) ? object.sync : object end end end diff --git a/app/graphql/resolvers/concerns/issue_resolver_arguments.rb b/app/graphql/resolvers/concerns/issue_resolver_arguments.rb index 8d77c0f3a8d..9de36b5b7d1 100644 --- a/app/graphql/resolvers/concerns/issue_resolver_arguments.rb +++ b/app/graphql/resolvers/concerns/issue_resolver_arguments.rb @@ -30,7 +30,7 @@ module IssueResolverArguments description: 'Usernames of users assigned to the issue.' argument :assignee_id, GraphQL::Types::String, required: false, - description: 'ID of a user assigned to the issues, "none" and "any" values are supported.' + description: 'ID of a user assigned to the issues. Wildcard values "NONE" and "ANY" are supported.' argument :created_before, Types::TimeType, required: false, description: 'Issues created before this date.' @@ -59,6 +59,9 @@ module IssueResolverArguments argument :milestone_wildcard_id, ::Types::MilestoneWildcardIdEnum, required: false, description: 'Filter issues by milestone ID wildcard.' + argument :my_reaction_emoji, GraphQL::Types::String, + required: false, + description: 'Filter by reaction emoji applied by the current user. Wildcard values "NONE" and "ANY" are supported.' argument :not, Types::Issues::NegatedIssueFilterInputType, description: 'Negated arguments.', prepare: ->(negated_args, ctx) { negated_args.to_h }, diff --git a/app/graphql/resolvers/concerns/resolves_pipelines.rb b/app/graphql/resolvers/concerns/resolves_pipelines.rb index 77f2105db7c..7fb0852b11e 100644 --- a/app/graphql/resolvers/concerns/resolves_pipelines.rb +++ b/app/graphql/resolvers/concerns/resolves_pipelines.rb @@ -17,6 +17,11 @@ module ResolvesPipelines GraphQL::Types::String, required: false, description: "Filter pipelines by the sha of the commit they are run for." + + argument :source, + GraphQL::Types::String, + required: false, + description: "Filter pipelines by their source. Will be ignored if `dast_view_scans` feature flag is disabled." end class_methods do @@ -30,6 +35,8 @@ module ResolvesPipelines end def resolve_pipelines(project, params = {}) + params.delete(:source) unless Feature.enabled?(:dast_view_scans, project, default_enabled: :yaml) + Ci::PipelinesFinder.new(project, context[:current_user], params).execute end end diff --git a/app/graphql/resolvers/labels_resolver.rb b/app/graphql/resolvers/labels_resolver.rb index 505d1dff8d2..f0e099e8fb2 100644 --- a/app/graphql/resolvers/labels_resolver.rb +++ b/app/graphql/resolvers/labels_resolver.rb @@ -10,7 +10,7 @@ module Resolvers argument :search_term, GraphQL::Types::String, required: false, - description: 'A search term to find labels with.' + description: 'Search term to find labels with.' argument :include_ancestor_groups, GraphQL::Types::Boolean, required: false, diff --git a/app/graphql/resolvers/merge_requests_resolver.rb b/app/graphql/resolvers/merge_requests_resolver.rb index 8f2c7847a2e..c0dd61078c6 100644 --- a/app/graphql/resolvers/merge_requests_resolver.rb +++ b/app/graphql/resolvers/merge_requests_resolver.rb @@ -49,7 +49,7 @@ module Resolvers argument :state, ::Types::MergeRequestStateEnum, required: false, - description: 'A merge request state. If provided, all resolved merge requests will have this state.' + description: 'Merge request state. If provided, all resolved merge requests will have this state.' argument :labels, [GraphQL::Types::String], required: false, diff --git a/app/graphql/resolvers/milestones_resolver.rb b/app/graphql/resolvers/milestones_resolver.rb index 84f7d66ec19..dc6d781f584 100644 --- a/app/graphql/resolvers/milestones_resolver.rb +++ b/app/graphql/resolvers/milestones_resolver.rb @@ -15,15 +15,15 @@ module Resolvers argument :title, GraphQL::Types::String, required: false, - description: 'The title of the milestone.' + description: 'Title of the milestone.' argument :search_title, GraphQL::Types::String, required: false, - description: 'A search string for the title.' + description: 'Search string for the title.' argument :containing_date, Types::TimeType, required: false, - description: 'A date that the milestone contains.' + description: 'Date the milestone contains.' argument :sort, Types::MilestoneSortEnum, description: 'Sort milestones by this criteria.', diff --git a/app/graphql/resolvers/package_details_resolver.rb b/app/graphql/resolvers/package_details_resolver.rb index 89d79747732..42cb23e701d 100644 --- a/app/graphql/resolvers/package_details_resolver.rb +++ b/app/graphql/resolvers/package_details_resolver.rb @@ -6,7 +6,7 @@ module Resolvers argument :id, ::Types::GlobalIDType[::Packages::Package], required: true, - description: 'The global ID of the package.' + description: 'Global ID of the package.' def ready?(**args) context[self.class] ||= { executions: 0 } diff --git a/app/graphql/resolvers/paginated_tree_resolver.rb b/app/graphql/resolvers/paginated_tree_resolver.rb index d1b4e75169c..6c0545d26de 100644 --- a/app/graphql/resolvers/paginated_tree_resolver.rb +++ b/app/graphql/resolvers/paginated_tree_resolver.rb @@ -10,11 +10,11 @@ module Resolvers argument :path, GraphQL::Types::String, required: false, default_value: '', # root of the repository - description: 'The path to get the tree for. Default value is the root of the repository.' + description: 'Path to get the tree for. Default value is the root of the repository.' argument :ref, GraphQL::Types::String, required: false, default_value: :head, - description: 'The commit ref to get the tree for. Default value is HEAD.' + description: 'Commit ref to get the tree for. Default value is HEAD.' argument :recursive, GraphQL::Types::Boolean, required: false, default_value: false, diff --git a/app/graphql/resolvers/release_resolver.rb b/app/graphql/resolvers/release_resolver.rb index 0374a1103de..82b5647615e 100644 --- a/app/graphql/resolvers/release_resolver.rb +++ b/app/graphql/resolvers/release_resolver.rb @@ -6,7 +6,7 @@ module Resolvers argument :tag_name, GraphQL::Types::String, required: true, - description: 'The name of the tag associated to the release.' + description: 'Name of the tag associated to the release.' alias_method :project, :object diff --git a/app/graphql/resolvers/repository_branch_names_resolver.rb b/app/graphql/resolvers/repository_branch_names_resolver.rb index e9aacda2652..96550bce32f 100644 --- a/app/graphql/resolvers/repository_branch_names_resolver.rb +++ b/app/graphql/resolvers/repository_branch_names_resolver.rb @@ -8,15 +8,15 @@ module Resolvers argument :search_pattern, GraphQL::Types::String, required: true, - description: 'The pattern to search for branch names by.' + description: 'Pattern to search for branch names by.' argument :offset, GraphQL::Types::Int, required: true, - description: 'The number of branch names to skip.' + description: 'Number of branch names to skip.' argument :limit, GraphQL::Types::Int, required: true, - description: 'The number of branch names to return.' + description: 'Number of branch names to return.' def resolve(search_pattern:, offset:, limit:) Repositories::BranchNamesFinder.new(object, offset: offset, limit: limit, search: search_pattern).execute diff --git a/app/graphql/resolvers/snippets_resolver.rb b/app/graphql/resolvers/snippets_resolver.rb index 7d18c9c6fea..149bd8fa1ce 100644 --- a/app/graphql/resolvers/snippets_resolver.rb +++ b/app/graphql/resolvers/snippets_resolver.rb @@ -12,15 +12,15 @@ module Resolvers argument :author_id, ::Types::GlobalIDType[::User], required: false, - description: 'The ID of an author.' + description: 'ID of an author.' argument :project_id, ::Types::GlobalIDType[::Project], required: false, - description: 'The ID of a project.' + description: 'ID of a project.' argument :type, Types::Snippets::TypeEnum, required: false, - description: 'The type of snippet.' + description: 'Type of snippet.' argument :explore, GraphQL::Types::Boolean, diff --git a/app/graphql/resolvers/todo_resolver.rb b/app/graphql/resolvers/todo_resolver.rb index 263b190c74e..f0be1b6e9a5 100644 --- a/app/graphql/resolvers/todo_resolver.rb +++ b/app/graphql/resolvers/todo_resolver.rb @@ -8,27 +8,34 @@ module Resolvers argument :action, [Types::TodoActionEnum], required: false, - description: 'The action to be filtered.' + description: 'Action to be filtered.' argument :author_id, [GraphQL::Types::ID], required: false, - description: 'The ID of an author.' + description: 'ID of an author.' argument :project_id, [GraphQL::Types::ID], required: false, - description: 'The ID of a project.' + description: 'ID of a project.' argument :group_id, [GraphQL::Types::ID], required: false, - description: 'The ID of a group.' + description: 'ID of a group.' argument :state, [Types::TodoStateEnum], required: false, - description: 'The state of the todo.' + description: 'State of the todo.' argument :type, [Types::TodoTargetEnum], required: false, - description: 'The type of the todo.' + description: 'Type of the todo.' + + before_connection_authorization do |nodes, current_user| + Preloaders::UserMaxAccessLevelInProjectsPreloader.new( + nodes.map(&:project).compact, + current_user + ).execute + end def resolve(**args) return Todo.none unless current_user.present? && target.present? diff --git a/app/graphql/resolvers/tree_resolver.rb b/app/graphql/resolvers/tree_resolver.rb index 70b4d81845c..8d6ece0956e 100644 --- a/app/graphql/resolvers/tree_resolver.rb +++ b/app/graphql/resolvers/tree_resolver.rb @@ -9,11 +9,11 @@ module Resolvers argument :path, GraphQL::Types::String, required: false, default_value: '', - description: 'The path to get the tree for. Default value is the root of the repository.' + description: 'Path to get the tree for. Default value is the root of the repository.' argument :ref, GraphQL::Types::String, required: false, default_value: :head, - description: 'The commit ref to get the tree for. Default value is HEAD.' + description: 'Commit ref to get the tree for. Default value is HEAD.' argument :recursive, GraphQL::Types::Boolean, required: false, default_value: false, diff --git a/app/graphql/resolvers/users/groups_resolver.rb b/app/graphql/resolvers/users/groups_resolver.rb new file mode 100644 index 00000000000..0899b08e19c --- /dev/null +++ b/app/graphql/resolvers/users/groups_resolver.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module Resolvers + module Users + class GroupsResolver < BaseResolver + include Gitlab::Graphql::Authorize::AuthorizeResource + include LooksAhead + + type Types::GroupType.connection_type, null: true + + authorize :read_user_groups + authorizes_object! + + argument :search, GraphQL::Types::String, + required: false, + description: 'Search by group name or path.' + argument :permission_scope, + ::Types::PermissionTypes::GroupEnum, + required: false, + description: 'Filter by permissions the user has on groups.' + + before_connection_authorization do |nodes, current_user| + Preloaders::UserMaxAccessLevelInGroupsPreloader.new(nodes, current_user).execute + end + + def resolve_with_lookahead(**args) + return unless Feature.enabled?(:paginatable_namespace_drop_down_for_project_creation, current_user, default_enabled: :yaml) + + apply_lookahead(Groups::UserGroupsFinder.new(current_user, object, args).execute) + end + + private + + def preloads + { + path: [:route], + full_path: [:route] + } + end + end + end +end + +Resolvers::Users::GroupsResolver.prepend_mod_with('Resolvers::Users::GroupsResolver') diff --git a/app/graphql/resolvers/users/snippets_resolver.rb b/app/graphql/resolvers/users/snippets_resolver.rb index ee1727aadbe..75bba8debab 100644 --- a/app/graphql/resolvers/users/snippets_resolver.rb +++ b/app/graphql/resolvers/users/snippets_resolver.rb @@ -11,7 +11,7 @@ module Resolvers argument :type, Types::Snippets::TypeEnum, required: false, - description: 'The type of snippet.' + description: 'Type of snippet.' private 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 c54c938402d..8276549ddcc 100644 --- a/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb +++ b/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb @@ -12,13 +12,13 @@ module Types authorize :read_usage_trends_measurement field :recorded_at, Types::TimeType, null: true, - description: 'The time the measurement was recorded.' + description: 'Time the measurement was recorded.' field :count, GraphQL::Types::Int, null: false, description: 'Object count.' field :identifier, Types::Admin::Analytics::UsageTrends::MeasurementIdentifierEnum, null: false, - description: 'The type of objects being measured.' + description: 'Type of objects being measured.' end end end diff --git a/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb b/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb index cc6e3db007b..4f31e2f783a 100644 --- a/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb +++ b/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb @@ -17,12 +17,12 @@ module Types field :deleted_jobs, GraphQL::Types::Int, null: true, - description: 'The number of matching jobs deleted.' + description: 'Number of matching jobs deleted.' field :queue_size, GraphQL::Types::Int, null: true, - description: 'The queue size after processing.' + description: 'Queue size after processing.' end end end diff --git a/app/graphql/types/alert_management/alert_type.rb b/app/graphql/types/alert_management/alert_type.rb index bdfdd2c5886..7495d46179c 100644 --- a/app/graphql/types/alert_management/alert_type.rb +++ b/app/graphql/types/alert_management/alert_type.rb @@ -115,19 +115,17 @@ module Types null: true, description: 'Runbook for the alert as defined in alert details.' - field :todos, description: 'To-do items of the current user for the alert.', resolver: Resolvers::TodoResolver do - extension(::Gitlab::Graphql::TodosProjectPermissionPreloader::FieldExtension) - end + field :todos, description: 'To-do items of the current user for the alert.', resolver: Resolvers::TodoResolver field :details_url, GraphQL::Types::String, null: false, - description: 'The URL of the alert detail page.' + description: 'URL of the alert detail page.' field :prometheus_alert, Types::PrometheusAlertType, null: true, - description: 'The alert condition for Prometheus.' + description: 'Alert condition for Prometheus.' def notes object.ordered_notes diff --git a/app/graphql/types/award_emojis/award_emoji_type.rb b/app/graphql/types/award_emojis/award_emoji_type.rb index 1f6f0badcac..76415afc6c1 100644 --- a/app/graphql/types/award_emojis/award_emoji_type.rb +++ b/app/graphql/types/award_emojis/award_emoji_type.rb @@ -13,32 +13,32 @@ module Types field :name, GraphQL::Types::String, null: false, - description: 'The emoji name.' + description: 'Emoji name.' field :description, GraphQL::Types::String, null: false, - description: 'The emoji description.' + description: 'Emoji description.' field :unicode, GraphQL::Types::String, null: false, - description: 'The emoji in Unicode.' + description: 'Emoji in Unicode.' field :emoji, GraphQL::Types::String, null: false, - description: 'The emoji as an icon.' + description: 'Emoji as an icon.' field :unicode_version, GraphQL::Types::String, null: false, - description: 'The Unicode version for this emoji.' + description: 'Unicode version for this emoji.' field :user, Types::UserType, null: false, - description: 'The user who awarded the emoji.' + description: 'User who awarded the emoji.' def user Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.user_id).find diff --git a/app/graphql/types/base_field.rb b/app/graphql/types/base_field.rb index 75fdb41ceb6..9c27f0f8138 100644 --- a/app/graphql/types/base_field.rb +++ b/app/graphql/types/base_field.rb @@ -9,6 +9,7 @@ module Types DEFAULT_COMPLEXITY = 1 attr_reader :deprecation, :doc_reference + attr_writer :max_page_size # Can be removed with :performance_roadmap feature flag: https://gitlab.com/gitlab-org/gitlab/-/issues/337198 def initialize(**kwargs, &block) @calls_gitaly = !!kwargs.delete(:calls_gitaly) diff --git a/app/graphql/types/boards/board_issuable_input_base_type.rb b/app/graphql/types/boards/board_issuable_input_base_type.rb index 326f73846d0..81dd21aebec 100644 --- a/app/graphql/types/boards/board_issuable_input_base_type.rb +++ b/app/graphql/types/boards/board_issuable_input_base_type.rb @@ -14,7 +14,7 @@ module Types argument :my_reaction_emoji, GraphQL::Types::String, required: false, - description: 'Filter by reaction emoji applied by the current user.' + description: 'Filter by reaction emoji applied by the current user. Wildcard values "NONE" and "ANY" are supported.' end end end diff --git a/app/graphql/types/boards/board_issue_input_base_type.rb b/app/graphql/types/boards/board_issue_input_base_type.rb index 82db1802b81..e12ed32a250 100644 --- a/app/graphql/types/boards/board_issue_input_base_type.rb +++ b/app/graphql/types/boards/board_issue_input_base_type.rb @@ -24,6 +24,10 @@ module Types as: :issue_types, description: 'Filter by the given issue types.', required: false + + argument :milestone_wildcard_id, ::Types::MilestoneWildcardIdEnum, + required: false, + description: 'Filter by milestone ID wildcard.' 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 891ba18dacc..8cf0e210def 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: 'The 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/status_enum.rb b/app/graphql/types/ci/config/status_enum.rb index 1ba207531b8..dbb560c93c3 100644 --- a/app/graphql/types/ci/config/status_enum.rb +++ b/app/graphql/types/ci/config/status_enum.rb @@ -7,8 +7,8 @@ module Types graphql_name 'CiConfigStatus' description 'Values for YAML processor result' - value 'VALID', 'The configuration file is valid.', value: :valid - value 'INVALID', 'The configuration file is not valid.', value: :invalid + value 'VALID', 'Configuration file is valid.', value: :valid + value 'INVALID', 'Configuration file is not valid.', value: :invalid end end end diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 4a3518e1865..48bd91bfc5b 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -2,9 +2,10 @@ module Types module Ci + # rubocop: disable Graphql/AuthorizeTypes + # The permission is presented through `StageType` that has its own authorization class JobType < BaseObject graphql_name 'CiJob' - authorize :read_commit_status connection_type_class(Types::CountableConnectionType) diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index 0375257eb7b..493ce188d9b 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -97,7 +97,7 @@ module Types type: ::Types::Ci::JobType, null: true, authorize: :read_commit_status, - description: 'A specific job in this pipeline, either by name or ID.' do + description: 'Specific job in this pipeline, either by name or ID.' do argument :id, type: ::Types::GlobalIDType[::CommitStatus], required: false, diff --git a/app/graphql/types/ci/runner_membership_filter_enum.rb b/app/graphql/types/ci/runner_membership_filter_enum.rb new file mode 100644 index 00000000000..2e1051b2151 --- /dev/null +++ b/app/graphql/types/ci/runner_membership_filter_enum.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Types + module Ci + class RunnerMembershipFilterEnum < BaseEnum + graphql_name 'RunnerMembershipFilter' + description 'Values for filtering runners in namespaces.' + + value 'DIRECT', + description: "Include runners that have a direct relationship.", + value: :direct + + value 'DESCENDANTS', + description: "Include runners that have either a direct relationship or a relationship with descendants. These can be project runners or group runners (in the case where group is queried).", + value: :descendants + end + end +end diff --git a/app/graphql/types/ci/stage_type.rb b/app/graphql/types/ci/stage_type.rb index 63357e2345b..c0d931b3d31 100644 --- a/app/graphql/types/ci/stage_type.rb +++ b/app/graphql/types/ci/stage_type.rb @@ -15,9 +15,8 @@ module Types description: 'Group of jobs for the stage.' field :detailed_status, Types::Ci::DetailedStatusType, null: true, description: 'Detailed status of the stage.' - field :jobs, Ci::JobType.connection_type, null: true, - description: 'Jobs for the stage.', - method: 'latest_statuses' + field :jobs, Types::Ci::JobType.connection_type, null: true, + description: 'Jobs for the stage.' field :status, GraphQL::Types::String, null: true, description: 'Status of the pipeline stage.' @@ -48,19 +47,25 @@ module Types end end + def jobs + GraphQL::Pagination::ActiveRecordRelationConnection.new( + object.latest_statuses, + max_page_size: Gitlab::CurrentSettings.current_application_settings.jobs_per_stage_page_size + ) + end + private # rubocop: disable CodeReuse/ActiveRecord def jobs_for_pipeline(pipeline, stage_ids, include_needs) - builds_results = pipeline.latest_builds.where(stage_id: stage_ids).preload(:job_artifacts, :project) - bridges_results = pipeline.bridges.where(stage_id: stage_ids).preload(:project) - builds_results = builds_results.preload(:needs) if include_needs - bridges_results = bridges_results.preload(:needs) if include_needs - commit_status_results = pipeline.latest_statuses.where(stage_id: stage_ids) + jobs = pipeline.statuses.latest.where(stage_id: stage_ids) + + preloaded_relations = [:project, :metadata, :job_artifacts, :downstream_pipeline] + preloaded_relations << :needs if include_needs - results = builds_results | bridges_results | commit_status_results + Preloaders::CommitStatusPreloader.new(jobs).execute(preloaded_relations) - results.group_by(&:stage_id) + jobs.group_by(&:stage_id) end # rubocop: enable CodeReuse/ActiveRecord end diff --git a/app/graphql/types/ci_configuration/sast/ui_component_size_enum.rb b/app/graphql/types/ci_configuration/sast/ui_component_size_enum.rb index 76d2a314c13..62bd3e9b2ca 100644 --- a/app/graphql/types/ci_configuration/sast/ui_component_size_enum.rb +++ b/app/graphql/types/ci_configuration/sast/ui_component_size_enum.rb @@ -7,9 +7,9 @@ module Types graphql_name 'SastUiComponentSize' description 'Size of UI component in SAST configuration page' - value 'SMALL', description: "The size of UI component in SAST configuration page is small." - value 'MEDIUM', description: "The size of UI component in SAST configuration page is medium." - value 'LARGE', description: "The size of UI component in SAST configuration page is large." + value 'SMALL', description: "Size of UI component in SAST configuration page is small." + value 'MEDIUM', description: "Size of UI component in SAST configuration page is medium." + value 'LARGE', description: "Size of UI component in SAST configuration page is large." end end end diff --git a/app/graphql/types/commit_action_type.rb b/app/graphql/types/commit_action_type.rb index b170134b388..6f6d6a418dc 100644 --- a/app/graphql/types/commit_action_type.rb +++ b/app/graphql/types/commit_action_type.rb @@ -3,7 +3,7 @@ module Types class CommitActionType < BaseInputObject argument :action, type: Types::CommitActionModeEnum, required: true, - description: 'The action to perform, create, delete, move, update, chmod.' + description: 'Action to perform: create, delete, move, update, or chmod.' argument :file_path, type: GraphQL::Types::String, required: true, description: 'Full path to the file.' argument :content, type: GraphQL::Types::String, required: false, diff --git a/app/graphql/types/container_repository_cleanup_status_enum.rb b/app/graphql/types/container_repository_cleanup_status_enum.rb index 6e654e65360..e9ccb8adec8 100644 --- a/app/graphql/types/container_repository_cleanup_status_enum.rb +++ b/app/graphql/types/container_repository_cleanup_status_enum.rb @@ -5,9 +5,9 @@ module Types graphql_name 'ContainerRepositoryCleanupStatus' description 'Status of the tags cleanup of a container repository' - value 'UNSCHEDULED', value: 'cleanup_unscheduled', description: 'The tags cleanup is not scheduled. This is the default state.' - value 'SCHEDULED', value: 'cleanup_scheduled', description: 'The tags cleanup is scheduled and is going to be executed shortly.' - value 'UNFINISHED', value: 'cleanup_unfinished', description: 'The tags cleanup has been partially executed. There are still remaining tags to delete.' - value 'ONGOING', value: 'cleanup_ongoing', description: 'The tags cleanup is ongoing.' + value 'UNSCHEDULED', value: 'cleanup_unscheduled', description: 'Tags cleanup is not scheduled. This is the default state.' + value 'SCHEDULED', value: 'cleanup_scheduled', description: 'Tags cleanup is scheduled and is going to be executed shortly.' + value 'UNFINISHED', value: 'cleanup_unfinished', description: 'Tags cleanup has been partially executed. There are still remaining tags to delete.' + value 'ONGOING', value: 'cleanup_ongoing', description: 'Tags cleanup is ongoing.' end end diff --git a/app/graphql/types/container_repository_tag_type.rb b/app/graphql/types/container_repository_tag_type.rb index b6b65bce421..206d6a3426c 100644 --- a/app/graphql/types/container_repository_tag_type.rb +++ b/app/graphql/types/container_repository_tag_type.rb @@ -14,7 +14,7 @@ module Types field :digest, GraphQL::Types::String, null: true, description: 'Digest of the tag.' field :revision, GraphQL::Types::String, null: true, description: 'Revision of the tag.' field :short_revision, GraphQL::Types::String, null: true, description: 'Short revision of the tag.' - field :total_size, GraphQL::Types::BigInt, null: true, description: 'The size of the tag.' + field :total_size, GraphQL::Types::BigInt, null: true, description: 'Size of the tag.' field :created_at, Types::TimeType, null: true, description: 'Timestamp when the tag was created.' field :can_delete, GraphQL::Types::Boolean, null: false, description: 'Can the current user delete this tag.' diff --git a/app/graphql/types/container_repository_type.rb b/app/graphql/types/container_repository_type.rb index 91a65053131..67093f57862 100644 --- a/app/graphql/types/container_repository_type.rb +++ b/app/graphql/types/container_repository_type.rb @@ -15,7 +15,7 @@ module Types field :created_at, Types::TimeType, null: false, description: 'Timestamp when the container repository was created.' field :updated_at, Types::TimeType, null: false, description: 'Timestamp when the container repository was updated.' field :expiration_policy_started_at, Types::TimeType, null: true, description: 'Timestamp when the cleanup done by the expiration policy was started on the container repository.' - field :expiration_policy_cleanup_status, Types::ContainerRepositoryCleanupStatusEnum, null: true, description: 'The tags cleanup status for the container repository.' + field :expiration_policy_cleanup_status, Types::ContainerRepositoryCleanupStatusEnum, null: true, description: 'Tags cleanup status for the container repository.' field :status, Types::ContainerRepositoryStatusEnum, null: true, description: 'Status of the container repository.' field :tags_count, GraphQL::Types::Int, null: false, description: 'Number of tags associated with this image.' field :can_delete, GraphQL::Types::Boolean, null: false, description: 'Can the current user delete the container repository.' diff --git a/app/graphql/types/custom_emoji_type.rb b/app/graphql/types/custom_emoji_type.rb index 64381b3ee1e..379a0c44d67 100644 --- a/app/graphql/types/custom_emoji_type.rb +++ b/app/graphql/types/custom_emoji_type.rb @@ -9,16 +9,16 @@ module Types field :id, ::Types::GlobalIDType[::CustomEmoji], null: false, - description: 'The ID of the emoji.' + description: 'ID of the emoji.' field :name, GraphQL::Types::String, null: false, - description: 'The name of the emoji.' + description: 'Name of the emoji.' field :url, GraphQL::Types::String, null: false, method: :file, - description: 'The link to file of the emoji.' + description: 'Link to file of the emoji.' field :external, GraphQL::Types::Boolean, null: false, diff --git a/app/graphql/types/customer_relations/contact_type.rb b/app/graphql/types/customer_relations/contact_type.rb new file mode 100644 index 00000000000..35b5bf45698 --- /dev/null +++ b/app/graphql/types/customer_relations/contact_type.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module Types + module CustomerRelations + class ContactType < BaseObject + graphql_name 'CustomerRelationsContact' + + authorize :read_contact + + field :id, + GraphQL::Types::ID, + null: false, + description: 'Internal ID of the contact.' + + field :organization, Types::CustomerRelations::OrganizationType, + null: true, + description: "Organization of the contact." + + field :first_name, + GraphQL::Types::String, + null: false, + description: 'First name of the contact.' + + field :last_name, + GraphQL::Types::String, + null: false, + description: 'Last name of the contact.' + + field :phone, + GraphQL::Types::String, + null: true, + description: 'Phone number of the contact.' + + field :email, + GraphQL::Types::String, + null: true, + description: 'Email address of the contact.' + + field :description, + GraphQL::Types::String, + null: true, + description: 'Description or notes for the contact.' + + field :created_at, + Types::TimeType, + null: false, + description: 'Timestamp the contact was created.' + + field :updated_at, + Types::TimeType, + null: false, + description: 'Timestamp the contact was last updated.' + end + end +end diff --git a/app/graphql/types/customer_relations/organization_type.rb b/app/graphql/types/customer_relations/organization_type.rb new file mode 100644 index 00000000000..0e091d4a9a3 --- /dev/null +++ b/app/graphql/types/customer_relations/organization_type.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module Types + module CustomerRelations + class OrganizationType < BaseObject + graphql_name 'CustomerRelationsOrganization' + + authorize :read_organization + + field :id, + GraphQL::Types::ID, + null: false, + description: 'Internal ID of the organization.' + + field :name, + GraphQL::Types::String, + null: false, + description: 'Name of the organization.' + + field :default_rate, + GraphQL::Types::Float, + null: true, + description: 'Standard billing rate for the organization.' + + field :description, + GraphQL::Types::String, + null: true, + description: 'Description or notes for the organization.' + + field :created_at, + Types::TimeType, + null: false, + description: 'Timestamp the organization was created.' + + field :updated_at, + Types::TimeType, + null: false, + description: 'Timestamp the organization was last updated.' + end + end +end diff --git a/app/graphql/types/dependency_proxy/blob_type.rb b/app/graphql/types/dependency_proxy/blob_type.rb new file mode 100644 index 00000000000..f5a78fbb3ba --- /dev/null +++ b/app/graphql/types/dependency_proxy/blob_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Types + class DependencyProxy::BlobType < BaseObject + graphql_name 'DependencyProxyBlob' + + description 'Dependency proxy blob' + + authorize :read_dependency_proxy + + field :created_at, Types::TimeType, null: false, description: 'Date of creation.' + field :updated_at, Types::TimeType, null: false, description: 'Date of most recent update.' + field :file_name, GraphQL::Types::String, null: false, description: 'Name of the blob.' + field :size, GraphQL::Types::String, null: false, description: 'Size of the blob file.' + end +end diff --git a/app/graphql/types/dependency_proxy/group_setting_type.rb b/app/graphql/types/dependency_proxy/group_setting_type.rb new file mode 100644 index 00000000000..8b8b8572aa9 --- /dev/null +++ b/app/graphql/types/dependency_proxy/group_setting_type.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Types + class DependencyProxy::GroupSettingType < BaseObject + graphql_name 'DependencyProxySetting' + + description 'Group-level Dependency Proxy settings' + + authorize :read_dependency_proxy + + field :enabled, GraphQL::Types::Boolean, null: false, description: 'Indicates whether the dependency proxy is enabled for the group.' + end +end diff --git a/app/graphql/types/dependency_proxy/image_ttl_group_policy_type.rb b/app/graphql/types/dependency_proxy/image_ttl_group_policy_type.rb new file mode 100644 index 00000000000..29bba7122d0 --- /dev/null +++ b/app/graphql/types/dependency_proxy/image_ttl_group_policy_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Types + class DependencyProxy::ImageTtlGroupPolicyType < BaseObject + graphql_name 'DependencyProxyImageTtlGroupPolicy' + + description 'Group-level Dependency Proxy TTL policy settings' + + authorize :read_dependency_proxy + + field :enabled, GraphQL::Types::Boolean, null: false, description: 'Indicates whether the policy is enabled or disabled.' + field :ttl, GraphQL::Types::Int, null: true, description: 'Number of days to retain a cached image file.' + field :created_at, Types::TimeType, null: true, description: 'Timestamp of creation.' + field :updated_at, Types::TimeType, null: true, description: 'Timestamp of the most recent update.' + end +end diff --git a/app/graphql/types/dependency_proxy/manifest_type.rb b/app/graphql/types/dependency_proxy/manifest_type.rb new file mode 100644 index 00000000000..9aa62266ef7 --- /dev/null +++ b/app/graphql/types/dependency_proxy/manifest_type.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Types + class DependencyProxy::ManifestType < BaseObject + graphql_name 'DependencyProxyManifest' + + description 'Dependency proxy manifest' + + authorize :read_dependency_proxy + + field :created_at, Types::TimeType, null: false, description: 'Date of creation.' + field :updated_at, Types::TimeType, null: false, description: 'Date of most recent update.' + field :file_name, GraphQL::Types::String, null: false, description: 'Name of the manifest.' + field :image_name, GraphQL::Types::String, null: false, description: 'Name of the image.' + field :size, GraphQL::Types::String, null: false, description: 'Size of the manifest file.' + field :digest, GraphQL::Types::String, null: false, description: 'Digest of the manifest.' + + def image_name + object.file_name.chomp(File.extname(object.file_name)) + end + end +end diff --git a/app/graphql/types/design_management/design_at_version_type.rb b/app/graphql/types/design_management/design_at_version_type.rb index 4240b8f3aae..0dc93072e4f 100644 --- a/app/graphql/types/design_management/design_at_version_type.rb +++ b/app/graphql/types/design_management/design_at_version_type.rb @@ -18,12 +18,12 @@ module Types field :version, Types::DesignManagement::VersionType, null: false, - description: 'The version this design-at-versions is pinned to.' + description: 'Version this design-at-versions is pinned to.' field :design, Types::DesignManagement::DesignType, null: false, - description: 'The underlying design.' + description: 'Underlying design.' def cached_stateful_version(_parent) version diff --git a/app/graphql/types/design_management/design_fields.rb b/app/graphql/types/design_management/design_fields.rb index 7779c3f1bcb..75f1aaa8c60 100644 --- a/app/graphql/types/design_management/design_fields.rb +++ b/app/graphql/types/design_management/design_fields.rb @@ -7,12 +7,12 @@ module Types field_class Types::BaseField - field :id, GraphQL::Types::ID, description: 'The ID of this design.', null: false - field :project, Types::ProjectType, null: false, description: 'The project the design belongs to.' - field :issue, Types::IssueType, null: false, description: 'The issue the design belongs to.' - field :filename, GraphQL::Types::String, null: false, description: 'The filename of the design.' - field :full_path, GraphQL::Types::String, null: false, description: 'The full path to the design file.' - field :image, GraphQL::Types::String, null: false, extras: [:parent], description: 'The URL of the full-sized image.' + field :id, GraphQL::Types::ID, description: 'ID of this design.', null: false + field :project, Types::ProjectType, null: false, description: 'Project the design belongs to.' + field :issue, Types::IssueType, null: false, description: 'Issue the design belongs to.' + 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], 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' @@ -20,7 +20,7 @@ module Types null: false, calls_gitaly: true, extras: [:parent], - description: 'The diff refs for this design.' + description: 'Diff refs for this design.' field :event, Types::DesignManagement::DesignVersionEventEnum, null: false, extras: [:parent], @@ -29,7 +29,7 @@ module Types GraphQL::Types::Int, null: false, method: :user_notes_count, - description: 'The total count of user-created notes for this design.' + description: 'Total count of user-created notes for this design.' def diff_refs(parent:) version = cached_stateful_version(parent) diff --git a/app/graphql/types/diff_paths_input_type.rb b/app/graphql/types/diff_paths_input_type.rb index e1d3d58411c..cdcff1a7e34 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 :old_path, GraphQL::Types::String, required: false, - description: 'The path of the file on the start sha.' + description: 'Path of the file on the start SHA.' argument :new_path, GraphQL::Types::String, required: false, - description: 'The path of the file on the head sha.' + description: 'Path of the file on the HEAD SHA.' end end diff --git a/app/graphql/types/environment_type.rb b/app/graphql/types/environment_type.rb index 267ca944198..aba83f559fa 100644 --- a/app/graphql/types/environment_type.rb +++ b/app/graphql/types/environment_type.rb @@ -19,7 +19,7 @@ module Types description: 'State of the environment, for example: available/stopped.' field :path, GraphQL::Types::String, null: false, - description: 'The path to the environment.' + description: 'Path to the environment.' field :metrics_dashboard, Types::Metrics::DashboardType, null: true, description: 'Metrics dashboard schema for the environment.', @@ -28,6 +28,6 @@ module Types field :latest_opened_most_severe_alert, Types::AlertManagement::AlertType, null: true, - description: 'The most severe open alert for the environment. If multiple alerts have equal severity, the most recent is returned.' + description: 'Most severe open alert for the environment. If multiple alerts have equal severity, the most recent is returned.' end end diff --git a/app/graphql/types/eventable_type.rb b/app/graphql/types/eventable_type.rb index eba2154e7fa..9a02079b7ab 100644 --- a/app/graphql/types/eventable_type.rb +++ b/app/graphql/types/eventable_type.rb @@ -4,6 +4,6 @@ module Types module EventableType include Types::BaseInterface - field :events, Types::EventType.connection_type, null: true, description: 'A list of events associated with the object.' + field :events, Types::EventType.connection_type, null: true, description: 'List of events associated with the object.' end end diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb index fbf0084cd0e..8fe4ba557ea 100644 --- a/app/graphql/types/group_type.rb +++ b/app/graphql/types/group_type.rb @@ -33,12 +33,12 @@ module Types type: GraphQL::Types::String, null: true, method: :project_creation_level_str, - description: 'The permission level required to create projects in the group.' + description: 'Permission level required to create projects in the group.' field :subgroup_creation_level, type: GraphQL::Types::String, null: true, method: :subgroup_creation_level_str, - description: 'The permission level required to create subgroups within the group.' + description: 'Permission level required to create subgroups within the group.' field :require_two_factor_authentication, type: GraphQL::Types::Boolean, @@ -101,7 +101,7 @@ module Types field :label, Types::LabelType, null: true, - description: 'A label available on this group.' do + description: 'Label available on this group.' do argument :title, type: GraphQL::Types::String, required: true, @@ -128,6 +128,46 @@ module Types description: 'Packages of the group.', resolver: Resolvers::GroupPackagesResolver + field :dependency_proxy_setting, + Types::DependencyProxy::GroupSettingType, + null: true, + description: 'Dependency Proxy settings for the group.' + + field :dependency_proxy_manifests, + Types::DependencyProxy::ManifestType.connection_type, + null: true, + description: 'Dependency Proxy manifests.' + + field :dependency_proxy_blobs, + Types::DependencyProxy::BlobType.connection_type, + null: true, + description: 'Dependency Proxy blobs.' + + field :dependency_proxy_image_count, + GraphQL::Types::Int, + null: false, + description: 'Number of dependency proxy images cached in the group.' + + field :dependency_proxy_blob_count, + GraphQL::Types::Int, + null: false, + description: 'Number of dependency proxy blobs cached in the group.' + + field :dependency_proxy_total_size, + GraphQL::Types::String, + null: false, + description: 'Total size of the dependency proxy cached images.' + + field :dependency_proxy_image_prefix, + GraphQL::Types::String, + null: false, + description: 'Prefix for pulling images when using the dependency proxy.' + + field :dependency_proxy_image_ttl_policy, + Types::DependencyProxy::ImageTtlGroupPolicyType, + null: true, + description: 'Dependency proxy TTL policy for the group.' + def label(title:) BatchLoader::GraphQL.for(title).batch(key: group) do |titles, loader, args| LabelsFinder @@ -155,6 +195,19 @@ module Types complexity: 5, resolver: Resolvers::GroupsResolver + field :runners, Types::Ci::RunnerType.connection_type, + null: true, + resolver: Resolvers::Ci::GroupRunnersResolver, + description: "Find runners visible to the current user." + + field :organizations, Types::CustomerRelations::OrganizationType.connection_type, + null: true, + description: "Find organizations of this group." + + field :contacts, Types::CustomerRelations::ContactType.connection_type, + null: true, + description: "Find contacts of this group." + def avatar_url object.avatar_url(only_path: false) end @@ -167,6 +220,20 @@ module Types group.container_repositories.size end + def dependency_proxy_image_count + group.dependency_proxy_manifests.count + end + + def dependency_proxy_blob_count + group.dependency_proxy_blobs.count + end + + def dependency_proxy_total_size + ActiveSupport::NumberHelper.number_to_human_size( + group.dependency_proxy_manifests.sum(:size) + group.dependency_proxy_blobs.sum(:size) + ) + end + private def group diff --git a/app/graphql/types/issue_sort_enum.rb b/app/graphql/types/issue_sort_enum.rb index a2390ff01fe..f8825ff6c46 100644 --- a/app/graphql/types/issue_sort_enum.rb +++ b/app/graphql/types/issue_sort_enum.rb @@ -10,6 +10,8 @@ module Types value 'RELATIVE_POSITION_ASC', 'Relative position by ascending order.', value: :relative_position_asc value 'SEVERITY_ASC', 'Severity from less critical to more critical.', value: :severity_asc value 'SEVERITY_DESC', 'Severity from more critical to less critical.', value: :severity_desc + value 'TITLE_ASC', 'Title by ascending order.', value: :title_asc + value 'TITLE_DESC', 'Title by descending order.', value: :title_desc value 'POPULARITY_ASC', 'Number of upvotes (awarded "thumbs up" emoji) by ascending order.', value: :popularity_asc value 'POPULARITY_DESC', 'Number of upvotes (awarded "thumbs up" emoji) by descending order.', value: :popularity_desc end diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 42feb8a8076..c8db2b84ff2 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -53,6 +53,9 @@ module Types description: 'Due date of the issue.' field :confidential, GraphQL::Types::Boolean, null: false, description: 'Indicates the issue is confidential.' + field :hidden, GraphQL::Types::Boolean, null: true, resolver_method: :hidden?, + 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 :discussion_locked, GraphQL::Types::Boolean, null: false, description: 'Indicates discussion is locked on the issue.' @@ -156,6 +159,10 @@ module Types def create_note_email object.creatable_note_email_address(context[:current_user]) end + + def hidden? + object.hidden? if Feature.enabled?(:ban_user_feature_flag) + end end end diff --git a/app/graphql/types/issues/negated_issue_filter_input_type.rb b/app/graphql/types/issues/negated_issue_filter_input_type.rb index e5125c554a4..4f620a5b3d9 100644 --- a/app/graphql/types/issues/negated_issue_filter_input_type.rb +++ b/app/graphql/types/issues/negated_issue_filter_input_type.rb @@ -14,6 +14,9 @@ module Types argument :milestone_title, [GraphQL::Types::String], required: false, description: 'Milestone not applied to this issue.' + argument :author_username, GraphQL::Types::String, + required: false, + description: "Username of a user who didn't author the issue." argument :assignee_usernames, [GraphQL::Types::String], required: false, description: 'Usernames of users not assigned to the issue.' @@ -23,6 +26,9 @@ module Types argument :milestone_wildcard_id, ::Types::NegatedMilestoneWildcardIdEnum, required: false, description: 'Filter by negated milestone wildcard values.' + argument :my_reaction_emoji, GraphQL::Types::String, + required: false, + description: 'Filter by reaction emoji applied by the current user.' end end end diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index 8e6b5421ede..004ac364487 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -64,7 +64,7 @@ module Types description: 'Diff head SHA of the merge request.' field :diff_stats, [Types::DiffStatsType], null: true, calls_gitaly: true, description: 'Details about which files were changed in this merge request.' do - argument :path, GraphQL::Types::String, required: false, description: 'A specific file-path.' + argument :path, GraphQL::Types::String, required: false, description: 'Specific file path.' end field :diff_stats_summary, Types::DiffStatsSummaryType, null: true, calls_gitaly: true, @@ -129,14 +129,14 @@ module Types description: 'Number of downvotes for the merge request.' field :head_pipeline, Types::Ci::PipelineType, null: true, method: :actual_head_pipeline, - description: 'The 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.', resolver: Resolvers::MergeRequestPipelinesResolver field :milestone, Types::MilestoneType, null: true, - description: 'The milestone of the merge request.' + description: 'Milestone of the merge request.' field :assignees, type: Types::MergeRequests::AssigneeType.connection_type, null: true, diff --git a/app/graphql/types/metadata/kas_type.rb b/app/graphql/types/metadata/kas_type.rb index a947986fa60..54a8a6ec40d 100644 --- a/app/graphql/types/metadata/kas_type.rb +++ b/app/graphql/types/metadata/kas_type.rb @@ -12,7 +12,7 @@ module Types field :version, GraphQL::Types::String, null: true, description: 'KAS version.' field :external_url, GraphQL::Types::String, null: true, - description: 'The URL used by the Agents to communicate with KAS.' + description: 'URL used by the Agents to communicate with KAS.' end end end diff --git a/app/graphql/types/milestone_wildcard_id_enum.rb b/app/graphql/types/milestone_wildcard_id_enum.rb index b5b339b1e5b..12e8e07fb05 100644 --- a/app/graphql/types/milestone_wildcard_id_enum.rb +++ b/app/graphql/types/milestone_wildcard_id_enum.rb @@ -6,8 +6,8 @@ module Types description 'Milestone ID wildcard values' value 'NONE', 'No milestone is assigned.' - value 'ANY', 'A milestone is assigned.' - value 'STARTED', 'An open, started milestone (start date <= today).' - value 'UPCOMING', 'An open milestone due in the future (due date >= today).' + value 'ANY', 'Milestone is assigned.' + value 'STARTED', 'Milestone assigned is open and started (start date <= today).' + value 'UPCOMING', 'Milestone assigned is due closest in the future (due date > today).' end end diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index 293d19d068a..ea50af1c554 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -33,7 +33,11 @@ module Types mount_mutation Mutations::Branches::Create, calls_gitaly: true 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::CustomerRelations::Organizations::Create + mount_mutation Mutations::CustomerRelations::Organizations::Update mount_mutation Mutations::Discussions::ToggleResolve + mount_mutation Mutations::DependencyProxy::ImageTtlGroupPolicy::Update mount_mutation Mutations::Environments::CanaryIngress::Update mount_mutation Mutations::Issues::Create mount_mutation Mutations::Issues::SetAssignees @@ -103,9 +107,9 @@ module Types mount_mutation Mutations::Ci::Job::Unschedule mount_mutation Mutations::Ci::JobTokenScope::AddProject mount_mutation Mutations::Ci::JobTokenScope::RemoveProject - mount_mutation Mutations::Ci::Runner::Update, feature_flag: :runner_graphql_query - mount_mutation Mutations::Ci::Runner::Delete, feature_flag: :runner_graphql_query - mount_mutation Mutations::Ci::RunnersRegistrationToken::Reset, feature_flag: :runner_graphql_query + mount_mutation Mutations::Ci::Runner::Update + mount_mutation Mutations::Ci::Runner::Delete + mount_mutation Mutations::Ci::RunnersRegistrationToken::Reset mount_mutation Mutations::Namespace::PackageSettings::Update mount_mutation Mutations::Groups::Update mount_mutation Mutations::UserCallouts::Create diff --git a/app/graphql/types/namespace_type.rb b/app/graphql/types/namespace_type.rb index 4cc543f477a..3c5994ac559 100644 --- a/app/graphql/types/namespace_type.rb +++ b/app/graphql/types/namespace_type.rb @@ -40,7 +40,7 @@ module Types field :package_settings, Types::Namespace::PackageSettingsType, null: true, - description: 'The package settings for the namespace.' + description: 'Package settings for the namespace.' field :shared_runners_setting, Types::Namespace::SharedRunnersSettingEnum, diff --git a/app/graphql/types/negated_milestone_wildcard_id_enum.rb b/app/graphql/types/negated_milestone_wildcard_id_enum.rb index ca27a6c7b6e..9e9f561677a 100644 --- a/app/graphql/types/negated_milestone_wildcard_id_enum.rb +++ b/app/graphql/types/negated_milestone_wildcard_id_enum.rb @@ -5,7 +5,7 @@ module Types graphql_name 'NegatedMilestoneWildcardId' description 'Negated Milestone ID wildcard values' - value 'STARTED', 'An open, started milestone (start date <= today).' - value 'UPCOMING', 'An open milestone due in the future (due date >= today).' + value 'STARTED', 'Milestone assigned is open and yet to be started (start date > today).' + value 'UPCOMING', 'Milestone assigned is open but due in the past (due date <= today).' end end diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb index fa33428114c..da6ea83401d 100644 --- a/app/graphql/types/notes/note_type.rb +++ b/app/graphql/types/notes/note_type.rb @@ -40,9 +40,9 @@ module Types field :updated_at, Types::TimeType, null: false, description: "Timestamp of the note's last activity." field :discussion, Types::Notes::DiscussionType, null: true, - description: 'The discussion this note is a part of.' + description: 'Discussion this note is a part of.' field :position, Types::Notes::DiffPositionType, null: true, - description: 'The position of this note on a diff.' + description: 'Position of this note on a diff.' field :confidential, GraphQL::Types::Boolean, null: true, description: 'Indicates if this note is confidential.', method: :confidential? diff --git a/app/graphql/types/notes/position_type_enum.rb b/app/graphql/types/notes/position_type_enum.rb index 18934636670..157b0b4b884 100644 --- a/app/graphql/types/notes/position_type_enum.rb +++ b/app/graphql/types/notes/position_type_enum.rb @@ -6,7 +6,7 @@ module Types graphql_name 'DiffPositionType' description 'Type of file the position refers to' - value 'text', description: "A text file." + value 'text', description: "Text file." value 'image', description: "An image." end end diff --git a/app/graphql/types/packages/composer/json_type.rb b/app/graphql/types/packages/composer/json_type.rb index d2bd62ca74d..6c121043301 100644 --- a/app/graphql/types/packages/composer/json_type.rb +++ b/app/graphql/types/packages/composer/json_type.rb @@ -8,10 +8,10 @@ module Types graphql_name 'PackageComposerJsonType' description 'Represents a composer JSON file' - field :name, GraphQL::Types::String, null: true, description: 'The name set in the Composer JSON file.' - field :type, GraphQL::Types::String, null: true, description: 'The type set in the Composer JSON file.' - field :license, GraphQL::Types::String, null: true, description: 'The license set in the Composer JSON file.' - field :version, GraphQL::Types::String, null: true, description: 'The version set in the Composer JSON file.' + field :name, GraphQL::Types::String, null: true, description: 'Name set in the Composer JSON file.' + field :type, GraphQL::Types::String, null: true, description: 'Type set in the Composer JSON file.' + field :license, GraphQL::Types::String, null: true, description: 'License set in the Composer JSON file.' + field :version, GraphQL::Types::String, null: true, description: 'Version set in the Composer JSON file.' end end end diff --git a/app/graphql/types/packages/package_details_type.rb b/app/graphql/types/packages/package_details_type.rb index f52b1f02519..59a4885e87e 100644 --- a/app/graphql/types/packages/package_details_type.rb +++ b/app/graphql/types/packages/package_details_type.rb @@ -8,7 +8,7 @@ module Types authorize :read_package field :versions, ::Types::Packages::PackageType.connection_type, null: true, - description: 'The other versions of the package.' + description: 'Other versions of the package.' field :package_files, Types::Packages::PackageFileType.connection_type, null: true, description: 'Package files.' diff --git a/app/graphql/types/packages/package_file_type.rb b/app/graphql/types/packages/package_file_type.rb index f77c40de8d8..8cc0f9b984a 100644 --- a/app/graphql/types/packages/package_file_type.rb +++ b/app/graphql/types/packages/package_file_type.rb @@ -8,8 +8,8 @@ module Types authorize :read_package field :id, ::Types::GlobalIDType[::Packages::PackageFile], null: false, description: 'ID of the file.' - field :created_at, Types::TimeType, null: false, description: 'The created date.' - field :updated_at, Types::TimeType, null: false, description: 'The updated date.' + field :created_at, Types::TimeType, null: false, description: 'Created date.' + field :updated_at, Types::TimeType, null: false, description: 'Updated date.' field :size, GraphQL::Types::String, null: false, description: 'Size of the package file.' field :file_name, GraphQL::Types::String, null: false, description: 'Name of the package file.' field :download_path, GraphQL::Types::String, null: false, description: 'Download path of the package file.' diff --git a/app/graphql/types/packages/package_tag_type.rb b/app/graphql/types/packages/package_tag_type.rb index 450f3fc8e9c..f1f96c42e27 100644 --- a/app/graphql/types/packages/package_tag_type.rb +++ b/app/graphql/types/packages/package_tag_type.rb @@ -7,10 +7,10 @@ module Types description 'Represents a package tag' authorize :read_package - field :id, GraphQL::Types::ID, null: false, description: 'The ID of the tag.' - field :name, GraphQL::Types::String, null: false, description: 'The name of the tag.' - field :created_at, Types::TimeType, null: false, description: 'The created date.' - field :updated_at, Types::TimeType, null: false, description: 'The updated date.' + field :id, GraphQL::Types::ID, null: false, description: 'ID of the tag.' + field :name, GraphQL::Types::String, null: false, description: 'Name of the tag.' + field :created_at, Types::TimeType, null: false, description: 'Created date.' + field :updated_at, Types::TimeType, null: false, description: 'Updated date.' end end end diff --git a/app/graphql/types/packages/package_type.rb b/app/graphql/types/packages/package_type.rb index b8654ebd2c6..f3fa79cc08c 100644 --- a/app/graphql/types/packages/package_type.rb +++ b/app/graphql/types/packages/package_type.rb @@ -23,7 +23,7 @@ module Types field :metadata, Types::Packages::MetadataType, null: true, description: 'Package metadata.' field :versions, ::Types::Packages::PackageType.connection_type, null: true, - description: 'The other versions of the package.', + description: 'Other versions of the package.', deprecated: { reason: 'This field is now only returned in the PackageDetailsType', milestone: '13.11' } field :status, Types::Packages::PackageStatusEnum, null: false, description: 'Package status.' diff --git a/app/graphql/types/permission_types/custom_emoji.rb b/app/graphql/types/permission_types/custom_emoji.rb index 0b2e7da44f5..61ff85f665d 100644 --- a/app/graphql/types/permission_types/custom_emoji.rb +++ b/app/graphql/types/permission_types/custom_emoji.rb @@ -5,7 +5,7 @@ module Types class CustomEmoji < BasePermissionType graphql_name 'CustomEmojiPermissions' - abilities :create_custom_emoji, :read_custom_emoji + abilities :create_custom_emoji, :read_custom_emoji, :delete_custom_emoji end end end diff --git a/app/graphql/types/permission_types/group.rb b/app/graphql/types/permission_types/group.rb index 29833993ce6..6a1031e2532 100644 --- a/app/graphql/types/permission_types/group.rb +++ b/app/graphql/types/permission_types/group.rb @@ -5,7 +5,7 @@ module Types class Group < BasePermissionType graphql_name 'GroupPermissions' - abilities :read_group + abilities :read_group, :create_projects end end end diff --git a/app/graphql/types/permission_types/group_enum.rb b/app/graphql/types/permission_types/group_enum.rb new file mode 100644 index 00000000000..cc4f5e9f1f0 --- /dev/null +++ b/app/graphql/types/permission_types/group_enum.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Types + module PermissionTypes + class GroupEnum < BaseEnum + graphql_name 'GroupPermission' + description 'User permission on groups' + + value 'CREATE_PROJECTS', value: :create_projects, description: 'Groups where the user can create projects.' + end + end +end diff --git a/app/graphql/types/project_statistics_type.rb b/app/graphql/types/project_statistics_type.rb index ee8476f50de..60a3d5ce06b 100644 --- a/app/graphql/types/project_statistics_type.rb +++ b/app/graphql/types/project_statistics_type.rb @@ -23,6 +23,8 @@ module Types description: 'Wiki size of the project in bytes.' field :snippets_size, GraphQL::FLOAT_TYPE, null: true, description: 'Snippets size of the project in bytes.' + field :pipeline_artifacts_size, GraphQL::FLOAT_TYPE, null: true, + description: 'CI Pipeline artifacts size in bytes.' field :uploads_size, GraphQL::FLOAT_TYPE, null: true, description: 'Uploads size of the project in bytes.' end diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index af1f1c54ec2..aef46a05a2f 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -118,7 +118,7 @@ module Types 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.' field :suggestion_commit_message, GraphQL::Types::String, null: true, - description: 'The commit message used to apply merge request suggestions.' + description: 'Commit message used to apply merge request suggestions.' field :squash_read_only, GraphQL::Types::Boolean, null: false, method: :squash_readonly?, description: 'Indicates if `squashReadOnly` is enabled.' @@ -310,7 +310,7 @@ module Types field :container_expiration_policy, Types::ContainerExpirationPolicyType, null: true, - description: 'The container expiration policy of the project.' + description: 'Container expiration policy of the project.' field :container_repositories, Types::ContainerRepositoryType.connection_type, @@ -324,7 +324,7 @@ module Types field :label, Types::LabelType, null: true, - description: 'A label available on this project.' do + description: 'Label available on this project.' do argument :title, GraphQL::Types::String, required: true, description: 'Title of the label.' @@ -406,6 +406,10 @@ module Types object.topic_list end + def topics + object.topic_list + end + private def project diff --git a/app/graphql/types/prometheus_alert_type.rb b/app/graphql/types/prometheus_alert_type.rb index 8327848032a..789f1d6eb5f 100644 --- a/app/graphql/types/prometheus_alert_type.rb +++ b/app/graphql/types/prometheus_alert_type.rb @@ -15,6 +15,6 @@ module Types field :humanized_text, GraphQL::Types::String, null: false, - description: 'The human-readable text of the alert condition.' + description: 'Human-readable text of the alert condition.' end end diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 7e9cd615719..e02191fbf3e 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -62,7 +62,7 @@ module Types argument :id, type: ::Types::GlobalIDType[::ContainerRepository], required: true, - description: 'The global ID of the container repository.' + description: 'Global ID of the container repository.' end field :package, @@ -84,13 +84,13 @@ module Types field :issue, Types::IssueType, null: true, description: 'Find an issue.' do - argument :id, ::Types::GlobalIDType[::Issue], required: true, description: 'The global ID of the issue.' + argument :id, ::Types::GlobalIDType[::Issue], required: true, description: 'Global ID of the issue.' end field :merge_request, Types::MergeRequestType, null: true, description: 'Find a merge request.' do - argument :id, ::Types::GlobalIDType[::MergeRequest], required: true, description: 'The global ID of the merge request.' + argument :id, ::Types::GlobalIDType[::MergeRequest], required: true, description: 'Global ID of the merge request.' end field :instance_statistics_measurements, @@ -120,14 +120,12 @@ module Types null: true, resolver: Resolvers::Ci::RunnerResolver, extras: [:lookahead], - description: "Find a runner.", - feature_flag: :runner_graphql_query + description: "Find a runner." field :runners, Types::Ci::RunnerType.connection_type, null: true, resolver: Resolvers::Ci::RunnersResolver, - description: "Find runners visible to the current user.", - feature_flag: :runner_graphql_query + description: "Find runners visible to the current user." field :ci_config, resolver: Resolvers::Ci::ConfigResolver, complexity: 126 # AUTHENTICATED_MAX_COMPLEXITY / 2 + 1 diff --git a/app/graphql/types/range_input_type.rb b/app/graphql/types/range_input_type.rb index e31b8ecd811..9580b37d6c0 100644 --- a/app/graphql/types/range_input_type.rb +++ b/app/graphql/types/range_input_type.rb @@ -8,11 +8,11 @@ module Types @subtypes[[type, closed]] ||= Class.new(self) do argument :start, type, required: closed, - description: 'The start of the range.' + description: 'Start of the range.' argument :end, type, required: closed, - description: 'The end of the range.' + description: 'End of the range.' end end diff --git a/app/graphql/types/release_asset_link_shared_input_arguments.rb b/app/graphql/types/release_asset_link_shared_input_arguments.rb index 37a6cdd55c9..f622a11deea 100644 --- a/app/graphql/types/release_asset_link_shared_input_arguments.rb +++ b/app/graphql/types/release_asset_link_shared_input_arguments.rb @@ -19,7 +19,7 @@ module Types argument :link_type, Types::ReleaseAssetLinkTypeEnum, required: false, default_value: 'other', - description: 'The type of the asset link.' + description: 'Type of the asset link.' end end end diff --git a/app/graphql/types/release_assets_input_type.rb b/app/graphql/types/release_assets_input_type.rb index 2c8d3de3495..0e591dd3742 100644 --- a/app/graphql/types/release_assets_input_type.rb +++ b/app/graphql/types/release_assets_input_type.rb @@ -7,6 +7,6 @@ module Types argument :links, [Types::ReleaseAssetLinkInputType], required: false, - description: 'A list of asset links to associate to the release.' + description: 'List of asset links to associate to the release.' end end diff --git a/app/graphql/types/release_type.rb b/app/graphql/types/release_type.rb index 5e8f00b2b0a..6dda93c7329 100644 --- a/app/graphql/types/release_type.rb +++ b/app/graphql/types/release_type.rb @@ -49,7 +49,7 @@ module Types field :commit, Types::CommitType, null: true, complexity: 10, calls_gitaly: true, - description: 'The commit associated with the release.' + description: 'Commit associated with the release.' def commit return if release.sha.nil? diff --git a/app/graphql/types/repository/blob_type.rb b/app/graphql/types/repository/blob_type.rb index b6a1a91fd7a..ef7f535212f 100644 --- a/app/graphql/types/repository/blob_type.rb +++ b/app/graphql/types/repository/blob_type.rb @@ -48,10 +48,10 @@ module Types 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: 'The 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: 'The 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)." @@ -69,7 +69,7 @@ module Types description: 'Web path to replace the blob content.' field :file_type, GraphQL::Types::String, null: true, - description: 'The 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.', diff --git a/app/graphql/types/root_storage_statistics_type.rb b/app/graphql/types/root_storage_statistics_type.rb index 102639f19d9..47ca195cc4b 100644 --- a/app/graphql/types/root_storage_statistics_type.rb +++ b/app/graphql/types/root_storage_statistics_type.rb @@ -6,14 +6,14 @@ module Types authorize :read_statistics - field :storage_size, GraphQL::FLOAT_TYPE, null: false, description: 'The total storage in bytes.' - field :repository_size, GraphQL::FLOAT_TYPE, null: false, description: 'The Git repository size in bytes.' - field :lfs_objects_size, GraphQL::FLOAT_TYPE, null: false, description: 'The LFS objects size in bytes.' - field :build_artifacts_size, GraphQL::FLOAT_TYPE, null: false, description: 'The CI artifacts size in bytes.' - field :packages_size, GraphQL::FLOAT_TYPE, null: false, description: 'The packages size in bytes.' - field :wiki_size, GraphQL::FLOAT_TYPE, null: false, description: 'The wiki size in bytes.' - field :snippets_size, GraphQL::FLOAT_TYPE, null: false, description: 'The snippets size in bytes.' - field :pipeline_artifacts_size, GraphQL::FLOAT_TYPE, null: false, description: 'The CI pipeline artifacts size in bytes.' - field :uploads_size, GraphQL::FLOAT_TYPE, null: false, description: 'The uploads size in bytes.' + field :storage_size, GraphQL::FLOAT_TYPE, null: false, description: 'Total storage in bytes.' + field :repository_size, GraphQL::FLOAT_TYPE, null: false, description: 'Git repository size in bytes.' + field :lfs_objects_size, GraphQL::FLOAT_TYPE, null: false, description: 'LFS objects size in bytes.' + field :build_artifacts_size, GraphQL::FLOAT_TYPE, null: false, description: 'CI artifacts size in bytes.' + field :packages_size, GraphQL::FLOAT_TYPE, null: false, description: 'Packages size in bytes.' + field :wiki_size, GraphQL::FLOAT_TYPE, null: false, description: 'Wiki size in bytes.' + field :snippets_size, GraphQL::FLOAT_TYPE, null: false, description: 'Snippets size in bytes.' + field :pipeline_artifacts_size, GraphQL::FLOAT_TYPE, null: false, description: 'CI pipeline artifacts size in bytes.' + field :uploads_size, GraphQL::FLOAT_TYPE, null: false, description: 'Uploads size in bytes.' end end diff --git a/app/graphql/types/snippet_type.rb b/app/graphql/types/snippet_type.rb index c345aea08bd..7b96cc34941 100644 --- a/app/graphql/types/snippet_type.rb +++ b/app/graphql/types/snippet_type.rb @@ -22,7 +22,7 @@ module Types null: false field :project, Types::ProjectType, - description: 'The project the snippet is associated with.', + description: 'Project the snippet is associated with.', null: true, authorize: :read_project @@ -30,7 +30,7 @@ module Types # when the admin setting restricted visibility # level is set to public field :author, Types::UserType, - description: 'The owner of the snippet.', + description: 'Owner of the snippet.', null: true field :file_name, GraphQL::Types::String, diff --git a/app/graphql/types/snippets/blob_type.rb b/app/graphql/types/snippets/blob_type.rb index d5da271d936..2b9b76a6194 100644 --- a/app/graphql/types/snippets/blob_type.rb +++ b/app/graphql/types/snippets/blob_type.rb @@ -17,7 +17,7 @@ module Types null: true field :raw_plain_data, GraphQL::Types::String, - description: 'The raw content of the blob, if the blob is text data.', + description: 'Raw content of the blob, if the blob is text data.', null: true field :raw_path, GraphQL::Types::String, diff --git a/app/graphql/types/snippets/visibility_scopes_enum.rb b/app/graphql/types/snippets/visibility_scopes_enum.rb index ddcc005eaf2..b2c1d5cf06b 100644 --- a/app/graphql/types/snippets/visibility_scopes_enum.rb +++ b/app/graphql/types/snippets/visibility_scopes_enum.rb @@ -3,9 +3,9 @@ module Types module Snippets class VisibilityScopesEnum < BaseEnum - value 'private', description: 'The snippet is visible only to the snippet creator.', value: 'are_private' - value 'internal', description: 'The snippet is visible for any logged in user except external users.', value: 'are_internal' - value 'public', description: 'The snippet can be accessed without any authentication.', value: 'are_public' + value 'private', description: 'Snippet is visible only to the snippet creator.', value: 'are_private' + value 'internal', description: 'Snippet is visible for any logged in user except external users.', value: 'are_internal' + value 'public', description: 'Snippet can be accessed without any authentication.', value: 'are_public' end end end diff --git a/app/graphql/types/terraform/state_type.rb b/app/graphql/types/terraform/state_type.rb index cbd5aeaeef9..bce34a85f85 100644 --- a/app/graphql/types/terraform/state_type.rb +++ b/app/graphql/types/terraform/state_type.rb @@ -19,7 +19,7 @@ module Types field :locked_by_user, Types::UserType, null: true, - description: 'The user currently holding a lock on the Terraform state.' + description: 'User currently holding a lock on the Terraform state.' field :locked_at, Types::TimeType, null: true, @@ -28,7 +28,7 @@ module Types field :latest_version, Types::Terraform::StateVersionType, complexity: 3, null: true, - description: 'The latest version of the Terraform state.' + description: 'Latest version of the Terraform state.' field :created_at, Types::TimeType, null: false, diff --git a/app/graphql/types/terraform/state_version_type.rb b/app/graphql/types/terraform/state_version_type.rb index 545b3c0044d..bf1af4565bc 100644 --- a/app/graphql/types/terraform/state_version_type.rb +++ b/app/graphql/types/terraform/state_version_type.rb @@ -15,7 +15,7 @@ module Types field :created_by_user, Types::UserType, null: true, - description: 'The user that created this version.' + description: 'User that created this version.' field :download_path, GraphQL::Types::String, null: true, @@ -23,7 +23,8 @@ module Types field :job, Types::Ci::JobType, null: true, - description: 'The job that created this version.' + description: 'Job that created this version.', + authorize: :read_commit_status field :serial, GraphQL::Types::Int, null: true, diff --git a/app/graphql/types/timelog_type.rb b/app/graphql/types/timelog_type.rb index 206aabbada3..d348fa698fa 100644 --- a/app/graphql/types/timelog_type.rb +++ b/app/graphql/types/timelog_type.rb @@ -14,31 +14,31 @@ module Types field :time_spent, GraphQL::Types::Int, null: false, - description: 'The time spent displayed in seconds.' + description: 'Time spent displayed in seconds.' field :user, Types::UserType, null: false, - description: 'The user that logged the time.' + description: 'User that logged the time.' field :issue, Types::IssueType, null: true, - description: 'The issue that logged time was added to.' + description: 'Issue that logged time was added to.' field :merge_request, Types::MergeRequestType, null: true, - description: 'The merge request that logged time was added to.' + description: 'Merge request that logged time was added to.' field :note, Types::Notes::NoteType, null: true, - description: 'The note where the quick action to add the logged time was executed.' + description: 'Note where the quick action was executed to add the logged time.' field :summary, GraphQL::Types::String, null: true, - description: 'The summary of how the time was spent.' + description: 'Summary of how the time was spent.' def user Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.user_id).find diff --git a/app/graphql/types/todo_state_enum.rb b/app/graphql/types/todo_state_enum.rb index 604e2a62f70..e6fc8867a80 100644 --- a/app/graphql/types/todo_state_enum.rb +++ b/app/graphql/types/todo_state_enum.rb @@ -2,7 +2,7 @@ module Types class TodoStateEnum < BaseEnum - value 'pending', description: "The state of the todo is pending." - value 'done', description: "The state of the todo is done." + value 'pending', description: "State of the todo is pending." + value 'done', description: "State of the todo is done." end end diff --git a/app/graphql/types/todo_target_enum.rb b/app/graphql/types/todo_target_enum.rb index ce61bc8a926..dbf7b42ffcc 100644 --- a/app/graphql/types/todo_target_enum.rb +++ b/app/graphql/types/todo_target_enum.rb @@ -2,11 +2,11 @@ module Types class TodoTargetEnum < BaseEnum - value 'COMMIT', value: 'Commit', description: 'A Commit.' - value 'ISSUE', value: 'Issue', description: 'An Issue.' - value 'MERGEREQUEST', value: 'MergeRequest', description: 'A MergeRequest.' - value 'DESIGN', value: 'DesignManagement::Design', description: 'A Design.' - value 'ALERT', value: 'AlertManagement::Alert', description: 'An Alert.' + value 'COMMIT', value: 'Commit', description: 'Commit.' + value 'ISSUE', value: 'Issue', description: 'Issue.' + value 'MERGEREQUEST', value: 'MergeRequest', description: 'Merge request.' + value 'DESIGN', value: 'DesignManagement::Design', description: 'Design.' + value 'ALERT', value: 'AlertManagement::Alert', description: 'Alert.' end end diff --git a/app/graphql/types/todo_type.rb b/app/graphql/types/todo_type.rb index 24c110ce09b..34ba2c75b5f 100644 --- a/app/graphql/types/todo_type.rb +++ b/app/graphql/types/todo_type.rb @@ -14,7 +14,7 @@ module Types null: false field :project, Types::ProjectType, - description: 'The project this to-do item is associated with.', + description: 'Project this to-do item is associated with.', null: true, authorize: :read_project @@ -24,7 +24,7 @@ module Types authorize: :read_group field :author, Types::UserType, - description: 'The author of this to-do item.', + description: 'Author of this to-do item.', null: false field :action, Types::TodoActionEnum, diff --git a/app/graphql/types/user_interface.rb b/app/graphql/types/user_interface.rb index 71c6b7f3019..8c67275eb73 100644 --- a/app/graphql/types/user_interface.rb +++ b/app/graphql/types/user_interface.rb @@ -59,6 +59,10 @@ module Types type: Types::GroupMemberType.connection_type, null: true, description: 'Group memberships of the user.' + field :groups, + resolver: Resolvers::Users::GroupsResolver, + description: 'Groups where the user has access. Will always return `null` if ' \ + '`paginatable_namespace_drop_down_for_project_creation` feature flag is disabled.' field :group_count, resolver: Resolvers::Users::GroupCountResolver, description: 'Group count for the user.' @@ -69,7 +73,7 @@ module Types field :location, type: ::GraphQL::Types::String, null: true, - description: 'The location of the user.' + description: 'Location of the user.' field :project_memberships, type: Types::ProjectMemberType.connection_type, null: true, @@ -82,9 +86,7 @@ module Types null: true, description: 'Personal namespace of the user.' - field :todos, resolver: Resolvers::TodoResolver, description: 'To-do items of the user.' do - extension(::Gitlab::Graphql::TodosProjectPermissionPreloader::FieldExtension) - end + field :todos, resolver: Resolvers::TodoResolver, description: 'To-do items of the user.' # Merge request field: MRs can be authored, assigned, or assigned-for-review: field :authored_merge_requests, diff --git a/app/graphql/types/user_merge_request_interaction_type.rb b/app/graphql/types/user_merge_request_interaction_type.rb index ff6e83efbb2..06e318be5c6 100644 --- a/app/graphql/types/user_merge_request_interaction_type.rb +++ b/app/graphql/types/user_merge_request_interaction_type.rb @@ -28,7 +28,7 @@ module Types field :review_state, ::Types::MergeRequestReviewStateEnum, null: true, - description: 'The state of the review by this user.' + description: 'State of the review by this user.' field :reviewed, type: ::GraphQL::Types::Boolean, diff --git a/app/graphql/types/user_state_enum.rb b/app/graphql/types/user_state_enum.rb index 5adec17672e..de15fc19682 100644 --- a/app/graphql/types/user_state_enum.rb +++ b/app/graphql/types/user_state_enum.rb @@ -5,8 +5,8 @@ module Types graphql_name 'UserState' description 'Possible states of a user' - value 'active', 'The user is active and is able to use the system.', value: 'active' - value 'blocked', 'The user has been blocked and is prevented from using the system.', value: 'blocked' - value 'deactivated', 'The user is no longer active and is unable to use the system.', value: 'deactivated' + value 'active', 'User is active and is able to use the system.', value: 'active' + value 'blocked', 'User has been blocked and is prevented from using the system.', value: 'blocked' + value 'deactivated', 'User is no longer active and is unable to use the system.', value: 'deactivated' end end |