Commit dc54887d authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch '341939-delete-gray-container-tags' into 'master'

Allow tag deletion on broken tags

See merge request gitlab-org/gitlab!76971
parents 0177b39f 727ac325
...@@ -107,11 +107,8 @@ export default { ...@@ -107,11 +107,8 @@ export default {
isInvalidTag() { isInvalidTag() {
return !this.tag.digest; return !this.tag.digest;
}, },
isCheckboxDisabled() {
return this.isInvalidTag || this.disabled;
},
isDeleteDisabled() { isDeleteDisabled() {
return this.isInvalidTag || this.disabled || !this.tag.canDelete; return this.disabled || !this.tag.canDelete;
}, },
}, },
}; };
...@@ -122,7 +119,7 @@ export default { ...@@ -122,7 +119,7 @@ export default {
<template #left-action> <template #left-action>
<gl-form-checkbox <gl-form-checkbox
v-if="tag.canDelete" v-if="tag.canDelete"
:disabled="isCheckboxDisabled" :disabled="disabled"
class="gl-m-0" class="gl-m-0"
:checked="selected" :checked="selected"
@change="$emit('select')" @change="$emit('select')"
......
...@@ -123,7 +123,6 @@ module API ...@@ -123,7 +123,6 @@ module API
end end
delete ':id/registry/repositories/:repository_id/tags/:tag_name', requirements: REPOSITORY_ENDPOINT_REQUIREMENTS do delete ':id/registry/repositories/:repository_id/tags/:tag_name', requirements: REPOSITORY_ENDPOINT_REQUIREMENTS do
authorize_destroy_container_image! authorize_destroy_container_image!
validate_tag!
result = ::Projects::ContainerRepository::DeleteTagsService result = ::Projects::ContainerRepository::DeleteTagsService
.new(repository.project, current_user, tags: [declared_params[:tag_name]]) .new(repository.project, current_user, tags: [declared_params[:tag_name]])
......
...@@ -75,16 +75,19 @@ describe('tags list row', () => { ...@@ -75,16 +75,19 @@ describe('tags list row', () => {
}); });
it.each` it.each`
digest | disabled digest | disabled | isDisabled
${'foo'} | ${true} ${'foo'} | ${true} | ${'true'}
${null} | ${false} ${null} | ${true} | ${'true'}
${null} | ${true} ${null} | ${false} | ${undefined}
${'foo'} | ${true} ${'foo'} | ${false} | ${undefined}
`('is disabled when the digest $digest and disabled is $disabled', ({ digest, disabled }) => { `(
mountComponent({ tag: { ...tag, digest }, disabled }); 'disabled attribute is set to $isDisabled when the digest $digest and disabled is $disabled',
({ digest, disabled, isDisabled }) => {
mountComponent({ tag: { ...tag, digest }, disabled });
expect(findCheckbox().attributes('disabled')).toBe('true'); expect(findCheckbox().attributes('disabled')).toBe(isDisabled);
}); },
);
it('is wired to the selected prop', () => { it('is wired to the selected prop', () => {
mountComponent({ ...defaultProps, selected: true }); mountComponent({ ...defaultProps, selected: true });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment