save object before triggering mutate (#2336)

This commit is contained in:
Deep Tailor
2019-03-28 13:54:27 -07:00
committed by Andrew Henry
parent 994f6be535
commit 327782835e

View File

@ -162,9 +162,6 @@ function (
function saveAfterClone(clonedObject) { function saveAfterClone(clonedObject) {
return this.openmct.editor.save().then(() => { return this.openmct.editor.save().then(() => {
// Force mutation for search indexing // Force mutation for search indexing
clonedObject.useCapability('mutation', (model) => {
return model;
});
return clonedObject; return clonedObject;
}) })
} }
@ -173,6 +170,14 @@ function (
return fetchObject(clonedObject.getId()) return fetchObject(clonedObject.getId())
} }
function indexForSearch(savedObject) {
savedObject.useCapability('mutation', (model) => {
return model;
});
return savedObject;
}
function onSuccess(object) { function onSuccess(object) {
self.notificationService.info("Save Succeeded"); self.notificationService.info("Save Succeeded");
return object; return object;
@ -194,6 +199,7 @@ function (
.then(undirtyOriginals) .then(undirtyOriginals)
.then(saveAfterClone) .then(saveAfterClone)
.then(finishEditing) .then(finishEditing)
.then(indexForSearch)
.then(hideBlockingDialog) .then(hideBlockingDialog)
.then(onSuccess) .then(onSuccess)
.catch(onFailure); .catch(onFailure);