fix(app): get min resource limits [EE-6567] (#10994)

Co-authored-by: testa113 <testa113>
pull/10731/merge
Ali 10 months ago committed by GitHub
parent b81babe682
commit 77c38306b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -269,6 +269,8 @@ withFormValidation(
[ [
'namespaceHasQuota', 'namespaceHasQuota',
'resourceQuotaCapacityExceeded', 'resourceQuotaCapacityExceeded',
'minMemoryLimit',
'minCpuLimit',
'maxMemoryLimit', 'maxMemoryLimit',
'maxCpuLimit', 'maxCpuLimit',
], ],

@ -283,6 +283,8 @@
values="{memoryLimit: ctrl.formValues.MemoryLimit, cpuLimit: ctrl.formValues.CpuLimit}" values="{memoryLimit: ctrl.formValues.MemoryLimit, cpuLimit: ctrl.formValues.CpuLimit}"
on-change="(ctrl.onChangeResourceReservation)" on-change="(ctrl.onChangeResourceReservation)"
namespace-has-quota="ctrl.state.resourcePoolHasQuota" namespace-has-quota="ctrl.state.resourcePoolHasQuota"
min-memory-limit="ctrl.state.sliders.memory.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="{maxMemoryLimit: ctrl.state.sliders.memory.max, maxCpuLimit: ctrl.state.sliders.cpu.max, isEnvironmentAdmin: ctrl.isAdmin, nodeLimits: ctrl.nodesLimits.nodesLimits}"

@ -6,6 +6,7 @@ export function SliderWithInput({
value, value,
onChange, onChange,
max, max,
min = 0,
step = 1, step = 1,
dataCy, dataCy,
visibleTooltip = false, visibleTooltip = false,
@ -13,6 +14,7 @@ export function SliderWithInput({
value: number; value: number;
onChange: (value: number) => void; onChange: (value: number) => void;
max: number; max: number;
min?: number;
dataCy: string; dataCy: string;
step?: number; step?: number;
visibleTooltip?: boolean; visibleTooltip?: boolean;
@ -26,7 +28,7 @@ export function SliderWithInput({
onChange(typeof value === 'number' ? value : value[0]) onChange(typeof value === 'number' ? value : value[0])
} }
value={value} value={value}
min={0} min={min}
max={max} max={max}
step={step} step={step}
dataCy={`${dataCy}Slider`} dataCy={`${dataCy}Slider`}

@ -15,6 +15,8 @@ type Props = {
errors: FormikErrors<ResourceQuotaFormValues>; errors: FormikErrors<ResourceQuotaFormValues>;
namespaceHasQuota: boolean; namespaceHasQuota: boolean;
resourceQuotaCapacityExceeded: boolean; resourceQuotaCapacityExceeded: boolean;
minMemoryLimit: number;
minCpuLimit: number;
maxMemoryLimit: number; maxMemoryLimit: number;
maxCpuLimit: number; maxCpuLimit: number;
}; };
@ -25,6 +27,8 @@ export function ResourceReservationFormSection({
errors, errors,
namespaceHasQuota, namespaceHasQuota,
resourceQuotaCapacityExceeded, resourceQuotaCapacityExceeded,
minMemoryLimit,
minCpuLimit,
maxMemoryLimit, maxMemoryLimit,
maxCpuLimit, maxCpuLimit,
}: Props) { }: Props) {
@ -52,6 +56,7 @@ export function ResourceReservationFormSection({
<SliderWithInput <SliderWithInput
value={Number(values.memoryLimit) ?? 0} value={Number(values.memoryLimit) ?? 0}
onChange={(value) => onChange({ ...values, memoryLimit: value })} onChange={(value) => onChange({ ...values, memoryLimit: value })}
min={minMemoryLimit}
max={maxMemoryLimit} max={maxMemoryLimit}
step={128} step={128}
dataCy="k8sAppCreate-memoryLimit" dataCy="k8sAppCreate-memoryLimit"
@ -79,7 +84,7 @@ export function ResourceReservationFormSection({
) )
} }
value={values.cpuLimit} value={values.cpuLimit}
min={0} min={minCpuLimit}
max={maxCpuLimit} max={maxCpuLimit}
step={0.1} step={0.1}
dataCy="k8sAppCreate-cpuLimitSlider" dataCy="k8sAppCreate-cpuLimitSlider"

Loading…
Cancel
Save