From ffc75102adaecaffa6cd9d38fff91cc50f1ec740 Mon Sep 17 00:00:00 2001 From: zhangjingwei Date: Thu, 7 Mar 2024 11:01:27 +0800 Subject: [PATCH] fix: disable delete mounted volume Disable delete volume when the volume is error and is mounted to some instance Change-Id: Ib2955fbb5b9d9cfb00eacd9a6ad9c45a83a0c7c5 --- src/pages/storage/containers/Volume/actions/Delete.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/storage/containers/Volume/actions/Delete.jsx b/src/pages/storage/containers/Volume/actions/Delete.jsx index cdb670a4..e25e6ed3 100644 --- a/src/pages/storage/containers/Volume/actions/Delete.jsx +++ b/src/pages/storage/containers/Volume/actions/Delete.jsx @@ -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);