[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",
"policyService",
"dialogService",
"creationService"
"creationService",
"copyService"
],
"priority": "mandatory"
},

View File

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