Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3b502092
Commit
3b502092
authored
Nov 16, 2020
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GraphQL for new uploads in storage types
We added uploads_size to statistics, so let's make them queryable
parent
863b2d18
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
96 additions
and
32 deletions
+96
-32
app/graphql/types/project_statistics_type.rb
app/graphql/types/project_statistics_type.rb
+9
-7
app/graphql/types/root_storage_statistics_type.rb
app/graphql/types/root_storage_statistics_type.rb
+1
-0
changelogs/unreleased/241980-uploalds-on-storage-graphql.yml
changelogs/unreleased/241980-uploalds-on-storage-graphql.yml
+5
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+17
-7
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+39
-7
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+9
-7
spec/graphql/types/project_statistics_type_spec.rb
spec/graphql/types/project_statistics_type_spec.rb
+1
-1
spec/graphql/types/root_storage_statistics_type_spec.rb
spec/graphql/types/root_storage_statistics_type_spec.rb
+1
-1
spec/requests/api/graphql/namespace/root_storage_statistics_spec.rb
...sts/api/graphql/namespace/root_storage_statistics_spec.rb
+7
-1
spec/requests/api/graphql/project/project_statistics_spec.rb
spec/requests/api/graphql/project/project_statistics_spec.rb
+7
-1
No files found.
app/graphql/types/project_statistics_type.rb
View file @
3b502092
...
@@ -10,18 +10,20 @@ module Types
...
@@ -10,18 +10,20 @@ module Types
description:
'Commit count of the project'
description:
'Commit count of the project'
field
:storage_size
,
GraphQL
::
FLOAT_TYPE
,
null:
false
,
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
,
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
,
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
,
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
,
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
,
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
,
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
end
end
app/graphql/types/root_storage_statistics_type.rb
View file @
3b502092
...
@@ -14,5 +14,6 @@ module Types
...
@@ -14,5 +14,6 @@ module Types
field
:wiki_size
,
GraphQL
::
FLOAT_TYPE
,
null:
false
,
description:
'The wiki 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
: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
: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
end
end
changelogs/unreleased/241980-uploalds-on-storage-graphql.yml
0 → 100644
View file @
3b502092
---
title
:
'
GraphQL:
Expose
uploads_size
for
project_statistics
and
root_storage_statistics'
merge_request
:
47820
author
:
type
:
added
doc/api/graphql/reference/gitlab_schema.graphql
View file @
3b502092
...
@@ -16855,7 +16855,7 @@ type ProjectPermissions {
...
@@ -16855,7 +16855,7 @@ type ProjectPermissions {
type
ProjectStatistics
{
type
ProjectStatistics
{
"""
"""
Build
artifacts
size
of
the
project
Build
artifacts
size
of
the
project
in
bytes
"""
"""
buildArtifactsSize
:
Float
!
buildArtifactsSize
:
Float
!
...
@@ -16865,32 +16865,37 @@ type ProjectStatistics {
...
@@ -16865,32 +16865,37 @@ type ProjectStatistics {
commitCount
:
Float
!
commitCount
:
Float
!
"""
"""
Large
File
Storage
(
LFS
)
object
size
of
the
project
Large
File
Storage
(
LFS
)
object
size
of
the
project
in
bytes
"""
"""
lfsObjectsSize
:
Float
!
lfsObjectsSize
:
Float
!
"""
"""
Packages
size
of
the
project
Packages
size
of
the
project
in
bytes
"""
"""
packagesSize
:
Float
!
packagesSize
:
Float
!
"""
"""
Repository
size
of
the
project
Repository
size
of
the
project
in
bytes
"""
"""
repositorySize
:
Float
!
repositorySize
:
Float
!
"""
"""
Snippets
size
of
the
project
Snippets
size
of
the
project
in
bytes
"""
"""
snippetsSize
:
Float
snippetsSize
:
Float
"""
"""
Storage
size
of
the
project
Storage
size
of
the
project
in
bytes
"""
"""
storageSize
:
Float
!
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
wikiSize
:
Float
}
}
...
@@ -18674,6 +18679,11 @@ type RootStorageStatistics {
...
@@ -18674,6 +18679,11 @@ type RootStorageStatistics {
"""
"""
storageSize
:
Float
!
storageSize
:
Float
!
"""
The
uploads
size
in
bytes
"""
uploadsSize
:
Float
!
"""
"""
The
wiki
size
in
bytes
The
wiki
size
in
bytes
"""
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
3b502092
...
@@ -49054,7 +49054,7 @@
...
@@ -49054,7 +49054,7 @@
"fields": [
"fields": [
{
{
"name": "buildArtifactsSize",
"name": "buildArtifactsSize",
"description": "Build artifacts size of the project",
"description": "Build artifacts size of the project
in bytes
",
"args": [
"args": [
],
],
...
@@ -49090,7 +49090,7 @@
...
@@ -49090,7 +49090,7 @@
},
},
{
{
"name": "lfsObjectsSize",
"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": [
"args": [
],
],
...
@@ -49108,7 +49108,7 @@
...
@@ -49108,7 +49108,7 @@
},
},
{
{
"name": "packagesSize",
"name": "packagesSize",
"description": "Packages size of the project",
"description": "Packages size of the project
in bytes
",
"args": [
"args": [
],
],
...
@@ -49126,7 +49126,7 @@
...
@@ -49126,7 +49126,7 @@
},
},
{
{
"name": "repositorySize",
"name": "repositorySize",
"description": "Repository size of the project",
"description": "Repository size of the project
in bytes
",
"args": [
"args": [
],
],
...
@@ -49144,7 +49144,7 @@
...
@@ -49144,7 +49144,7 @@
},
},
{
{
"name": "snippetsSize",
"name": "snippetsSize",
"description": "Snippets size of the project",
"description": "Snippets size of the project
in bytes
",
"args": [
"args": [
],
],
...
@@ -49158,7 +49158,7 @@
...
@@ -49158,7 +49158,7 @@
},
},
{
{
"name": "storageSize",
"name": "storageSize",
"description": "Storage size of the project",
"description": "Storage size of the project
in bytes
",
"args": [
"args": [
],
],
...
@@ -49174,9 +49174,23 @@
...
@@ -49174,9 +49174,23 @@
"isDeprecated": false,
"isDeprecated": false,
"deprecationReason": null
"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",
"name": "wikiSize",
"description": "Wiki size of the project",
"description": "Wiki size of the project
in bytes
",
"args": [
"args": [
],
],
...
@@ -53972,6 +53986,24 @@
...
@@ -53972,6 +53986,24 @@
"isDeprecated": false,
"isDeprecated": false,
"deprecationReason": null
"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",
"name": "wikiSize",
"description": "The wiki size in bytes",
"description": "The wiki size in bytes",
doc/api/graphql/reference/index.md
View file @
3b502092
...
@@ -2410,14 +2410,15 @@ Represents a Project Membership.
...
@@ -2410,14 +2410,15 @@ Represents a Project Membership.
| Field | Type | Description |
| 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 |
|
`commitCount`
| Float! | Commit count of the project |
|
`lfsObjectsSize`
| Float! | Large File Storage (LFS) object size of the project |
|
`lfsObjectsSize`
| Float! | Large File Storage (LFS) object size of the project in bytes |
|
`packagesSize`
| Float! | Packages size of the project |
|
`packagesSize`
| Float! | Packages size of the project in bytes |
|
`repositorySize`
| Float! | Repository size of the project |
|
`repositorySize`
| Float! | Repository size of the project in bytes |
|
`snippetsSize`
| Float | Snippets size of the project |
|
`snippetsSize`
| Float | Snippets size of the project in bytes |
|
`storageSize`
| Float! | Storage size of the project |
|
`storageSize`
| Float! | Storage size of the project in bytes |
|
`wikiSize`
| Float | Wiki size of the project |
|
`uploadsSize`
| Float | Uploads size of the project in bytes |
|
`wikiSize`
| Float | Wiki size of the project in bytes |
### PrometheusAlert
### PrometheusAlert
...
@@ -2657,6 +2658,7 @@ Autogenerated return type of RevertVulnerabilityToDetected.
...
@@ -2657,6 +2658,7 @@ Autogenerated return type of RevertVulnerabilityToDetected.
|
`repositorySize`
| Float! | The Git repository size in bytes |
|
`repositorySize`
| Float! | The Git repository size in bytes |
|
`snippetsSize`
| Float! | The snippets size in bytes |
|
`snippetsSize`
| Float! | The snippets size in bytes |
|
`storageSize`
| Float! | The total storage in bytes |
|
`storageSize`
| Float! | The total storage in bytes |
|
`uploadsSize`
| Float! | The uploads size in bytes |
|
`wikiSize`
| Float! | The wiki size in bytes |
|
`wikiSize`
| Float! | The wiki size in bytes |
### RunDASTScanPayload
### RunDASTScanPayload
...
...
spec/graphql/types/project_statistics_type_spec.rb
View file @
3b502092
...
@@ -6,6 +6,6 @@ RSpec.describe GitlabSchema.types['ProjectStatistics'] do
...
@@ -6,6 +6,6 @@ RSpec.describe GitlabSchema.types['ProjectStatistics'] do
it
'has all the required fields'
do
it
'has all the required fields'
do
expect
(
described_class
).
to
have_graphql_fields
(
:storage_size
,
:repository_size
,
:lfs_objects_size
,
expect
(
described_class
).
to
have_graphql_fields
(
:storage_size
,
:repository_size
,
:lfs_objects_size
,
:build_artifacts_size
,
:packages_size
,
:commit_count
,
:build_artifacts_size
,
:packages_size
,
:commit_count
,
:wiki_size
,
:snippets_size
)
:wiki_size
,
:snippets_size
,
:uploads_size
)
end
end
end
end
spec/graphql/types/root_storage_statistics_type_spec.rb
View file @
3b502092
...
@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['RootStorageStatistics'] do
...
@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['RootStorageStatistics'] do
it
'has all the required fields'
do
it
'has all the required fields'
do
expect
(
described_class
).
to
have_graphql_fields
(
:storage_size
,
:repository_size
,
:lfs_objects_size
,
expect
(
described_class
).
to
have_graphql_fields
(
:storage_size
,
:repository_size
,
:lfs_objects_size
,
:build_artifacts_size
,
:packages_size
,
:wiki_size
,
:snippets_size
,
:build_artifacts_size
,
:packages_size
,
:wiki_size
,
:snippets_size
,
:pipeline_artifacts_size
)
:pipeline_artifacts_size
,
:uploads_size
)
end
end
specify
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:read_statistics
)
}
specify
{
expect
(
described_class
).
to
require_graphql_authorizations
(
:read_statistics
)
}
...
...
spec/requests/api/graphql/namespace/root_storage_statistics_spec.rb
View file @
3b502092
...
@@ -6,7 +6,7 @@ RSpec.describe 'rendering namespace statistics' do
...
@@ -6,7 +6,7 @@ RSpec.describe 'rendering namespace statistics' do
include
GraphqlHelpers
include
GraphqlHelpers
let
(
:namespace
)
{
user
.
namespace
}
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
(
:user
)
{
create
(
:user
)
}
let
(
:query
)
do
let
(
:query
)
do
...
@@ -28,6 +28,12 @@ RSpec.describe 'rendering namespace statistics' 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'
]).
not_to
be_blank
expect
(
graphql_data
[
'namespace'
][
'rootStorageStatistics'
][
'packagesSize'
]).
to
eq
(
5
.
gigabytes
)
expect
(
graphql_data
[
'namespace'
][
'rootStorageStatistics'
][
'packagesSize'
]).
to
eq
(
5
.
gigabytes
)
end
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
end
it_behaves_like
'a working namespace with storage statistics query'
it_behaves_like
'a working namespace with storage statistics query'
...
...
spec/requests/api/graphql/project/project_statistics_spec.rb
View file @
3b502092
...
@@ -6,7 +6,7 @@ RSpec.describe 'rendering project statistics' do
...
@@ -6,7 +6,7 @@ RSpec.describe 'rendering project statistics' do
include
GraphqlHelpers
include
GraphqlHelpers
let
(
:project
)
{
create
(
:project
)
}
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
(
:user
)
{
create
(
:user
)
}
let
(
:query
)
do
let
(
:query
)
do
...
@@ -31,6 +31,12 @@ RSpec.describe 'rendering project statistics' do
...
@@ -31,6 +31,12 @@ RSpec.describe 'rendering project statistics' do
expect
(
graphql_data
[
'project'
][
'statistics'
][
'packagesSize'
]).
to
eq
(
5
.
gigabytes
)
expect
(
graphql_data
[
'project'
][
'statistics'
][
'packagesSize'
]).
to
eq
(
5
.
gigabytes
)
end
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
context
'when the project is public'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment