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
edc3beb1
Commit
edc3beb1
authored
Dec 07, 2021
by
Nicolò Maria Mezzopera
Committed by
Frédéric Caplette
Dec 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable bulk delete in tags list
- source - test Changelog: added
parent
b5848df6
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
221 deletions
+83
-221
app/assets/javascripts/packages_and_registries/container_registry/explorer/components/details_page/tags_list.vue
...r_registry/explorer/components/details_page/tags_list.vue
+29
-57
spec/features/groups/container_registry_spec.rb
spec/features/groups/container_registry_spec.rb
+1
-1
spec/features/projects/container_registry_spec.rb
spec/features/projects/container_registry_spec.rb
+1
-1
spec/frontend/packages_and_registries/container_registry/explorer/components/details_page/tags_list_spec.js
...gistry/explorer/components/details_page/tags_list_spec.js
+52
-162
No files found.
app/assets/javascripts/packages_and_registries/container_registry/explorer/components/details_page/tags_list.vue
View file @
edc3beb1
<
script
>
<
script
>
import
{
GlButton
,
GlKeysetPagination
}
from
'
@gitlab/ui
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
n__
}
from
'
~/locale
'
;
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
import
RegistryList
from
'
~/packages_and_registries/shared/components/registry_list.vue
'
;
import
{
import
{
REMOVE_TAGS_BUTTON_TITLE
,
REMOVE_TAGS_BUTTON_TITLE
,
TAGS_LIST_TITLE
,
TAGS_LIST_TITLE
,
...
@@ -16,11 +17,10 @@ import TagsLoader from './tags_loader.vue';
...
@@ -16,11 +17,10 @@ import TagsLoader from './tags_loader.vue';
export
default
{
export
default
{
name
:
'
TagsList
'
,
name
:
'
TagsList
'
,
components
:
{
components
:
{
GlButton
,
GlKeysetPagination
,
TagsListRow
,
TagsListRow
,
EmptyState
,
EmptyState
,
TagsLoader
,
TagsLoader
,
RegistryList
,
},
},
inject
:
[
'
config
'
],
inject
:
[
'
config
'
],
props
:
{
props
:
{
...
@@ -61,11 +61,13 @@ export default {
...
@@ -61,11 +61,13 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
selectedItems
:
{},
containerRepository
:
{},
containerRepository
:
{},
};
};
},
},
computed
:
{
computed
:
{
listTitle
()
{
return
n__
(
'
%d tag
'
,
'
%d tags
'
,
this
.
tags
.
length
);
},
tags
()
{
tags
()
{
return
this
.
containerRepository
?.
tags
?.
nodes
||
[];
return
this
.
containerRepository
?.
tags
?.
nodes
||
[];
},
},
...
@@ -78,18 +80,9 @@ export default {
...
@@ -78,18 +80,9 @@ export default {
first
:
GRAPHQL_PAGE_SIZE
,
first
:
GRAPHQL_PAGE_SIZE
,
};
};
},
},
hasSelectedItems
()
{
return
this
.
tags
.
some
((
tag
)
=>
this
.
selectedItems
[
tag
.
name
]);
},
showMultiDeleteButton
()
{
showMultiDeleteButton
()
{
return
this
.
tags
.
some
((
tag
)
=>
tag
.
canDelete
)
&&
!
this
.
isMobile
;
return
this
.
tags
.
some
((
tag
)
=>
tag
.
canDelete
)
&&
!
this
.
isMobile
;
},
},
multiDeleteButtonIsDisabled
()
{
return
!
this
.
hasSelectedItems
||
this
.
disabled
;
},
showPagination
()
{
return
this
.
tagsPageInfo
.
hasPreviousPage
||
this
.
tagsPageInfo
.
hasNextPage
;
},
hasNoTags
()
{
hasNoTags
()
{
return
this
.
tags
.
length
===
0
;
return
this
.
tags
.
length
===
0
;
},
},
...
@@ -98,19 +91,13 @@ export default {
...
@@ -98,19 +91,13 @@ export default {
},
},
},
},
methods
:
{
methods
:
{
updateSelectedItems
(
name
)
{
this
.
$set
(
this
.
selectedItems
,
name
,
!
this
.
selectedItems
[
name
]);
},
mapTagsToBeDleeted
(
items
)
{
return
this
.
tags
.
filter
((
tag
)
=>
items
[
tag
.
name
]);
},
fetchNextPage
()
{
fetchNextPage
()
{
this
.
$apollo
.
queries
.
containerRepository
.
fetchMore
({
this
.
$apollo
.
queries
.
containerRepository
.
fetchMore
({
variables
:
{
variables
:
{
after
:
this
.
tagsPageInfo
?.
endCursor
,
after
:
this
.
tagsPageInfo
?.
endCursor
,
first
:
GRAPHQL_PAGE_SIZE
,
first
:
GRAPHQL_PAGE_SIZE
,
},
},
updateQuery
(
previousResult
,
{
fetchMoreResult
})
{
updateQuery
(
_
,
{
fetchMoreResult
})
{
return
fetchMoreResult
;
return
fetchMoreResult
;
},
},
});
});
...
@@ -122,7 +109,7 @@ export default {
...
@@ -122,7 +109,7 @@ export default {
before
:
this
.
tagsPageInfo
?.
startCursor
,
before
:
this
.
tagsPageInfo
?.
startCursor
,
last
:
GRAPHQL_PAGE_SIZE
,
last
:
GRAPHQL_PAGE_SIZE
,
},
},
updateQuery
(
previousResult
,
{
fetchMoreResult
})
{
updateQuery
(
_
,
{
fetchMoreResult
})
{
return
fetchMoreResult
;
return
fetchMoreResult
;
},
},
});
});
...
@@ -137,42 +124,27 @@ export default {
...
@@ -137,42 +124,27 @@ export default {
<template
v-else
>
<template
v-else
>
<empty-state
v-if=
"hasNoTags"
:no-containers-image=
"config.noContainersImage"
/>
<empty-state
v-if=
"hasNoTags"
:no-containers-image=
"config.noContainersImage"
/>
<template
v-else
>
<template
v-else
>
<div
class=
"gl-display-flex gl-justify-content-space-between gl-mb-3"
>
<registry-list
<h5
data-testid=
"list-title"
>
:title=
"listTitle"
{{
$options
.
i18n
.
TAGS_LIST_TITLE
}}
:pagination=
"tagsPageInfo"
</h5>
:items=
"tags"
id-property=
"name"
<gl-button
@
prev-page=
"fetchPreviousPage"
v-if=
"showMultiDeleteButton"
@
next-page=
"fetchNextPage"
:disabled=
"multiDeleteButtonIsDisabled"
@
delete=
"$emit('delete', $event)"
category=
"secondary"
>
variant=
"danger"
<template
#default
="
{ selectItem, isSelected, item, first }">
@
click=
"$emit('delete', mapTagsToBeDleeted(selectedItems))"
<tags-list-row
>
:tag=
"item"
{{
$options
.
i18n
.
REMOVE_TAGS_BUTTON_TITLE
}}
:first=
"first"
</gl-button>
:selected=
"isSelected(item)"
</div>
:is-mobile=
"isMobile"
<tags-list-row
:disabled=
"disabled"
v-for=
"(tag, index) in tags"
@
select=
"selectItem(item)"
:key=
"tag.path"
@
delete=
"$emit('delete', [item])"
:tag=
"tag"
/>
:first=
"index === 0"
</
template
>
:selected=
"selectedItems[tag.name]"
</registry-list>
:is-mobile=
"isMobile"
:disabled=
"disabled"
@
select=
"updateSelectedItems(tag.name)"
@
delete=
"$emit('delete', mapTagsToBeDleeted(
{ [tag.name]: true }))"
/>
<div
class=
"gl-display-flex gl-justify-content-center"
>
<gl-keyset-pagination
v-if=
"showPagination"
:has-next-page=
"tagsPageInfo.hasNextPage"
:has-previous-page=
"tagsPageInfo.hasPreviousPage"
class=
"gl-mt-3"
@
prev=
"fetchPreviousPage"
@
next=
"fetchNextPage"
/>
</div>
</template>
</template>
</template>
</template>
</div>
</div>
...
...
spec/features/groups/container_registry_spec.rb
View file @
edc3beb1
...
@@ -82,7 +82,7 @@ RSpec.describe 'Container Registry', :js do
...
@@ -82,7 +82,7 @@ RSpec.describe 'Container Registry', :js do
end
end
it
'shows the image tags'
do
it
'shows the image tags'
do
expect
(
page
).
to
have_content
'
Image tags
'
expect
(
page
).
to
have_content
'
1 tag
'
first_tag
=
first
(
'[data-testid="name"]'
)
first_tag
=
first
(
'[data-testid="name"]'
)
expect
(
first_tag
).
to
have_content
'latest'
expect
(
first_tag
).
to
have_content
'latest'
end
end
...
...
spec/features/projects/container_registry_spec.rb
View file @
edc3beb1
...
@@ -87,7 +87,7 @@ RSpec.describe 'Container Registry', :js do
...
@@ -87,7 +87,7 @@ RSpec.describe 'Container Registry', :js do
end
end
it
'shows the image tags'
do
it
'shows the image tags'
do
expect
(
page
).
to
have_content
'
Image
tags'
expect
(
page
).
to
have_content
'
20
tags'
first_tag
=
first
(
'[data-testid="name"]'
)
first_tag
=
first
(
'[data-testid="name"]'
)
expect
(
first_tag
).
to
have_content
'1'
expect
(
first_tag
).
to
have_content
'1'
end
end
...
...
spec/frontend/packages_and_registries/container_registry/explorer/components/details_page/tags_list_spec.js
View file @
edc3beb1
This diff is collapsed.
Click to expand it.
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