fix(app): set values in react autoscaling form section [EE-6740] (#11220)

pull/11238/head
Ali 2024-02-20 09:35:32 +13:00 committed by GitHub
parent a17da6d2cd
commit bac1c28fa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 14 deletions

View File

@ -293,17 +293,6 @@ class KubernetesCreateApplicationController {
/* #region AUTO SCALER UI MANAGEMENT */
onAutoScaleChange(values) {
return this.$async(async () => {
// when enabling the auto scaler, set the default values
if (!this.formValues.AutoScaler.isUsed && values.isUsed) {
this.formValues.AutoScaler = {
isUsed: values.isUsed,
minReplicas: 1,
maxReplicas: 3,
targetCpuUtilizationPercentage: 50,
};
return;
}
// otherwise, just update the values
this.formValues.AutoScaler = values;
// reset it to previous form values if the user disables the auto scaler

View File

@ -32,12 +32,22 @@ export function AutoScalingFormSection({
label="Enable auto scaling for this application"
labelClass="col-sm-3 col-lg-2"
checked={values.isUsed}
onChange={(value: boolean) =>
onChange={(value: boolean) => {
// when enabling the auto scaler, set the default values
const newValues =
!values.isUsed && value
? {
minReplicas: 1,
maxReplicas: 3,
targetCpuUtilizationPercentage: 50,
}
: {};
onChange({
...values,
...newValues,
isUsed: value,
})
}
});
}}
/>
{values.isUsed && (
<div className="grid grid-cols-1 md:grid-cols-3 w-full gap-x-4 gap-y-2 my-3">