From bbf19006779241894bec4cf6eaecba8b14f685a6 Mon Sep 17 00:00:00 2001
From: Prabhat Khera <91852476+prabhat-org@users.noreply.github.com>
Date: Tue, 16 Jan 2024 09:31:44 +1300
Subject: [PATCH] Disable update application button on load of edit screen
(#10957)
---
.../applications/create/createApplication.html | 2 +-
.../create/createApplicationController.js | 17 ++++++++++-------
.../applications/application.queries.ts | 4 +++-
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html
index 5b85af74f..9fb8576fb 100644
--- a/app/kubernetes/views/applications/create/createApplication.html
+++ b/app/kubernetes/views/applications/create/createApplication.html
@@ -414,7 +414,7 @@
style="margin-top: 7px; margin-left: 0"
button-spinner="ctrl.state.updateWebEditorInProgress"
>
- Update the application
+ Update application
Update in progress...
diff --git a/app/kubernetes/views/applications/create/createApplicationController.js b/app/kubernetes/views/applications/create/createApplicationController.js
index 4d64afcd1..d1da5f208 100644
--- a/app/kubernetes/views/applications/create/createApplicationController.js
+++ b/app/kubernetes/views/applications/create/createApplicationController.js
@@ -216,10 +216,12 @@ class KubernetesCreateApplicationController {
}
onChangeFileContent(value) {
- if (this.stackFileContent.replace(/(\r\n|\n|\r)/gm, '') !== value.replace(/(\r\n|\n|\r)/gm, '')) {
- this.state.isEditorDirty = true;
- this.stackFileContent = value;
- }
+ this.$scope.$evalAsync(() => {
+ if (this.stackFileContent.replace(/(\r\n|\n|\r)/gm, '') !== value.replace(/(\r\n|\n|\r)/gm, '')) {
+ this.state.isEditorDirty = true;
+ this.stackFileContent = value;
+ }
+ });
}
onDataAccessPolicyChange(value) {
@@ -1055,9 +1057,6 @@ class KubernetesCreateApplicationController {
this.formValues.OriginalIngresses = this.ingresses;
this.formValues.ImageModel = await this.parseImageConfiguration(this.formValues.ImageModel);
- this.savedFormValues = angular.copy(this.formValues);
- this.updateNamespaceLimits(this.namespaceWithQuota);
- this.updateSliders(this.namespaceWithQuota);
if (this.application.ApplicationType !== KubernetesApplicationTypes.StatefulSet) {
_.forEach(this.formValues.PersistedFolders, (persistedFolder) => {
@@ -1070,6 +1069,10 @@ class KubernetesCreateApplicationController {
}
this.formValues.OriginalPersistedFolders = this.formValues.PersistedFolders;
await this.refreshNamespaceData(namespace);
+
+ this.savedFormValues = angular.copy(this.formValues);
+ this.updateNamespaceLimits(this.namespaceWithQuota);
+ this.updateSliders(this.namespaceWithQuota);
} else {
this.formValues.AutoScaler = KubernetesApplicationHelper.generateAutoScalerFormValueFromHorizontalPodAutoScaler(null, this.formValues.ReplicaCount);
}
diff --git a/app/react/kubernetes/applications/application.queries.ts b/app/react/kubernetes/applications/application.queries.ts
index 118bc02af..5496f86cf 100644
--- a/app/react/kubernetes/applications/application.queries.ts
+++ b/app/react/kubernetes/applications/application.queries.ts
@@ -316,7 +316,9 @@ export function usePatchApplicationMutation(
}: {
appKind: AppKind;
patch: ApplicationPatch;
- contentType?: string;
+ contentType?:
+ | 'application/json-patch+json'
+ | 'application/strategic-merge-patch+json';
}) =>
patchApplication(
environmentId,