mirror of https://github.com/portainer/portainer
Merge pull request #5079 from portainer/fix/EE-769/code-editor-prompt-on-change
fix(stacks): check for editor change before setting as dirtypull/5090/head
commit
ef8794c2b9
|
@ -5,7 +5,9 @@ export class EditEdgeStackFormController {
|
||||||
}
|
}
|
||||||
|
|
||||||
editorUpdate(cm) {
|
editorUpdate(cm) {
|
||||||
|
if (this.model.StackFileContent.replace(/(\r\n|\n|\r)/gm, '') !== cm.getValue().replace(/(\r\n|\n|\r)/gm, '')) {
|
||||||
this.model.StackFileContent = cm.getValue();
|
this.model.StackFileContent = cm.getValue();
|
||||||
this.isEditorDirty = true;
|
this.isEditorDirty = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,11 @@ class KubernetesConfigurationDataController {
|
||||||
}
|
}
|
||||||
|
|
||||||
async editorUpdateAsync(cm) {
|
async editorUpdateAsync(cm) {
|
||||||
|
if (this.formValues.DataYaml !== cm.getValue()) {
|
||||||
this.formValues.DataYaml = cm.getValue();
|
this.formValues.DataYaml = cm.getValue();
|
||||||
this.isEditorDirty = true;
|
this.isEditorDirty = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
editorUpdate(cm) {
|
editorUpdate(cm) {
|
||||||
return this.$async(this.editorUpdateAsync, cm);
|
return this.$async(this.editorUpdateAsync, cm);
|
||||||
|
|
|
@ -96,9 +96,11 @@ class EditCustomTemplateViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
editorUpdate(cm) {
|
editorUpdate(cm) {
|
||||||
|
if (this.formValues.FileContent.replace(/(\r\n|\n|\r)/gm, '') !== cm.getValue().replace(/(\r\n|\n|\r)/gm, '')) {
|
||||||
this.formValues.FileContent = cm.getValue();
|
this.formValues.FileContent = cm.getValue();
|
||||||
this.state.isEditorDirty = true;
|
this.state.isEditorDirty = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async uiCanExit() {
|
async uiCanExit() {
|
||||||
if (this.formValues.FileContent !== this.oldFileContent && this.state.isEditorDirty) {
|
if (this.formValues.FileContent !== this.oldFileContent && this.state.isEditorDirty) {
|
||||||
|
|
|
@ -201,12 +201,11 @@ angular.module('portainer.app').controller('StackController', [
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.editorUpdate = function (cm) {
|
$scope.editorUpdate = function (cm) {
|
||||||
if ($scope.stackFileContent !== cm.getValue()) {
|
if ($scope.stackFileContent.replace(/(\r\n|\n|\r)/gm, '') !== cm.getValue().replace(/(\r\n|\n|\r)/gm, '')) {
|
||||||
$scope.state.isEditorDirty = true;
|
$scope.state.isEditorDirty = true;
|
||||||
}
|
|
||||||
$scope.stackFileContent = cm.getValue();
|
$scope.stackFileContent = cm.getValue();
|
||||||
$scope.state.yamlError = StackHelper.validateYAML($scope.stackFileContent, $scope.containerNames);
|
$scope.state.yamlError = StackHelper.validateYAML($scope.stackFileContent, $scope.containerNames);
|
||||||
$scope.state.isEditorDirty = true;
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.stopStack = stopStack;
|
$scope.stopStack = stopStack;
|
||||||
|
|
Loading…
Reference in New Issue