|
|
@ -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',
|
|
|
|