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',
'resourceQuotaCapacityExceeded',
'minMemoryLimit',
'minCpuLimit',
'maxMemoryLimit',
'maxCpuLimit',
],

@ -283,6 +283,8 @@
values="{memoryLimit: ctrl.formValues.MemoryLimit, cpuLimit: ctrl.formValues.CpuLimit}"
on-change="(ctrl.onChangeResourceReservation)"
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-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}"

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

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

Loading…
Cancel
Save