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
This commit is contained in:
Jingwei.Zhang 2022-08-03 11:04:35 +08:00
parent 28846810e2
commit 4ccb380ff4

View File

@ -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,