Merge "fix: fix the add value of quota in zun containers"
This commit is contained in:
commit
a12c3e039b
@ -110,9 +110,18 @@ export class StepCreate extends StepAction {
|
|||||||
title: t('Containers'),
|
title: t('Containers'),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { left: cpuLeft = 0 } = cpu;
|
||||||
|
const { left: memoryLeft = 0 } = memory;
|
||||||
|
const { left: diskLeft = 0 } = disk;
|
||||||
|
const canAdd =
|
||||||
|
left &&
|
||||||
|
(cpuLeft === -1 || cpuCount <= cpuLeft) &&
|
||||||
|
(memoryLeft === -1 || memoryCount <= memoryLeft) &&
|
||||||
|
(diskLeft === -1 || diskCount <= diskLeft);
|
||||||
|
|
||||||
const cpuQuotaInfo = {
|
const cpuQuotaInfo = {
|
||||||
...cpu,
|
...cpu,
|
||||||
add: cpuCount,
|
add: canAdd ? cpuCount : 0,
|
||||||
name: 'cpu',
|
name: 'cpu',
|
||||||
title: t('CPU'),
|
title: t('CPU'),
|
||||||
type: 'line',
|
type: 'line',
|
||||||
@ -120,7 +129,7 @@ export class StepCreate extends StepAction {
|
|||||||
|
|
||||||
const memoryQuotaInfo = {
|
const memoryQuotaInfo = {
|
||||||
...memory,
|
...memory,
|
||||||
add: memoryCount,
|
add: canAdd ? memoryCount : 0,
|
||||||
name: 'memory',
|
name: 'memory',
|
||||||
title: t('Memory (MiB)'),
|
title: t('Memory (MiB)'),
|
||||||
type: 'line',
|
type: 'line',
|
||||||
@ -128,7 +137,7 @@ export class StepCreate extends StepAction {
|
|||||||
|
|
||||||
const diskQuotaInfo = {
|
const diskQuotaInfo = {
|
||||||
...disk,
|
...disk,
|
||||||
add: diskCount,
|
add: canAdd ? diskCount : 0,
|
||||||
name: 'disk',
|
name: 'disk',
|
||||||
title: t('Disk (GiB)'),
|
title: t('Disk (GiB)'),
|
||||||
type: 'line',
|
type: 'line',
|
||||||
|
Loading…
Reference in New Issue
Block a user