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
Hide 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
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
app/graphql/types/root_storage_statistics_type.rb
View file @
3b502092
...
...
@@ -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
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 {
type
ProjectStatistics
{
"""
Build
artifacts
size
of
the
project
Build
artifacts
size
of
the
project
in
bytes
"""
buildArtifactsSize
:
Float
!
...
...
@@ -16865,32 +16865,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
}
...
...
@@ -18674,6 +18679,11 @@ type RootStorageStatistics {
"""
storageSize
:
Float
!
"""
The
uploads
size
in
bytes
"""
uploadsSize
:
Float
!
"""
The
wiki
size
in
bytes
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
3b502092
...
...
@@ -49054,7 +49054,7 @@
"fields": [
{
"name": "buildArtifactsSize",
"description": "Build artifacts size of the project",
"description": "Build artifacts size of the project
in bytes
",
"args": [
],
...
...
@@ -49090,7 +49090,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": [
],
...
...
@@ -49108,7 +49108,7 @@
},
{
"name": "packagesSize",
"description": "Packages size of the project",
"description": "Packages size of the project
in bytes
",
"args": [
],
...
...
@@ -49126,7 +49126,7 @@
},
{
"name": "repositorySize",
"description": "Repository size of the project",
"description": "Repository size of the project
in bytes
",
"args": [
],
...
...
@@ -49144,7 +49144,7 @@
},
{
"name": "snippetsSize",
"description": "Snippets size of the project",
"description": "Snippets size of the project
in bytes
",
"args": [
],
...
...
@@ -49158,7 +49158,7 @@
},
{
"name": "storageSize",
"description": "Storage size of the project",
"description": "Storage size of the project
in bytes
",
"args": [
],
...
...
@@ -49174,9 +49174,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": [
],
...
...
@@ -53972,6 +53986,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",
doc/api/graphql/reference/index.md
View file @
3b502092
...
...
@@ -2410,14 +2410,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
...
...
@@ -2657,6 +2658,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
...
...
spec/graphql/types/project_statistics_type_spec.rb
View file @
3b502092
...
...
@@ -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
spec/graphql/types/root_storage_statistics_type_spec.rb
View file @
3b502092
...
...
@@ -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
)
}
...
...
spec/requests/api/graphql/namespace/root_storage_statistics_spec.rb
View file @
3b502092
...
...
@@ -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'
...
...
spec/requests/api/graphql/project/project_statistics_spec.rb
View file @
3b502092
...
...
@@ -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
)
}
...
...
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