mirror of
https://github.com/nasa/openmct.git
synced 2025-04-19 16:40:58 +00:00
Fixed creation
This commit is contained in:
parent
836b5db8cf
commit
5bf750c90c
@ -83,6 +83,7 @@ define(
|
||||
CreateAction.prototype.perform = function () {
|
||||
var newModel = this.type.getInitialModel(),
|
||||
parentObject = this.navigationService.getNavigation(),
|
||||
editorCapability,
|
||||
newObject;
|
||||
|
||||
newModel.type = this.type.getKey();
|
||||
@ -90,12 +91,18 @@ define(
|
||||
newObject.useCapability('mutation', function(model){
|
||||
model.location = parentObject.getId();
|
||||
});
|
||||
editorCapability = newObject.getCapability("editor");
|
||||
|
||||
if (countEditableViews(newObject) > 0 && newObject.hasCapability('composition')) {
|
||||
this.navigationService.setNavigation(newObject);
|
||||
newObject.getCapability("action").perform("edit");
|
||||
return newObject.getCapability("action").perform("edit");
|
||||
} else {
|
||||
return newObject.getCapability('action').perform('save');
|
||||
editorCapability.edit();
|
||||
return newObject.useCapability("action").perform("save").then(function () {
|
||||
return editorCapability.save();
|
||||
}, function () {
|
||||
return editorCapability.cancel()
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -60,7 +60,7 @@ define(
|
||||
// during editing.
|
||||
function doSave() {
|
||||
return domainObject.getCapability("editor").save()
|
||||
.then(resolveWith(domainObject.getOriginalObject()));
|
||||
.then(resolveWith(domainObject));
|
||||
}
|
||||
|
||||
// Discard the current root view (which will be the editing
|
||||
|
@ -157,8 +157,7 @@ define(
|
||||
SaveAsAction.appliesTo = function (context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
return domainObject !== undefined &&
|
||||
domainObject.hasCapability("editor") &&
|
||||
domainObject.getCapability("editor").inEditContext() &&
|
||||
domainObject.getCapability("status").get("editing") &&
|
||||
domainObject.getModel().persisted === undefined;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user