mirror of
https://github.com/nasa/openmct.git
synced 2025-06-13 04:38:15 +00:00
[Edit Mode] Fixed issue with save dialog not being displayed for new objects after mutation. Fixes 1080
This commit is contained in:
@ -48,20 +48,34 @@ define(
|
||||
*/
|
||||
NavigateAction.prototype.perform = function () {
|
||||
var self = this,
|
||||
navigationAllowed = true;
|
||||
navigateTo = this.domainObject,
|
||||
currentObject = self.navigationService.getNavigation(),
|
||||
editing = currentObject.hasCapability('editor') &&
|
||||
currentObject.getCapability('editor').isEditContextRoot();
|
||||
|
||||
function allow() {
|
||||
self.policyService.allow("navigation", self.navigationService.getNavigation(), self.domainObject, function (message) {
|
||||
var navigationAllowed = true;
|
||||
self.policyService.allow("navigation", currentObject, navigateTo, function (message) {
|
||||
navigationAllowed = self.$window.confirm(message + "\r\n\r\n" +
|
||||
" Are you sure you want to continue?");
|
||||
});
|
||||
return navigationAllowed;
|
||||
}
|
||||
|
||||
// Set navigation, and wrap like a promise
|
||||
return this.$q.when(
|
||||
allow() && this.navigationService.setNavigation(this.domainObject)
|
||||
);
|
||||
function cancelIfEditing() {
|
||||
return self.$q.when(editing && currentObject.getCapability("editor").cancel());
|
||||
}
|
||||
|
||||
function navigate() {
|
||||
return self.navigationService.setNavigation(navigateTo);
|
||||
}
|
||||
|
||||
if (allow()) {
|
||||
return cancelIfEditing().then(navigate);
|
||||
} else {
|
||||
return this.$q.when(false);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user