Commit fe110d6c authored by Imre Farkas's avatar Imre Farkas

Merge branch '241980-uploalds-on-storage-graphql' into 'master'

GraphQL for new uploads in storage types

See merge request gitlab-org/gitlab!47820
parents 210dcb80 3b502092
......@@ -10,18 +10,20 @@ module Types
description: 'Commit count of the project'
field :storage_size, GraphQL::FLOAT_TYPE, null: false,
description: 'Storage size of the project'
description: 'Storage size of the project in bytes'
field :repository_size, GraphQL::FLOAT_TYPE, null: false,
description: 'Repository size of the project'
description: 'Repository size of the project in bytes'
field :lfs_objects_size, GraphQL::FLOAT_TYPE, null: false,
description: 'Large File Storage (LFS) object size of the project'
description: 'Large File Storage (LFS) object size of the project in bytes'
field :build_artifacts_size, GraphQL::FLOAT_TYPE, null: false,
description: 'Build artifacts size of the project'
description: 'Build artifacts size of the project in bytes'
field :packages_size, GraphQL::FLOAT_TYPE, null: false,
description: 'Packages size of the project'
description: 'Packages size of the project in bytes'
field :wiki_size, GraphQL::FLOAT_TYPE, null: true,
description: 'Wiki size of the project'
description: 'Wiki size of the project in bytes'
field :snippets_size, GraphQL::FLOAT_TYPE, null: true,
description: 'Snippets size of the project'
description: 'Snippets size of the project in bytes'
field :uploads_size, GraphQL::FLOAT_TYPE, null: true,
description: 'Uploads size of the project in bytes'
end
end
......@@ -14,5 +14,6 @@ module Types
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'
end
end
---
title: 'GraphQL: Expose uploads_size for project_statistics and root_storage_statistics'
merge_request: 47820
author:
type: added
......@@ -17066,7 +17066,7 @@ type ProjectPermissions {
type ProjectStatistics {
"""
Build artifacts size of the project
Build artifacts size of the project in bytes
"""
buildArtifactsSize: Float!
......@@ -17076,32 +17076,37 @@ type ProjectStatistics {
commitCount: Float!
"""
Large File Storage (LFS) object size of the project
Large File Storage (LFS) object size of the project in bytes
"""
lfsObjectsSize: Float!
"""
Packages size of the project
Packages size of the project in bytes
"""
packagesSize: Float!
"""
Repository size of the project
Repository size of the project in bytes
"""
repositorySize: Float!
"""
Snippets size of the project
Snippets size of the project in bytes
"""
snippetsSize: Float
"""
Storage size of the project
Storage size of the project in bytes
"""
storageSize: Float!
"""
Wiki size of the project
Uploads size of the project in bytes
"""
uploadsSize: Float
"""
Wiki size of the project in bytes
"""
wikiSize: Float
}
......@@ -18885,6 +18890,11 @@ type RootStorageStatistics {
"""
storageSize: Float!
"""
The uploads size in bytes
"""
uploadsSize: Float!
"""
The wiki size in bytes
"""
......
......@@ -49615,7 +49615,7 @@
"fields": [
{
"name": "buildArtifactsSize",
"description": "Build artifacts size of the project",
"description": "Build artifacts size of the project in bytes",
"args": [
],
......@@ -49651,7 +49651,7 @@
},
{
"name": "lfsObjectsSize",
"description": "Large File Storage (LFS) object size of the project",
"description": "Large File Storage (LFS) object size of the project in bytes",
"args": [
],
......@@ -49669,7 +49669,7 @@
},
{
"name": "packagesSize",
"description": "Packages size of the project",
"description": "Packages size of the project in bytes",
"args": [
],
......@@ -49687,7 +49687,7 @@
},
{
"name": "repositorySize",
"description": "Repository size of the project",
"description": "Repository size of the project in bytes",
"args": [
],
......@@ -49705,7 +49705,7 @@
},
{
"name": "snippetsSize",
"description": "Snippets size of the project",
"description": "Snippets size of the project in bytes",
"args": [
],
......@@ -49719,7 +49719,7 @@
},
{
"name": "storageSize",
"description": "Storage size of the project",
"description": "Storage size of the project in bytes",
"args": [
],
......@@ -49735,9 +49735,23 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "uploadsSize",
"description": "Uploads size of the project in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "wikiSize",
"description": "Wiki size of the project",
"description": "Wiki size of the project in bytes",
"args": [
],
......@@ -54533,6 +54547,24 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "uploadsSize",
"description": "The uploads size in bytes",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "wikiSize",
"description": "The wiki size in bytes",
......@@ -2435,14 +2435,15 @@ Represents a Project Membership.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `buildArtifactsSize` | Float! | Build artifacts size of the project |
| `buildArtifactsSize` | Float! | Build artifacts size of the project in bytes |
| `commitCount` | Float! | Commit count of the project |
| `lfsObjectsSize` | Float! | Large File Storage (LFS) object size of the project |
| `packagesSize` | Float! | Packages size of the project |
| `repositorySize` | Float! | Repository size of the project |
| `snippetsSize` | Float | Snippets size of the project |
| `storageSize` | Float! | Storage size of the project |
| `wikiSize` | Float | Wiki size of the project |
| `lfsObjectsSize` | Float! | Large File Storage (LFS) object size of the project in bytes |
| `packagesSize` | Float! | Packages size of the project in bytes |
| `repositorySize` | Float! | Repository size of the project in bytes |
| `snippetsSize` | Float | Snippets size of the project in bytes |
| `storageSize` | Float! | Storage size of the project in bytes |
| `uploadsSize` | Float | Uploads size of the project in bytes |
| `wikiSize` | Float | Wiki size of the project in bytes |
### PrometheusAlert
......@@ -2682,6 +2683,7 @@ Autogenerated return type of RevertVulnerabilityToDetected.
| `repositorySize` | Float! | The Git repository size in bytes |
| `snippetsSize` | Float! | The snippets size in bytes |
| `storageSize` | Float! | The total storage in bytes |
| `uploadsSize` | Float! | The uploads size in bytes |
| `wikiSize` | Float! | The wiki size in bytes |
### RunDASTScanPayload
......
......@@ -6,6 +6,6 @@ RSpec.describe GitlabSchema.types['ProjectStatistics'] do
it 'has all the required fields' do
expect(described_class).to have_graphql_fields(:storage_size, :repository_size, :lfs_objects_size,
:build_artifacts_size, :packages_size, :commit_count,
:wiki_size, :snippets_size)
:wiki_size, :snippets_size, :uploads_size)
end
end
......@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['RootStorageStatistics'] do
it 'has all the required fields' do
expect(described_class).to have_graphql_fields(:storage_size, :repository_size, :lfs_objects_size,
:build_artifacts_size, :packages_size, :wiki_size, :snippets_size,
:pipeline_artifacts_size)
:pipeline_artifacts_size, :uploads_size)
end
specify { expect(described_class).to require_graphql_authorizations(:read_statistics) }
......
......@@ -6,7 +6,7 @@ RSpec.describe 'rendering namespace statistics' do
include GraphqlHelpers
let(:namespace) { user.namespace }
let!(:statistics) { create(:namespace_root_storage_statistics, namespace: namespace, packages_size: 5.gigabytes) }
let!(:statistics) { create(:namespace_root_storage_statistics, namespace: namespace, packages_size: 5.gigabytes, uploads_size: 3.gigabytes) }
let(:user) { create(:user) }
let(:query) do
......@@ -28,6 +28,12 @@ RSpec.describe 'rendering namespace statistics' do
expect(graphql_data['namespace']['rootStorageStatistics']).not_to be_blank
expect(graphql_data['namespace']['rootStorageStatistics']['packagesSize']).to eq(5.gigabytes)
end
it 'includes uploads size if the user can read the statistics' do
post_graphql(query, current_user: user)
expect(graphql_data_at(:namespace, :root_storage_statistics, :uploads_size)).to eq(3.gigabytes)
end
end
it_behaves_like 'a working namespace with storage statistics query'
......
......@@ -6,7 +6,7 @@ RSpec.describe 'rendering project statistics' do
include GraphqlHelpers
let(:project) { create(:project) }
let!(:project_statistics) { create(:project_statistics, project: project, packages_size: 5.gigabytes) }
let!(:project_statistics) { create(:project_statistics, project: project, packages_size: 5.gigabytes, uploads_size: 3.gigabytes) }
let(:user) { create(:user) }
let(:query) do
......@@ -31,6 +31,12 @@ RSpec.describe 'rendering project statistics' do
expect(graphql_data['project']['statistics']['packagesSize']).to eq(5.gigabytes)
end
it 'includes uploads size if the user can read the statistics' do
post_graphql(query, current_user: user)
expect(graphql_data_at(:project, :statistics, :uploadsSize)).to eq(3.gigabytes)
end
context 'when the project is public' do
let(:project) { create(:project, :public) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment