mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 17:33:23 +00:00
[Add] Fix promise chaining in AddAction
This commit is contained in:
parent
9c9db3c24f
commit
d12111d9b8
@ -93,21 +93,23 @@ define(
|
||||
return wizard.populateObjectFromInput(formValue, newObject);
|
||||
}
|
||||
|
||||
function addToParent (populatedObject) {
|
||||
parentObject.getCapability('composition').add(populatedObject);
|
||||
return parentObject.getCapability('persistence').persist().then(function(){
|
||||
return parentObject;
|
||||
});
|
||||
function persistAndReturn(domainObject) {
|
||||
return domainObject.getCapability('persistence')
|
||||
.persist()
|
||||
.then(function () {
|
||||
return domainObject;
|
||||
});
|
||||
}
|
||||
|
||||
function persistNewObject(object) {
|
||||
return object.getCapability('persistence').persist();
|
||||
function addToParent (populatedObject) {
|
||||
parentObject.getCapability('composition').add(populatedObject);
|
||||
return persistAndReturn(parentObject);
|
||||
}
|
||||
|
||||
return this.dialogService
|
||||
.getUserInput(wizard.getFormStructure(false), wizard.getInitialFormValue())
|
||||
.then(populateObjectFromInput)
|
||||
.then(persistNewObject)
|
||||
.then(persistAndReturn)
|
||||
.then(addToParent);
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user