fixed save settings n redeploy button

feat/EE-577/EE-1594/use-user-token-for-autoupdate
Felix Han 2021-09-08 15:02:38 +12:00
parent 0c87634bc3
commit 5d2fe2d818
2 changed files with 9 additions and 3 deletions

View File

@ -15,6 +15,7 @@ class KubernetesRedeployAppGitFormController {
redeployInProgress: false,
showConfig: false,
isEdit: false,
hasUnsavedChanges: false,
};
this.formValues = {
@ -44,6 +45,7 @@ class KubernetesRedeployAppGitFormController {
...this.formValues,
...values,
};
this.state.hasUnsavedChanges = angular.toJson(this.savedFormValues) !== angular.toJson(this.formValues);
}
buildAnalyticsProperties() {
@ -98,6 +100,8 @@ class KubernetesRedeployAppGitFormController {
try {
this.state.saveGitSettingsInProgress = true;
await this.StackService.updateKubeStack({ EndpointId: this.stack.EndpointId, Id: this.stack.Id }, null, this.formValues);
this.savedFormValues = angular.copy(this.formValues);
this.state.hasUnsavedChanges = false;
this.Notifications.success('Save stack settings successfully');
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to save application settings');
@ -135,6 +139,8 @@ class KubernetesRedeployAppGitFormController {
this.formValues.RepositoryAuthentication = true;
this.state.isEdit = true;
}
this.savedFormValues = angular.copy(this.formValues);
}
}

View File

@ -37,9 +37,9 @@
class="btn btn-sm btn-primary"
ng-click="$ctrl.pullAndRedeployApplication()"
ng-if="!$ctrl.formValues.AutoUpdate.RepositoryAutomaticUpdates"
ng-disabled="$ctrl.isSubmitButtonDisabled() || !$ctrl.redeployGitForm.$valid"
ng-disabled="$ctrl.isSubmitButtonDisabled() || $ctrl.state.hasUnsavedChanges|| !$ctrl.redeployGitForm.$valid"
style="margin-top: 7px; margin-left: 0;"
button-spinner="ctrl.state.redeployInProgress"
button-spinner="$ctrl.state.redeployInProgress"
analytics-on
analytics-category="kubernetes"
analytics-event="kubernetes-application-edit-git-pull"
@ -50,7 +50,7 @@
<button
class="btn btn-sm btn-primary"
ng-click="$ctrl.saveGitSettings()"
ng-disabled="$ctrl.isSubmitButtonDisabled() || !$ctrl.redeployGitForm.$valid"
ng-disabled="$ctrl.isSubmitButtonDisabled() || !$ctrl.state.hasUnsavedChanges|| !$ctrl.redeployGitForm.$valid"
style="margin-top: 7px; margin-left: 0;"
button-spinner="$ctrl.state.saveGitSettingsInProgress"
analytics-on