fix(app): on create don't mention previous values [EE-6837] (#11351)

Co-authored-by: testa113 <testa113>
pull/11361/head
Ali 9 months ago committed by GitHub
parent 6094dc115b
commit 1090c82beb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -290,7 +290,7 @@
min-cpu-limit="ctrl.state.sliders.cpu.min"
max-memory-limit="ctrl.state.sliders.memory.max"
max-cpu-limit="ctrl.state.sliders.cpu.max"
validation-data="{maxMemoryLimit: ctrl.state.sliders.memory.max, maxCpuLimit: ctrl.state.sliders.cpu.max, isEnvironmentAdmin: ctrl.isAdmin, nodeLimits: ctrl.nodesLimits.nodesLimits}"
validation-data="{isEdit: ctrl.state.isEdit, maxMemoryLimit: ctrl.state.sliders.memory.max, maxCpuLimit: ctrl.state.sliders.cpu.max, isEnvironmentAdmin: ctrl.isAdmin, nodeLimits: ctrl.nodesLimits.nodesLimits}"
resource-quota-capacity-exceeded="ctrl.resourceQuotaCapacityExceeded()"
></resource-reservation-form-section>

@ -17,6 +17,7 @@ type ValidationData = {
maxCpuLimit: number;
isEnvironmentAdmin: boolean;
nodeLimits: NodesLimits;
isEdit: boolean;
};
export function resourceReservationValidation(
@ -34,10 +35,10 @@ export function resourceReservationValidation(
}`,
() => !!validationData && validationData.maxMemoryLimit > 0
)
.max(
validationData?.maxMemoryLimit || 0,
({ value }) =>
`Value must be between 0 and ${validationData?.maxMemoryLimit}MB now - the previous value of ${value} exceeds this.`
.max(validationData?.maxMemoryLimit || 0, ({ value }) =>
validationData?.isEdit
? `Value must be between 0 and ${validationData?.maxMemoryLimit}MB now - the previous value of ${value} exceeds this.`
: `Value must be between 0 and ${validationData?.maxMemoryLimit}MB.`
)
.test(
'hasSuitableNode',
@ -68,10 +69,10 @@ export function resourceReservationValidation(
}`,
() => !!validationData && validationData.maxCpuLimit > 0
)
.max(
validationData?.maxCpuLimit || 0,
({ value }) =>
`Value must be between 0 and ${validationData?.maxCpuLimit} now - the previous value of ${value} exceeds this.`
.max(validationData?.maxCpuLimit || 0, ({ value }) =>
validationData?.isEdit
? `Value must be between 0 and ${validationData?.maxCpuLimit} now - the previous value of ${value} exceeds this.`
: `Value must be between 0 and ${validationData?.maxCpuLimit}.`
)
.test(
'hasSuitableNode',

Loading…
Cancel
Save