fix: fix ports quota check when create virtual adapter
If the remaining quota of a port is zero, you can still successfully call the API to create a subnet and automatically add a port. As a result, the used port is greater than the upper limit of the quota. Fix the quota check method to accommodate this situation Change-Id: Icf955b3e4ad40d618305b23bffcd397fdbd0b288
This commit is contained in:
parent
dc71a4a56a
commit
b2cad765bf
@ -83,9 +83,9 @@ export class CreateAction extends ModalAction {
|
|||||||
|
|
||||||
static get disableSubmit() {
|
static get disableSubmit() {
|
||||||
const {
|
const {
|
||||||
neutronQuota: { port: { left = 0 } = {} },
|
neutronQuota: { port: { used = 0, limit = 0 } = {} },
|
||||||
} = globalProjectStore;
|
} = globalProjectStore;
|
||||||
return left === 0;
|
return limit !== -1 && used >= limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get showQuota() {
|
static get showQuota() {
|
||||||
@ -113,13 +113,13 @@ export class CreateAction extends ModalAction {
|
|||||||
if (quotaLoading) {
|
if (quotaLoading) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const { left = 0 } = quota;
|
const { used = 0, limit = 0 } = quota;
|
||||||
const add = left === 0 ? 0 : 1;
|
const add = limit !== -1 && used >= limit ? 0 : 1;
|
||||||
const data = {
|
const data = {
|
||||||
...quota,
|
...quota,
|
||||||
add,
|
add,
|
||||||
name: 'port',
|
name: 'port',
|
||||||
title: t('Port'),
|
title: t('Ports'),
|
||||||
};
|
};
|
||||||
return [data];
|
return [data];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user