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
a3b5e41b
Commit
a3b5e41b
authored
Nov 24, 2021
by
Nicolò Maria Mezzopera
Committed by
Illya Klymov
Nov 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: refetch the right query after tag deletion
parent
b70d6a27
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
15 deletions
+34
-15
app/assets/javascripts/packages_and_registries/container_registry/explorer/components/details_page/details_header.vue
...istry/explorer/components/details_page/details_header.vue
+0
-1
app/assets/javascripts/packages_and_registries/container_registry/explorer/graphql/queries/get_container_repository_tags.query.graphql
...aphql/queries/get_container_repository_tags.query.graphql
+1
-0
app/assets/javascripts/packages_and_registries/container_registry/explorer/pages/details.vue
..._registries/container_registry/explorer/pages/details.vue
+4
-2
spec/frontend/packages_and_registries/container_registry/explorer/mock_data.js
...s_and_registries/container_registry/explorer/mock_data.js
+2
-1
spec/frontend/packages_and_registries/container_registry/explorer/pages/details_spec.js
...istries/container_registry/explorer/pages/details_spec.js
+27
-11
No files found.
app/assets/javascripts/packages_and_registries/container_registry/explorer/components/details_page/details_header.vue
View file @
a3b5e41b
...
...
@@ -46,7 +46,6 @@ export default {
data
()
{
return
{
containerRepository
:
{},
fetchTagsCount
:
false
,
};
},
apollo
:
{
...
...
app/assets/javascripts/packages_and_registries/container_registry/explorer/graphql/queries/get_container_repository_tags.query.graphql
View file @
a3b5e41b
...
...
@@ -9,6 +9,7 @@ query getContainerRepositoryTags(
)
{
containerRepository
(
id
:
$id
)
{
id
tagsCount
tags
(
after
:
$after
,
before
:
$before
,
first
:
$first
,
last
:
$last
)
{
nodes
{
digest
...
...
app/assets/javascripts/packages_and_registries/container_registry/explorer/pages/details.vue
View file @
a3b5e41b
...
...
@@ -25,9 +25,11 @@ import {
UNFINISHED_STATUS
,
MISSING_OR_DELETED_IMAGE_BREADCRUMB
,
ROOT_IMAGE_TEXT
,
GRAPHQL_PAGE_SIZE
,
}
from
'
../constants/index
'
;
import
deleteContainerRepositoryTagsMutation
from
'
../graphql/mutations/delete_container_repository_tags.mutation.graphql
'
;
import
getContainerRepositoryDetailsQuery
from
'
../graphql/queries/get_container_repository_details.query.graphql
'
;
import
getContainerRepositoryTagsQuery
from
'
../graphql/queries/get_container_repository_tags.query.graphql
'
;
export
default
{
name
:
'
RegistryDetailsPage
'
,
...
...
@@ -133,8 +135,8 @@ export default {
awaitRefetchQueries
:
true
,
refetchQueries
:
[
{
query
:
getContainerRepository
Detail
sQuery
,
variables
:
this
.
queryVariables
,
query
:
getContainerRepository
Tag
sQuery
,
variables
:
{
...
this
.
queryVariables
,
first
:
GRAPHQL_PAGE_SIZE
}
,
},
],
});
...
...
spec/frontend/packages_and_registries/container_registry/explorer/mock_data.js
View file @
a3b5e41b
...
...
@@ -167,6 +167,7 @@ export const imageTagsMock = (nodes = tagsMock) => ({
data
:
{
containerRepository
:
{
id
:
containerRepositoryMock
.
id
,
tagsCount
:
nodes
.
length
,
tags
:
{
nodes
,
pageInfo
:
{
...
tagsPageInfo
},
...
...
@@ -191,7 +192,7 @@ export const graphQLImageDetailsMock = (override) => ({
data
:
{
containerRepository
:
{
...
containerRepositoryMock
,
tagsCount
:
tagsMock
.
length
,
tags
:
{
nodes
:
tagsMock
,
pageInfo
:
{
...
tagsPageInfo
},
...
...
spec/frontend/packages_and_registries/container_registry/explorer/pages/details_spec.js
View file @
a3b5e41b
import
{
GlKeysetPagination
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
{
nextTick
}
from
'
vue
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
...
...
@@ -22,6 +23,7 @@ import {
}
from
'
~/packages_and_registries/container_registry/explorer/constants
'
;
import
deleteContainerRepositoryTagsMutation
from
'
~/packages_and_registries/container_registry/explorer/graphql/mutations/delete_container_repository_tags.mutation.graphql
'
;
import
getContainerRepositoryDetailsQuery
from
'
~/packages_and_registries/container_registry/explorer/graphql/queries/get_container_repository_details.query.graphql
'
;
import
getContainerRepositoryTagsQuery
from
'
~/packages_and_registries/container_registry/explorer/graphql/queries/get_container_repository_tags.query.graphql
'
;
import
component
from
'
~/packages_and_registries/container_registry/explorer/pages/details.vue
'
;
import
Tracking
from
'
~/tracking
'
;
...
...
@@ -32,6 +34,7 @@ import {
containerRepositoryMock
,
graphQLEmptyImageDetailsMock
,
tagsMock
,
imageTagsMock
,
}
from
'
../mock_data
'
;
import
{
DeleteModal
}
from
'
../stubs
'
;
...
...
@@ -67,12 +70,13 @@ describe('Details Page', () => {
const
waitForApolloRequestRender
=
async
()
=>
{
await
waitForPromises
();
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
};
const
mountComponent
=
({
resolver
=
jest
.
fn
().
mockResolvedValue
(
graphQLImageDetailsMock
()),
mutationResolver
=
jest
.
fn
().
mockResolvedValue
(
graphQLDeleteImageRepositoryTagsMock
),
tagsResolver
=
jest
.
fn
().
mockResolvedValue
(
graphQLImageDetailsMock
(
imageTagsMock
)),
options
,
config
=
{},
}
=
{})
=>
{
...
...
@@ -81,6 +85,7 @@ describe('Details Page', () => {
const
requestHandlers
=
[
[
getContainerRepositoryDetailsQuery
,
resolver
],
[
deleteContainerRepositoryTagsMutation
,
mutationResolver
],
[
getContainerRepositoryTagsQuery
,
tagsResolver
],
];
apolloProvider
=
createMockApollo
(
requestHandlers
);
...
...
@@ -242,38 +247,49 @@ describe('Details Page', () => {
describe
(
'
confirmDelete event
'
,
()
=>
{
let
mutationResolver
;
let
tagsResolver
;
beforeEach
(()
=>
{
mutationResolver
=
jest
.
fn
().
mockResolvedValue
(
graphQLDeleteImageRepositoryTagsMock
);
mountComponent
({
mutationResolver
});
tagsResolver
=
jest
.
fn
().
mockResolvedValue
(
graphQLImageDetailsMock
(
imageTagsMock
));
mountComponent
({
mutationResolver
,
tagsResolver
});
return
waitForApolloRequestRender
();
});
describe
(
'
when one item is selected to be deleted
'
,
()
=>
{
it
(
'
calls apollo mutation with the right parameters
'
,
async
()
=>
{
it
(
'
calls apollo mutation with the right parameters
and refetches the tags list query
'
,
async
()
=>
{
findTagsList
().
vm
.
$emit
(
'
delete
'
,
[
cleanTags
[
0
]]);
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
findDeleteModal
().
vm
.
$emit
(
'
confirmDelete
'
);
expect
(
mutationResolver
).
toHaveBeenCalledWith
(
expect
.
objectContaining
({
tagNames
:
[
cleanTags
[
0
].
name
]
}),
);
await
waitForPromises
();
expect
(
tagsResolver
).
toHaveBeenCalled
();
});
});
describe
(
'
when more than one item is selected to be deleted
'
,
()
=>
{
it
(
'
calls apollo mutation with the right parameters
'
,
async
()
=>
{
it
(
'
calls apollo mutation with the right parameters
and refetches the tags list query
'
,
async
()
=>
{
findTagsList
().
vm
.
$emit
(
'
delete
'
,
tagsMock
);
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
findDeleteModal
().
vm
.
$emit
(
'
confirmDelete
'
);
expect
(
mutationResolver
).
toHaveBeenCalledWith
(
expect
.
objectContaining
({
tagNames
:
tagsMock
.
map
((
t
)
=>
t
.
name
)
}),
);
await
waitForPromises
();
expect
(
tagsResolver
).
toHaveBeenCalled
();
});
});
});
...
...
@@ -382,7 +398,7 @@ describe('Details Page', () => {
findPartialCleanupAlert
().
vm
.
$emit
(
'
dismiss
'
);
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
axios
.
post
).
toHaveBeenCalledWith
(
config
.
userCalloutsPath
,
{
feature_name
:
config
.
userCalloutId
,
...
...
@@ -472,7 +488,7 @@ describe('Details Page', () => {
await
waitForApolloRequestRender
();
findDetailsHeader
().
vm
.
$emit
(
'
delete
'
);
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
};
it
(
'
on delete event it deletes the image
'
,
async
()
=>
{
...
...
@@ -497,13 +513,13 @@ describe('Details Page', () => {
findDeleteImage
().
vm
.
$emit
(
'
start
'
);
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
findTagsLoader
().
exists
()).
toBe
(
true
);
findDeleteImage
().
vm
.
$emit
(
'
end
'
);
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
findTagsLoader
().
exists
()).
toBe
(
false
);
});
...
...
@@ -513,7 +529,7 @@ describe('Details Page', () => {
findDeleteImage
().
vm
.
$emit
(
'
error
'
);
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
findDeleteAlert
().
props
(
'
deleteAlertType
'
)).
toBe
(
ALERT_DANGER_IMAGE
);
});
...
...
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