From 4ccb380ff4f67767b99ab7c470528b5a6850582a Mon Sep 17 00:00:00 2001 From: "Jingwei.Zhang" Date: Wed, 3 Aug 2022 11:04:35 +0800 Subject: [PATCH] fix: fix the backup size quota check when create backup Disable to click submit button when the remaining backup size is zero Change-Id: I9c5b6995100262edd9be4f941dd6d905fccb4e30 --- src/resources/cinder/backup.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/resources/cinder/backup.jsx b/src/resources/cinder/backup.jsx index 15c97c70..9075114b 100644 --- a/src/resources/cinder/backup.jsx +++ b/src/resources/cinder/backup.jsx @@ -169,8 +169,10 @@ export const getAdd = (cinderQuota) => { const { left = 0 } = backups || {}; const { left: sizeLeft = 0, limit } = gigabytes || {}; const { currentVolumeSize = 0 } = globalBackupStore; - const add = - left !== 0 && (limit === -1 || sizeLeft >= currentVolumeSize) ? 1 : 0; + const leftOk = left !== 0; + const sizeOk = + sizeLeft !== 0 && (limit === -1 || sizeLeft >= currentVolumeSize); + const add = leftOk && sizeOk ? 1 : 0; return { add, addSize: add === 1 ? currentVolumeSize : 0,