fix: disable delete mounted volume

Disable delete volume when the volume is error and is mounted to some instance

Change-Id: Ib2955fbb5b9d9cfb00eacd9a6ad9c45a83a0c7c5
This commit is contained in:
zhangjingwei 2024-03-07 11:01:27 +08:00
parent 48444e9ee7
commit ffc75102ad

View File

@ -46,8 +46,11 @@ export default class DeleteAction extends ConfirmAction {
policy = 'volume:delete';
canDelete = (item) =>
['available', 'error', 'error_extending'].indexOf(item.status) >= 0;
canDelete = (item) => {
const { status, attachments = [] } = item;
const allowedStatus = ['available', 'error', 'error_extending'];
return allowedStatus.includes(status) && !attachments?.length;
};
allowedCheckFunc = (item) => this.canDelete(item);