Cancel editing bug (#2355)

* WIP

* Refresh view with object from persistence
This commit is contained in:
Andrew Henry 2019-04-05 11:25:46 -07:00 committed by Pegah Sarram
parent baf410a364
commit 964c326535
2 changed files with 20 additions and 2 deletions

View File

@ -79,9 +79,11 @@ export default class Editor extends EventEmitter {
* @private
*/
cancel() {
this.getTransactionService().cancel();
let cancelPromise = this.getTransactionService().cancel();
this.editing = false;
this.emit('isEditing', false);
return cancelPromise;
}
/**

View File

@ -119,7 +119,10 @@ const PLACEHOLDER_OBJECT = {};
label: 'Ok',
emphasis: true,
callback: () => {
this.openmct.editor.cancel();
this.openmct.editor.cancel().then(() => {
//refresh object view
this.openmct.layout.$refs.browseObject.show(this.domainObject, this.viewKey, false);
});
dialog.dismiss();
}
},
@ -228,7 +231,20 @@ const PLACEHOLDER_OBJECT = {};
this.isEditing = isEditing;
});
},
watch: {
domainObject() {
if (this.mutationObserver) {
this.mutationObserver();
}
this.mutationObserver = this.openmct.objects.observe(this.domainObject, '*', (domainObject) => {
this.domainObject = domainObject;
});
}
},
beforeDestroy: function () {
if (this.mutationObserver) {
this.mutationObserver();
}
document.removeEventListener('click', this.closeViewAndSaveMenu);
window.removeEventListener('click', this.promptUserbeforeNavigatingAway);
}