mirror of
https://github.com/nasa/openmct.git
synced 2025-06-20 16:10:23 +00:00
Save the object before adding it to the parent so that transaction committing works properly (#4388)
This commit is contained in:
@ -132,11 +132,14 @@ function (
|
|||||||
return fetchObject(object.getModel().location);
|
return fetchObject(object.getModel().location);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveObject(parent) {
|
function saveObject(object) {
|
||||||
return self.openmct.editor.save().then(() => {
|
//persist the object, which adds it to the transaction and then call editor.save
|
||||||
// Force mutation for search indexing
|
return object.getCapability("persistence").persist()
|
||||||
return parent;
|
.then(() => {
|
||||||
});
|
return self.openmct.editor.save().then(() => {
|
||||||
|
return object;
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSavedObjectToParent(parent) {
|
function addSavedObjectToParent(parent) {
|
||||||
@ -150,17 +153,6 @@ function (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function undirty(object) {
|
|
||||||
return object.getCapability('persistence').refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
function undirtyOriginals(object) {
|
|
||||||
return object.getCapability("persistence").persist()
|
|
||||||
.then(function () {
|
|
||||||
return object;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function indexForSearch(addedObject) {
|
function indexForSearch(addedObject) {
|
||||||
addedObject.useCapability('mutation', (model) => {
|
addedObject.useCapability('mutation', (model) => {
|
||||||
return model;
|
return model;
|
||||||
@ -187,10 +179,9 @@ function (
|
|||||||
return getParent(domainObject)
|
return getParent(domainObject)
|
||||||
.then(doWizardSave)
|
.then(doWizardSave)
|
||||||
.then(showBlockingDialog)
|
.then(showBlockingDialog)
|
||||||
.then(getParent)
|
|
||||||
.then(saveObject)
|
.then(saveObject)
|
||||||
|
.then(getParent)
|
||||||
.then(addSavedObjectToParent)
|
.then(addSavedObjectToParent)
|
||||||
.then(undirtyOriginals)
|
|
||||||
.then((addedObject) => {
|
.then((addedObject) => {
|
||||||
return fetchObject(addedObject.getId());
|
return fetchObject(addedObject.getId());
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user