[Create] Avoid navigation warning

...when navigating to a clone created via Save As.
This commit is contained in:
Victor Woeltjen 2016-02-10 11:59:17 -08:00
parent 5604120d55
commit 8c602025d4
2 changed files with 10 additions and 5 deletions

View File

@ -163,7 +163,8 @@ define([
"navigationService", "navigationService",
"policyService", "policyService",
"dialogService", "dialogService",
"creationService" "creationService",
"copyService"
], ],
"priority": "mandatory" "priority": "mandatory"
}, },

View File

@ -132,6 +132,11 @@ define(
return false; return false;
} }
function cancelEditingAfterClone(clonedObject) {
return domainObject.getCapability("editor").cancel()
.then(resolveWith(clonedObject));
}
// Invoke any save behavior introduced by the editor capability; // Invoke any save behavior introduced by the editor capability;
// this is introduced by EditableDomainObject which is // this is introduced by EditableDomainObject which is
// used to insulate underlying objects from changes made // used to insulate underlying objects from changes made
@ -142,10 +147,9 @@ define(
if (!domainObject.getModel().persisted){ if (!domainObject.getModel().persisted){
return getParent(domainObject) return getParent(domainObject)
.then(doWizardSave) .then(doWizardSave)
.then(copyService.perform.bind( .then(getParent)
copyService, .then(copyService.perform.bind(copyService, domainObject))
[ domainObject ] .then(cancelEditingAfterClone)
))
.catch(doNothing); .catch(doNothing);
} else { } else {
return domainObject.getCapability("editor").save() return domainObject.getCapability("editor").save()