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
c2c3804d
Commit
c2c3804d
authored
Dec 23, 2020
by
David Fernandez
Committed by
Kerri Miller
Dec 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the graphQL type for container repository tags
Properly encode the total size as a BigInt
parent
585f88b4
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
74 additions
and
14 deletions
+74
-14
app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue
...gistry/explorer/components/details_page/tags_list_row.vue
+3
-1
app/graphql/types/container_repository_tag_type.rb
app/graphql/types/container_repository_tag_type.rb
+1
-1
changelogs/unreleased/10io-fix-graphql-container-repository-tag-size-type.yml
...d/10io-fix-graphql-container-repository-tag-size-type.yml
+5
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+7
-1
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+11
-1
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-1
spec/fixtures/api/schemas/graphql/container_repository_details.json
...res/api/schemas/graphql/container_repository_details.json
+1
-1
spec/frontend/registry/explorer/components/details_page/tags_list_row_spec.js
...ry/explorer/components/details_page/tags_list_row_spec.js
+10
-4
spec/frontend/registry/explorer/mock_data.js
spec/frontend/registry/explorer/mock_data.js
+2
-2
spec/requests/api/graphql/container_repository/container_repository_details_spec.rb
...container_repository/container_repository_details_spec.rb
+33
-2
No files found.
app/assets/javascripts/registry/explorer/components/details_page/tags_list_row.vue
View file @
c2c3804d
...
...
@@ -63,7 +63,9 @@ export default {
},
computed
:
{
formattedSize
()
{
return
this
.
tag
.
totalSize
?
numberToHumanSize
(
this
.
tag
.
totalSize
)
:
NOT_AVAILABLE_SIZE
;
return
this
.
tag
.
totalSize
?
numberToHumanSize
(
Number
(
this
.
tag
.
totalSize
))
:
NOT_AVAILABLE_SIZE
;
},
layers
()
{
return
this
.
tag
.
layers
?
n__
(
'
%d layer
'
,
'
%d layers
'
,
this
.
tag
.
layers
)
:
''
;
...
...
app/graphql/types/container_repository_tag_type.rb
View file @
c2c3804d
...
...
@@ -14,7 +14,7 @@ module Types
field
:digest
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Digest of the tag.'
field
:revision
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Revision of the tag.'
field
:short_revision
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Short revision of the tag.'
field
:total_size
,
GraphQL
::
INT_TYPE
,
null:
true
,
description:
'The size of the tag.'
field
:total_size
,
GraphQL
::
Types
::
BigInt
,
null:
true
,
description:
'The size of the tag.'
field
:created_at
,
Types
::
TimeType
,
null:
true
,
description:
'Timestamp when the tag was created.'
field
:can_delete
,
GraphQL
::
BOOLEAN_TYPE
,
null:
false
,
description:
'Can the current user delete this tag.'
...
...
changelogs/unreleased/10io-fix-graphql-container-repository-tag-size-type.yml
0 → 100644
View file @
c2c3804d
---
title
:
Fix the graphQL type for container repository tags
merge_request
:
50419
author
:
type
:
fixed
doc/api/graphql/reference/gitlab_schema.graphql
View file @
c2c3804d
...
...
@@ -1149,6 +1149,12 @@ type BaseService implements Service {
type
:
String
}
"""
Represents non-fractional signed whole numeric values. Since the value may
exceed the size of a 32-bit integer, it's encoded as a string.
"""
scalar
BigInt
type
Blob
implements
Entry
{
"""
Flat
path
of
the
entry
...
...
@@ -4075,7 +4081,7 @@ type ContainerRepositoryTag {
"""
The
size
of
the
tag
.
"""
totalSize
:
Int
totalSize
:
Big
Int
}
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
c2c3804d
...
...
@@ -3009,6 +3009,16 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "SCALAR",
"name": "BigInt",
"description": "Represents non-fractional signed whole numeric values. Since the value may exceed the size of a 32-bit integer, it's encoded as a string.",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Blob",
...
...
@@ -11105,7 +11115,7 @@
],
"type": {
"kind": "SCALAR",
"name": "Int",
"name": "
Big
Int",
"ofType": null
},
"isDeprecated": false,
doc/api/graphql/reference/index.md
View file @
c2c3804d
...
...
@@ -640,7 +640,7 @@ A tag from a container repository.
|
`path`
| String! | Path of the tag. |
|
`revision`
| String | Revision of the tag. |
|
`shortRevision`
| String | Short revision of the tag. |
|
`totalSize`
| Int | The size of the tag. |
|
`totalSize`
|
Big
Int | The size of the tag. |
### CreateAlertIssuePayload
...
...
spec/fixtures/api/schemas/graphql/container_repository_details.json
View file @
c2c3804d
...
...
@@ -32,7 +32,7 @@
"type"
:
"string"
},
"totalSize"
:
{
"type"
:
"
integer
"
"type"
:
"
string
"
},
"createdAt"
:
{
"type"
:
"string"
...
...
spec/frontend/registry/explorer/components/details_page/tags_list_row_spec.js
View file @
c2c3804d
...
...
@@ -172,25 +172,31 @@ describe('tags list row', () => {
});
it
(
'
contains the totalSize and layers
'
,
()
=>
{
mountComponent
({
...
defaultProps
,
tag
:
{
...
tag
,
totalSize
:
1024
,
layers
:
10
}
});
mountComponent
({
...
defaultProps
,
tag
:
{
...
tag
,
totalSize
:
'
1024
'
,
layers
:
10
}
});
expect
(
findSize
().
text
()).
toMatchInterpolatedText
(
'
1.00 KiB · 10 layers
'
);
});
it
(
'
when totalSize is giantic
'
,
()
=>
{
mountComponent
({
...
defaultProps
,
tag
:
{
...
tag
,
totalSize
:
'
1099511627776
'
,
layers
:
2
}
});
expect
(
findSize
().
text
()).
toMatchInterpolatedText
(
'
1024.00 GiB · 2 layers
'
);
});
it
(
'
when totalSize is missing
'
,
()
=>
{
mountComponent
({
...
defaultProps
,
tag
:
{
...
tag
,
totalSize
:
0
,
layers
:
10
}
});
mountComponent
({
...
defaultProps
,
tag
:
{
...
tag
,
totalSize
:
'
0
'
,
layers
:
10
}
});
expect
(
findSize
().
text
()).
toMatchInterpolatedText
(
`
${
NOT_AVAILABLE_SIZE
}
· 10 layers`
);
});
it
(
'
when layers are missing
'
,
()
=>
{
mountComponent
({
...
defaultProps
,
tag
:
{
...
tag
,
totalSize
:
1024
}
});
mountComponent
({
...
defaultProps
,
tag
:
{
...
tag
,
totalSize
:
'
1024
'
}
});
expect
(
findSize
().
text
()).
toMatchInterpolatedText
(
'
1.00 KiB
'
);
});
it
(
'
when there is 1 layer
'
,
()
=>
{
mountComponent
({
...
defaultProps
,
tag
:
{
...
tag
,
totalSize
:
0
,
layers
:
1
}
});
mountComponent
({
...
defaultProps
,
tag
:
{
...
tag
,
totalSize
:
'
0
'
,
layers
:
1
}
});
expect
(
findSize
().
text
()).
toMatchInterpolatedText
(
`
${
NOT_AVAILABLE_SIZE
}
· 1 layer`
);
});
...
...
spec/frontend/registry/explorer/mock_data.js
View file @
c2c3804d
...
...
@@ -140,7 +140,7 @@ export const tagsMock = [
revision
:
'
c2613843ab33aabf847965442b13a8b55a56ae28837ce182627c0716eb08c02b
'
,
shortRevision
:
'
c2613843a
'
,
createdAt
:
'
2020-11-03T13:29:38+00:00
'
,
totalSize
:
105
,
totalSize
:
'
1099511627776
'
,
canDelete
:
true
,
__typename
:
'
ContainerRepositoryTag
'
,
},
...
...
@@ -152,7 +152,7 @@ export const tagsMock = [
revision
:
'
df44e7228f0f255c73e35b6f0699624a615f42746e3e8e2e4b3804a6d6fc3292
'
,
shortRevision
:
'
df44e7228
'
,
createdAt
:
'
2020-11-03T13:29:32+00:00
'
,
totalSize
:
104
,
totalSize
:
'
536870912000
'
,
canDelete
:
true
,
__typename
:
'
ContainerRepositoryTag
'
,
},
...
...
spec/requests/api/graphql/container_repository/container_repository_details_spec.rb
View file @
c2c3804d
...
...
@@ -19,7 +19,7 @@ RSpec.describe 'container repository details' do
let
(
:user
)
{
project
.
owner
}
let
(
:variables
)
{
{}
}
let
(
:tags
)
{
%w
(latest tag1 tag2 tag3 tag4 tag5)
}
let
(
:tags
)
{
%w
[latest tag1 tag2 tag3 tag4 tag5]
}
let
(
:container_repository_global_id
)
{
container_repository
.
to_global_id
.
to_s
}
let
(
:container_repository_details_response
)
{
graphql_data
.
dig
(
'containerRepository'
)
}
...
...
@@ -77,6 +77,37 @@ RSpec.describe 'container repository details' do
end
end
context
'with a giant size tag'
do
let
(
:tags
)
{
%w[latest]
}
let
(
:giant_size
)
{
1
.
terabyte
}
let
(
:tag_sizes_response
)
{
graphql_data_at
(
'containerRepository'
,
'tags'
,
'nodes'
,
'totalSize'
)
}
let
(
:fields
)
do
<<~
GQL
tags {
nodes {
totalSize
}
}
GQL
end
let
(
:query
)
do
graphql_query_for
(
'containerRepository'
,
{
id:
container_repository_global_id
},
fields
)
end
it
'returns the expected value as a string'
do
stub_next_container_registry_tags_call
(
:total_size
,
giant_size
)
subject
expect
(
tag_sizes_response
.
first
).
to
eq
(
giant_size
.
to_s
)
end
end
context
'limiting the number of tags'
do
let
(
:limit
)
{
2
}
let
(
:tags_response
)
{
container_repository_details_response
.
dig
(
'tags'
,
'edges'
)
}
...
...
@@ -107,7 +138,7 @@ RSpec.describe 'container repository details' do
end
end
context
'with tags with
out a manifest
'
do
context
'with tags with
a manifest containing nil fields
'
do
let
(
:tags_response
)
{
container_repository_details_response
.
dig
(
'tags'
,
'nodes'
)
}
let
(
:errors
)
{
container_repository_details_response
.
dig
(
'errors'
)
}
...
...
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