diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html index a503bdc01..e80ab6d3b 100644 --- a/app/kubernetes/views/applications/create/createApplication.html +++ b/app/kubernetes/views/applications/create/createApplication.html @@ -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()" > diff --git a/app/react/kubernetes/applications/components/ResourceReservationFormSection/resourceReservationValidation.ts b/app/react/kubernetes/applications/components/ResourceReservationFormSection/resourceReservationValidation.ts index 2648b9253..2a785cb5e 100644 --- a/app/react/kubernetes/applications/components/ResourceReservationFormSection/resourceReservationValidation.ts +++ b/app/react/kubernetes/applications/components/ResourceReservationFormSection/resourceReservationValidation.ts @@ -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',