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" min-cpu-limit="ctrl.state.sliders.cpu.min"
max-memory-limit="ctrl.state.sliders.memory.max" max-memory-limit="ctrl.state.sliders.memory.max"
max-cpu-limit="ctrl.state.sliders.cpu.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-quota-capacity-exceeded="ctrl.resourceQuotaCapacityExceeded()"
></resource-reservation-form-section> ></resource-reservation-form-section>

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

Loading…
Cancel
Save