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
2acaad36
Commit
2acaad36
authored
Nov 09, 2021
by
Nicolò Maria Mezzopera
Committed by
Etienne Baqué
Nov 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix dependency proxy manifest sorting on pagination
parent
9d34f894
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
1 deletion
+48
-1
app/graphql/types/dependency_proxy/manifest_type.rb
app/graphql/types/dependency_proxy/manifest_type.rb
+1
-0
app/graphql/types/group_type.rb
app/graphql/types/group_type.rb
+4
-0
app/models/dependency_proxy/manifest.rb
app/models/dependency_proxy/manifest.rb
+2
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+7
-0
spec/graphql/types/dependency_proxy/manifest_type_spec.rb
spec/graphql/types/dependency_proxy/manifest_type_spec.rb
+1
-1
spec/models/dependency_proxy/manifest_spec.rb
spec/models/dependency_proxy/manifest_spec.rb
+11
-0
spec/requests/api/graphql/group/dependency_proxy_manifests_spec.rb
...ests/api/graphql/group/dependency_proxy_manifests_spec.rb
+22
-0
No files found.
app/graphql/types/dependency_proxy/manifest_type.rb
View file @
2acaad36
...
...
@@ -8,6 +8,7 @@ module Types
authorize
:read_dependency_proxy
field
:id
,
::
Types
::
GlobalIDType
[
::
DependencyProxy
::
Manifest
],
null:
false
,
description:
'ID of the manifest.'
field
:created_at
,
Types
::
TimeType
,
null:
false
,
description:
'Date of creation.'
field
:updated_at
,
Types
::
TimeType
,
null:
false
,
description:
'Date of most recent update.'
field
:file_name
,
GraphQL
::
Types
::
String
,
null:
false
,
description:
'Name of the manifest.'
...
...
app/graphql/types/group_type.rb
View file @
2acaad36
...
...
@@ -220,6 +220,10 @@ module Types
group
.
container_repositories
.
size
end
def
dependency_proxy_manifests
group
.
dependency_proxy_manifests
.
order_id_desc
end
def
dependency_proxy_image_count
group
.
dependency_proxy_manifests
.
count
end
...
...
app/models/dependency_proxy/manifest.rb
View file @
2acaad36
...
...
@@ -14,6 +14,8 @@ class DependencyProxy::Manifest < ApplicationRecord
validates
:file_name
,
presence:
true
validates
:digest
,
presence:
true
scope
:order_id_desc
,
->
{
reorder
(
id: :desc
)
}
mount_file_store_uploader
DependencyProxy
::
FileUploader
def
self
.
find_by_file_name_or_digest
(
file_name
:,
digest
:)
...
...
doc/api/graphql/reference/index.md
View file @
2acaad36
...
...
@@ -9236,6 +9236,7 @@ Dependency proxy manifest.
|
<a
id=
"dependencyproxymanifestcreatedat"
></a>
`createdAt`
|
[
`Time!`
](
#time
)
| Date of creation. |
|
<a
id=
"dependencyproxymanifestdigest"
></a>
`digest`
|
[
`String!`
](
#string
)
| Digest of the manifest. |
|
<a
id=
"dependencyproxymanifestfilename"
></a>
`fileName`
|
[
`String!`
](
#string
)
| Name of the manifest. |
|
<a
id=
"dependencyproxymanifestid"
></a>
`id`
|
[
`DependencyProxyManifestID!`
](
#dependencyproxymanifestid
)
| ID of the manifest. |
|
<a
id=
"dependencyproxymanifestimagename"
></a>
`imageName`
|
[
`String!`
](
#string
)
| Name of the image. |
|
<a
id=
"dependencyproxymanifestsize"
></a>
`size`
|
[
`String!`
](
#string
)
| Size of the manifest file. |
|
<a
id=
"dependencyproxymanifestupdatedat"
></a>
`updatedAt`
|
[
`Time!`
](
#time
)
| Date of most recent update. |
...
...
@@ -17275,6 +17276,12 @@ An example `DastSiteValidationID` is: `"gid://gitlab/DastSiteValidation/1"`.
Date represented in ISO 8601.
### `DependencyProxyManifestID`
A
`DependencyProxyManifestID`
is a global ID. It is encoded as a string.
An example
`DependencyProxyManifestID`
is:
`"gid://gitlab/DependencyProxy::Manifest/1"`
.
### `DesignManagementDesignAtVersionID`
A
`DesignManagementDesignAtVersionID`
is a global ID. It is encoded as a string.
...
...
spec/graphql/types/dependency_proxy/manifest_type_spec.rb
View file @
2acaad36
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
GitlabSchema
.
types
[
'DependencyProxyManifest'
]
do
it
'includes dependency proxy manifest fields'
do
expected_fields
=
%w[
file_name image_name size created_at updated_at digest
id
file_name image_name size created_at updated_at digest
]
expect
(
described_class
).
to
include_graphql_fields
(
*
expected_fields
)
...
...
spec/models/dependency_proxy/manifest_spec.rb
View file @
2acaad36
...
...
@@ -15,6 +15,17 @@ RSpec.describe DependencyProxy::Manifest, type: :model do
it
{
is_expected
.
to
validate_presence_of
(
:digest
)
}
end
describe
'scopes'
do
let_it_be
(
:manifest_one
)
{
create
(
:dependency_proxy_manifest
)
}
let_it_be
(
:manifest_two
)
{
create
(
:dependency_proxy_manifest
)
}
let_it_be
(
:manifests
)
{
[
manifest_one
,
manifest_two
]
}
let_it_be
(
:ids
)
{
manifests
.
map
(
&
:id
)
}
it
'order_id_desc'
do
expect
(
described_class
.
where
(
id:
ids
).
order_id_desc
.
to_a
).
to
eq
[
manifest_two
,
manifest_one
]
end
end
describe
'file is being stored'
do
subject
{
create
(
:dependency_proxy_manifest
)
}
...
...
spec/requests/api/graphql/group/dependency_proxy_manifests_spec.rb
View file @
2acaad36
...
...
@@ -116,4 +116,26 @@ RSpec.describe 'getting dependency proxy manifests in a group' do
expect
(
dependency_proxy_image_count_response
).
to
eq
(
manifests
.
size
)
end
describe
'sorting and pagination'
do
let
(
:data_path
)
{
[
'group'
,
:dependencyProxyManifests
]
}
let
(
:current_user
)
{
owner
}
context
'with default sorting'
do
let_it_be
(
:descending_manifests
)
{
manifests
.
reverse
.
map
{
|
manifest
|
global_id_of
(
manifest
)}
}
it_behaves_like
'sorted paginated query'
do
let
(
:sort_param
)
{
''
}
let
(
:first_param
)
{
2
}
let
(
:all_records
)
{
descending_manifests
}
end
end
def
pagination_query
(
params
)
# remove sort since the type does not accept sorting, but be future proof
graphql_query_for
(
'group'
,
{
'fullPath'
=>
group
.
full_path
},
query_nodes
(
:dependencyProxyManifests
,
:id
,
include_pagination_info:
true
,
args:
params
.
merge
(
sort:
nil
))
)
end
end
end
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