Commit 727ac325 authored by Steve Abrams's avatar Steve Abrams Committed by Nicolò Maria Mezzopera

Allow tag deletion on broken tags

- Remove tag validation in delete API
- Show delete button even when tag is broken
parent 27ba1b90
......@@ -107,11 +107,8 @@ export default {
isInvalidTag() {
return !this.tag.digest;
},
isCheckboxDisabled() {
return this.isInvalidTag || this.disabled;
},
isDeleteDisabled() {
return this.isInvalidTag || this.disabled || !this.tag.canDelete;
return this.disabled || !this.tag.canDelete;
},
},
};
......@@ -122,7 +119,7 @@ export default {
<template #left-action>
<gl-form-checkbox
v-if="tag.canDelete"
:disabled="isCheckboxDisabled"
:disabled="disabled"
class="gl-m-0"
:checked="selected"
@change="$emit('select')"
......
......@@ -123,7 +123,6 @@ module API
end
delete ':id/registry/repositories/:repository_id/tags/:tag_name', requirements: REPOSITORY_ENDPOINT_REQUIREMENTS do
authorize_destroy_container_image!
validate_tag!
result = ::Projects::ContainerRepository::DeleteTagsService
.new(repository.project, current_user, tags: [declared_params[:tag_name]])
......
......@@ -75,16 +75,19 @@ describe('tags list row', () => {
});
it.each`
digest | disabled
${'foo'} | ${true}
${null} | ${false}
${null} | ${true}
${'foo'} | ${true}
`('is disabled when the digest $digest and disabled is $disabled', ({ digest, disabled }) => {
mountComponent({ tag: { ...tag, digest }, disabled });
digest | disabled | isDisabled
${'foo'} | ${true} | ${'true'}
${null} | ${true} | ${'true'}
${null} | ${false} | ${undefined}
${'foo'} | ${false} | ${undefined}
`(
'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', () => {
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