diff options
Diffstat (limited to 'app/graphql/types')
-rw-r--r-- | app/graphql/types/group_type.rb | 8 | ||||
-rw-r--r-- | app/graphql/types/namespace_type.rb | 5 | ||||
-rw-r--r-- | app/graphql/types/query_type.rb | 2 | ||||
-rw-r--r-- | app/graphql/types/root_storage_statistics_type.rb | 16 | ||||
-rw-r--r-- | app/graphql/types/tree/submodule_type.rb | 3 | ||||
-rw-r--r-- | app/graphql/types/tree/tree_type.rb | 4 |
6 files changed, 31 insertions, 7 deletions
diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb index 530aecc2bf9..66b41919914 100644 --- a/app/graphql/types/group_type.rb +++ b/app/graphql/types/group_type.rb @@ -14,10 +14,8 @@ module Types group.avatar_url(only_path: false) end - if ::Group.supports_nested_objects? - field :parent, GroupType, - null: true, - resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find } - end + field :parent, GroupType, + null: true, + resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find } end end diff --git a/app/graphql/types/namespace_type.rb b/app/graphql/types/namespace_type.rb index f105e9e6e28..35a97b5ace0 100644 --- a/app/graphql/types/namespace_type.rb +++ b/app/graphql/types/namespace_type.rb @@ -19,6 +19,11 @@ module Types field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true, method: :lfs_enabled? field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true + field :root_storage_statistics, Types::RootStorageStatisticsType, + null: true, + description: 'The aggregated storage statistics. Only available for root namespaces', + resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(obj.id).find } + field :projects, Types::ProjectType.connection_type, null: false, diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 53d36b43576..c686300b25d 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -24,6 +24,6 @@ module Types resolver: Resolvers::MetadataResolver, description: 'Metadata about GitLab' - field :echo, GraphQL::STRING_TYPE, null: false, function: Functions::Echo.new + field :echo, GraphQL::STRING_TYPE, null: false, resolver: Resolvers::EchoResolver end end diff --git a/app/graphql/types/root_storage_statistics_type.rb b/app/graphql/types/root_storage_statistics_type.rb new file mode 100644 index 00000000000..a7498ee0a2e --- /dev/null +++ b/app/graphql/types/root_storage_statistics_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Types + class RootStorageStatisticsType < BaseObject + graphql_name 'RootStorageStatistics' + + authorize :read_statistics + + field :storage_size, GraphQL::INT_TYPE, null: false, description: 'The total storage in bytes' + field :repository_size, GraphQL::INT_TYPE, null: false, description: 'The git repository size in bytes' + field :lfs_objects_size, GraphQL::INT_TYPE, null: false, description: 'The LFS objects size in bytes' + field :build_artifacts_size, GraphQL::INT_TYPE, null: false, description: 'The CI artifacts size in bytes' + field :packages_size, GraphQL::INT_TYPE, null: false, description: 'The packages size in bytes' + field :wiki_size, GraphQL::INT_TYPE, null: false, description: 'The wiki size in bytes' + end +end diff --git a/app/graphql/types/tree/submodule_type.rb b/app/graphql/types/tree/submodule_type.rb index 8cb1e04f5ba..2b47e5c0161 100644 --- a/app/graphql/types/tree/submodule_type.rb +++ b/app/graphql/types/tree/submodule_type.rb @@ -7,6 +7,9 @@ module Types implements Types::Tree::EntryType graphql_name 'Submodule' + + field :web_url, type: GraphQL::STRING_TYPE, null: true + field :tree_url, type: GraphQL::STRING_TYPE, null: true end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/tree/tree_type.rb b/app/graphql/types/tree/tree_type.rb index fbdc1597461..99f2a6c0235 100644 --- a/app/graphql/types/tree/tree_type.rb +++ b/app/graphql/types/tree/tree_type.rb @@ -15,7 +15,9 @@ module Types Gitlab::Graphql::Representation::TreeEntry.decorate(obj.trees, obj.repository) end - field :submodules, Types::Tree::SubmoduleType.connection_type, null: false, calls_gitaly: true + field :submodules, Types::Tree::SubmoduleType.connection_type, null: false, calls_gitaly: true, resolve: -> (obj, args, ctx) do + Gitlab::Graphql::Representation::SubmoduleTreeEntry.decorate(obj.submodules, obj) + end field :blobs, Types::Tree::BlobType.connection_type, null: false, calls_gitaly: true, resolve: -> (obj, args, ctx) do Gitlab::Graphql::Representation::TreeEntry.decorate(obj.blobs, obj.repository) |