mirror of https://github.com/portainer/portainer
fix(app):fix additional not save warning EE-799 (#5161)
* fix(app):fix additional not save warning EE-799 * fix additional warning when user leave page * fix additional warning when user leave page in buildImageController.js * fix docker build controller additional warning message * fix changes required from reviews * - refactored ondestroy hook function to align it closer to (below) oninit - removed duplicated hook func duplication in configurationController Co-authored-by: zees-dev <dev.786zshan@gmail.com>pull/5413/head
parent
75baf14b38
commit
3257cb1e28
|
@ -62,6 +62,10 @@ class CreateConfigController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
async uiCanExit() {
|
async uiCanExit() {
|
||||||
if (this.formValues.displayCodeEditor && this.formValues.ConfigContent && this.state.isEditorDirty) {
|
if (this.formValues.displayCodeEditor && this.formValues.ConfigContent && this.state.isEditorDirty) {
|
||||||
return this.ModalService.confirmWebEditorDiscard();
|
return this.ModalService.confirmWebEditorDiscard();
|
||||||
|
|
|
@ -23,6 +23,10 @@ function BuildImageController($scope, $async, $window, ModalService, BuildServic
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$on('$destroy', function () {
|
||||||
|
$scope.state.isEditorDirty = false;
|
||||||
|
});
|
||||||
|
|
||||||
$scope.addImageName = function () {
|
$scope.addImageName = function () {
|
||||||
$scope.formValues.ImageNames.push({ Name: '' });
|
$scope.formValues.ImageNames.push({ Name: '' });
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,4 +77,8 @@ export class CreateEdgeJobViewController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,4 +170,8 @@ export class EdgeJobController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,10 @@ export class CreateEdgeStackViewController {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
createStack() {
|
createStack() {
|
||||||
return this.$async(this.createStackAsync);
|
return this.$async(this.createStackAsync);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,10 @@ export class EditEdgeStackViewController {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
async uiCanExit() {
|
async uiCanExit() {
|
||||||
if (this.formValues.StackFileContent !== this.oldFileContent && this.state.isEditorDirty) {
|
if (this.formValues.StackFileContent !== this.oldFileContent && this.state.isEditorDirty) {
|
||||||
return this.ModalService.confirmWebEditorDiscard();
|
return this.ModalService.confirmWebEditorDiscard();
|
||||||
|
|
|
@ -114,6 +114,10 @@ class KubernetesCreateConfigurationController {
|
||||||
$onInit() {
|
$onInit() {
|
||||||
return this.$async(this.onInit);
|
return this.$async(this.onInit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default KubernetesCreateConfigurationController;
|
export default KubernetesCreateConfigurationController;
|
||||||
|
|
|
@ -289,6 +289,7 @@ class KubernetesConfigurationController {
|
||||||
if (this.state.currentName !== this.$state.$current.name) {
|
if (this.state.currentName !== this.$state.$current.name) {
|
||||||
this.LocalStorage.storeActiveTab('configuration', 0);
|
this.LocalStorage.storeActiveTab('configuration', 0);
|
||||||
}
|
}
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,10 @@ class KubernetesDeployController {
|
||||||
$onInit() {
|
$onInit() {
|
||||||
return this.$async(this.onInit);
|
return this.$async(this.onInit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default KubernetesDeployController;
|
export default KubernetesDeployController;
|
||||||
|
|
|
@ -189,6 +189,10 @@ class CreateCustomTemplateViewController {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
async uiCanExit() {
|
async uiCanExit() {
|
||||||
if (this.state.Method === 'editor' && this.formValues.FileContent && this.state.isEditorDirty) {
|
if (this.state.Method === 'editor' && this.formValues.FileContent && this.state.isEditorDirty) {
|
||||||
return this.ModalService.confirmWebEditorDiscard();
|
return this.ModalService.confirmWebEditorDiscard();
|
||||||
|
|
|
@ -123,6 +123,10 @@ class EditCustomTemplateViewController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onDestroy() {
|
||||||
|
this.state.isEditorDirty = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EditCustomTemplateViewController;
|
export default EditCustomTemplateViewController;
|
||||||
|
|
|
@ -53,6 +53,10 @@ angular
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$on('$destroy', function() {
|
||||||
|
$scope.state.isEditorDirty = false;
|
||||||
|
})
|
||||||
|
|
||||||
$scope.onChangeFormValues = onChangeFormValues;
|
$scope.onChangeFormValues = onChangeFormValues;
|
||||||
|
|
||||||
$scope.addEnvironmentVariable = function () {
|
$scope.addEnvironmentVariable = function () {
|
||||||
|
|
|
@ -70,6 +70,10 @@ angular.module('portainer.app').controller('StackController', [
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$on('$destroy', function() {
|
||||||
|
$scope.state.isEditorDirty = false;
|
||||||
|
})
|
||||||
|
|
||||||
$scope.handleEnvVarChange = handleEnvVarChange;
|
$scope.handleEnvVarChange = handleEnvVarChange;
|
||||||
function handleEnvVarChange(value) {
|
function handleEnvVarChange(value) {
|
||||||
$scope.formValues.Env = value;
|
$scope.formValues.Env = value;
|
||||||
|
|
Loading…
Reference in New Issue