summaryrefslogtreecommitdiff
path: root/app/graphql/types
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types')
-rw-r--r--app/graphql/types/commit_references_type.rb67
-rw-r--r--app/graphql/types/mutation_type.rb10
-rw-r--r--app/graphql/types/permission_types/issue.rb2
-rw-r--r--app/graphql/types/project_statistics_redirect_type.rb27
-rw-r--r--app/graphql/types/project_type.rb32
-rw-r--r--app/graphql/types/projects/commit_parent_names_type.rb1
6 files changed, 126 insertions, 13 deletions
diff --git a/app/graphql/types/commit_references_type.rb b/app/graphql/types/commit_references_type.rb
new file mode 100644
index 00000000000..2844a552f3e
--- /dev/null
+++ b/app/graphql/types/commit_references_type.rb
@@ -0,0 +1,67 @@
+# frozen_string_literal: true
+
+module Types
+ class CommitReferencesType < BaseObject
+ graphql_name 'CommitReferences'
+
+ authorize :read_commit
+
+ def self.field_for_tipping_refs(field_name, field_description)
+ field field_name, ::Types::Projects::CommitParentNamesType,
+ null: true,
+ calls_gitaly: true,
+ description: field_description do
+ argument :limit, GraphQL::Types::Int,
+ required: true,
+ default_value: 100,
+ description: 'Number of ref names to return.',
+ validates: { numericality: { within: 1..1000 } }
+ end
+ end
+
+ def self.field_for_containing_refs(field_name, field_description)
+ field field_name, ::Types::Projects::CommitParentNamesType,
+ null: true,
+ calls_gitaly: true,
+ description: field_description do
+ argument :exclude_tipped, GraphQL::Types::Boolean,
+ required: true,
+ default_value: false,
+ description: 'Exclude tipping refs. WARNING: This argument can be confusing, if there is a limit.
+ for example set the limit to 5 and in the 5 out a total of 25 refs there is 2 tipped refs,
+ then the method will only 3 refs, even though there is more.'
+ # rubocop: disable GraphQL/ArgumentUniqueness
+ argument :limit, GraphQL::Types::Int,
+ required: true,
+ default_value: 100,
+ description: 'Number of ref names to return.',
+ validates: { numericality: { within: 1..1000 } }
+ # rubocop: enable GraphQL/ArgumentUniqueness
+ end
+ end
+
+ field_for_tipping_refs :tipping_tags, "Get tag names tipping at a given commit."
+
+ field_for_tipping_refs :tipping_branches, "Get branch names tipping at a given commit."
+
+ field_for_containing_refs :containing_tags, "Get tag names containing a given commit."
+
+ field_for_containing_refs :containing_branches, "Get branch names containing a given commit."
+
+ def tipping_tags(limit:)
+ { names: object.tipping_tags(limit: limit) }
+ end
+
+ def tipping_branches(limit:)
+ { names: object.tipping_branches(limit: limit) }
+ end
+
+ def containing_tags(limit:, exclude_tipped:)
+ { names: object.tags_containing(limit: limit, exclude_tipped: exclude_tipped) }
+ end
+
+ def containing_branches(limit:, exclude_tipped:)
+ { names: object.branches_containing(limit: limit, exclude_tipped: exclude_tipped) }
+ end
+ end
+end
diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb
index 64f7daf09a8..7e436d74dcf 100644
--- a/app/graphql/types/mutation_type.rb
+++ b/app/graphql/types/mutation_type.rb
@@ -86,8 +86,14 @@ module Types
mount_mutation Mutations::MergeRequests::SetAssignees
mount_mutation Mutations::MergeRequests::SetReviewers
mount_mutation Mutations::MergeRequests::ReviewerRereview
- mount_mutation Mutations::Metrics::Dashboard::Annotations::Create
- mount_mutation Mutations::Metrics::Dashboard::Annotations::Delete
+ mount_mutation Mutations::Metrics::Dashboard::Annotations::Create, deprecated: {
+ reason: 'Underlying feature was removed in 16.0',
+ milestone: '16.0'
+ }
+ mount_mutation Mutations::Metrics::Dashboard::Annotations::Delete, deprecated: {
+ reason: 'Underlying feature was removed in 16.0',
+ milestone: '16.0'
+ }
mount_mutation Mutations::Notes::Create::Note, calls_gitaly: true
mount_mutation Mutations::Notes::Create::DiffNote, calls_gitaly: true
mount_mutation Mutations::Notes::Create::ImageDiffNote, calls_gitaly: true
diff --git a/app/graphql/types/permission_types/issue.rb b/app/graphql/types/permission_types/issue.rb
index b38971b64cd..a76dc88adfc 100644
--- a/app/graphql/types/permission_types/issue.rb
+++ b/app/graphql/types/permission_types/issue.rb
@@ -8,7 +8,7 @@ module Types
abilities :read_issue, :admin_issue, :update_issue, :reopen_issue,
:read_design, :create_design, :destroy_design,
- :create_note
+ :create_note, :update_design
end
end
end
diff --git a/app/graphql/types/project_statistics_redirect_type.rb b/app/graphql/types/project_statistics_redirect_type.rb
new file mode 100644
index 00000000000..c8fec0a54c4
--- /dev/null
+++ b/app/graphql/types/project_statistics_redirect_type.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+module Types
+ # rubocop: disable Graphql/AuthorizeTypes
+ class ProjectStatisticsRedirectType < BaseObject
+ graphql_name 'ProjectStatisticsRedirect'
+
+ field :repository, GraphQL::Types::String, null: false,
+ description: 'Redirection Route for repository.'
+
+ field :wiki, GraphQL::Types::String, null: false,
+ description: 'Redirection Route for wiki.'
+
+ field :build_artifacts, GraphQL::Types::String, null: false,
+ description: 'Redirection Route for job_artifacts.'
+
+ field :packages, GraphQL::Types::String, null: false,
+ description: 'Redirection Route for packages.'
+
+ field :snippets, GraphQL::Types::String, null: false,
+ description: 'Redirection Route for snippets.'
+
+ field :container_registry, GraphQL::Types::String, null: false,
+ description: 'Redirection Route for container_registry.'
+ end
+ # rubocop: enable Graphql/AuthorizeTypes
+end
diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb
index 6dfbdf765c8..f8a516501c3 100644
--- a/app/graphql/types/project_type.rb
+++ b/app/graphql/types/project_type.rb
@@ -214,6 +214,11 @@ module Types
null: true,
description: 'Statistics of the project.'
+ field :statistics_details_paths, Types::ProjectStatisticsRedirectType,
+ null: true,
+ description: 'Redirects for Statistics of the project.',
+ calls_gitaly: true
+
field :repository, Types::RepositoryType,
null: true,
description: 'Git repository of the project.'
@@ -612,15 +617,11 @@ module Types
authorize: :read_cycle_analytics,
alpha: { milestone: '15.10' }
- field :tags_tipping_at_commit, ::Types::Projects::CommitParentNamesType,
- null: true,
- resolver: Resolvers::Projects::TagsTippingAtCommitResolver,
- description: "Get tag names tipping at a given commit."
-
- field :branches_tipping_at_commit, ::Types::Projects::CommitParentNamesType,
- null: true,
- resolver: Resolvers::Projects::BranchesTippingAtCommitResolver,
- description: "Get branch names tipping at a given commit."
+ field :commit_references, ::Types::CommitReferencesType,
+ null: true,
+ resolver: Resolvers::Projects::CommitReferencesResolver,
+ alpha: { milestone: '16.0' },
+ description: "Get tag names containing a given commit."
def timelog_categories
object.project_namespace.timelog_categories if Feature.enabled?(:timelog_categories)
@@ -730,6 +731,19 @@ module Types
end
end
+ def statistics_details_paths
+ root_ref = project.repository.root_ref || project.default_branch_or_main
+
+ {
+ repository: Gitlab::Routing.url_helpers.project_tree_url(project, root_ref),
+ wiki: Gitlab::Routing.url_helpers.project_wikis_pages_url(project),
+ build_artifacts: Gitlab::Routing.url_helpers.project_artifacts_url(project),
+ packages: Gitlab::Routing.url_helpers.project_packages_url(project),
+ snippets: Gitlab::Routing.url_helpers.project_snippets_url(project),
+ container_registry: Gitlab::Routing.url_helpers.project_container_registry_index_url(project)
+ }
+ end
+
private
def project
diff --git a/app/graphql/types/projects/commit_parent_names_type.rb b/app/graphql/types/projects/commit_parent_names_type.rb
index 0aa1ca768e9..39f8f1cdd07 100644
--- a/app/graphql/types/projects/commit_parent_names_type.rb
+++ b/app/graphql/types/projects/commit_parent_names_type.rb
@@ -7,7 +7,6 @@ module Types
graphql_name 'CommitParentNames'
field :names, [GraphQL::Types::String], null: true, description: 'Names of the commit parent (branch or tag).'
- field :total_count, GraphQL::Types::Int, null: true, description: 'Total of parent branches or tags.'
end
# rubocop: enable Graphql/AuthorizeTypes
end