From bf66b6c5f3531c34d07d9aff498d7850cff6e765 Mon Sep 17 00:00:00 2001 From: Prabhat Khera <91852476+prabhat-org@users.noreply.github.com> Date: Thu, 18 Jan 2024 07:59:00 +1300 Subject: [PATCH] fix(ui): reset auto-scaling formvalues if needed [EE-6544] (#10969) --- .../applications/create/createApplicationController.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/kubernetes/views/applications/create/createApplicationController.js b/app/kubernetes/views/applications/create/createApplicationController.js index 24dad0f70..8ce33d213 100644 --- a/app/kubernetes/views/applications/create/createApplicationController.js +++ b/app/kubernetes/views/applications/create/createApplicationController.js @@ -286,7 +286,7 @@ class KubernetesCreateApplicationController { onAutoScaleChange(values) { return this.$async(async () => { // when enabling the auto scaler, set the default values - if (!this.formValues.AutoScaler.isUsed && values.isUsed) { + if (!this.oldFormValues.AutoScaler.isUsed && values.isUsed) { this.formValues.AutoScaler = { isUsed: values.isUsed, minReplicas: 1, @@ -297,6 +297,11 @@ class KubernetesCreateApplicationController { } // otherwise, just update the values this.formValues.AutoScaler = values; + + // reset it to previous form values if the user disables the auto scaler + if (!this.oldFormValues.AutoScaler.isUsed && !values.isUsed) { + this.formValues.AutoScaler = this.oldFormValues.AutoScaler; + } }); } /* #endregion */