diff --git a/app/kubernetes/react/components/index.ts b/app/kubernetes/react/components/index.ts index 295e52ab5..c1bcb54aa 100644 --- a/app/kubernetes/react/components/index.ts +++ b/app/kubernetes/react/components/index.ts @@ -269,6 +269,8 @@ withFormValidation( [ 'namespaceHasQuota', 'resourceQuotaCapacityExceeded', + 'minMemoryLimit', + 'minCpuLimit', 'maxMemoryLimit', 'maxCpuLimit', ], diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html index fb8cbad21..57a787ffa 100644 --- a/app/kubernetes/views/applications/create/createApplication.html +++ b/app/kubernetes/views/applications/create/createApplication.html @@ -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}" diff --git a/app/react/components/form-components/Slider/SliderWithInput.tsx b/app/react/components/form-components/Slider/SliderWithInput.tsx index b40d22d32..bfbff328f 100644 --- a/app/react/components/form-components/Slider/SliderWithInput.tsx +++ b/app/react/components/form-components/Slider/SliderWithInput.tsx @@ -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`} diff --git a/app/react/kubernetes/applications/components/ResourceReservationFormSection/ResourceReservationFormSection.tsx b/app/react/kubernetes/applications/components/ResourceReservationFormSection/ResourceReservationFormSection.tsx index 1a5d8283c..b79dad502 100644 --- a/app/react/kubernetes/applications/components/ResourceReservationFormSection/ResourceReservationFormSection.tsx +++ b/app/react/kubernetes/applications/components/ResourceReservationFormSection/ResourceReservationFormSection.tsx @@ -15,6 +15,8 @@ type Props = { errors: FormikErrors; 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({ 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"