mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 06:08:11 +00:00
[New Edit Mode] Fixed failing tests, and added new test in CreateWizard
[New Edit Mode] #480 fixed JSLint errors [New Edit Mode] #480 do not show locator for sub objects [New Edit Mode] Modified persistence in SaveAction Removed redundant variable Fixed Failing Test Fixed JSLint errors Improved some documentation
This commit is contained in:
@ -82,17 +82,20 @@ define(
|
||||
wizard = new CreateWizard(domainObject, parent, self.policyService);
|
||||
|
||||
return self.dialogService
|
||||
.getUserInput(wizard.getFormStructure(), wizard.getInitialFormValue())
|
||||
.getUserInput(wizard.getFormStructure(true), wizard.getInitialFormValue())
|
||||
.then(function(formValue){
|
||||
wizard.populateObjectFromInput(formValue, domainObject)
|
||||
return wizard.populateObjectFromInput(formValue, domainObject);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function persistObject(object){
|
||||
return ((object.hasCapability('editor') && object.getCapability('editor').save()) ||
|
||||
object.getCapability('persistence').persist())
|
||||
.then(resolveWith(object));
|
||||
|
||||
//Persist first to mark dirty
|
||||
return object.getCapability('persistence').persist().then(function(){
|
||||
//then save permanently
|
||||
return object.getCapability('editor').save();
|
||||
});
|
||||
}
|
||||
|
||||
function fetchObject(objectId){
|
||||
@ -107,7 +110,9 @@ define(
|
||||
|
||||
function locateObjectInParent(parent){
|
||||
parent.getCapability('composition').add(domainObject.getId());
|
||||
return parent;
|
||||
return parent.getCapability('persistence').persist().then(function() {
|
||||
return parent;
|
||||
});
|
||||
}
|
||||
|
||||
function doNothing() {
|
||||
@ -129,7 +134,6 @@ define(
|
||||
.then(getParent)//Parent may have changed based
|
||||
// on user selection
|
||||
.then(locateObjectInParent)
|
||||
.then(persistObject)
|
||||
.then(function(){
|
||||
return fetchObject(domainObject.getId());
|
||||
})
|
||||
|
@ -45,7 +45,8 @@ define(
|
||||
cache,
|
||||
idempotent
|
||||
) {
|
||||
var capability = Object.create(contextCapability);
|
||||
var capability = Object.create(contextCapability),
|
||||
method;
|
||||
|
||||
// Check for domain object interface. If something has these
|
||||
// three methods, we assume it's a domain object.
|
||||
@ -114,7 +115,7 @@ define(
|
||||
}
|
||||
|
||||
// Wrap all methods; return only editable domain objects.
|
||||
for (var method in contextCapability){
|
||||
for (method in contextCapability) {
|
||||
wrapMethod(method);
|
||||
}
|
||||
|
||||
|
@ -110,8 +110,8 @@ define(
|
||||
}
|
||||
//Return the original (non-editable) object
|
||||
return returnPromise.then(function() {
|
||||
return domainObject;
|
||||
})
|
||||
return domainObject.getOriginalObject ? domainObject.getOriginalObject() : domainObject;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user