#286 Fixed issues with composition not surviving through create wizard
This commit is contained in:
@@ -150,7 +150,7 @@
|
|||||||
"provides": "actionService",
|
"provides": "actionService",
|
||||||
"type": "provider",
|
"type": "provider",
|
||||||
"implementation": "creation/CreateActionProvider.js",
|
"implementation": "creation/CreateActionProvider.js",
|
||||||
"depends": [ "$injector", "$q", "typeService",
|
"depends": ["$q", "typeService",
|
||||||
"navigationService"]
|
"navigationService"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ define(
|
|||||||
* which handles changes in navigation. It allows the object
|
* which handles changes in navigation. It allows the object
|
||||||
* being browsed/edited to be set.
|
* being browsed/edited to be set.
|
||||||
*/
|
*/
|
||||||
function CreateAction(type, parent, context, $injector, $q, navigationService) {
|
function CreateAction(type, parent, context, $q, navigationService) {
|
||||||
this.metadata = {
|
this.metadata = {
|
||||||
key: 'create',
|
key: 'create',
|
||||||
glyph: type.getGlyph(),
|
glyph: type.getGlyph(),
|
||||||
|
|||||||
@@ -46,10 +46,9 @@ define(
|
|||||||
* introduced in this bundle), responsible for handling actual
|
* introduced in this bundle), responsible for handling actual
|
||||||
* object creation.
|
* object creation.
|
||||||
*/
|
*/
|
||||||
function CreateActionProvider($injector, $q, typeService, navigationService) {
|
function CreateActionProvider($q, typeService, navigationService) {
|
||||||
this.typeService = typeService;
|
this.typeService = typeService;
|
||||||
this.navigationService = navigationService;
|
this.navigationService = navigationService;
|
||||||
this.$injector = $injector;
|
|
||||||
this.$q = $q;
|
this.$q = $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +74,6 @@ define(
|
|||||||
type,
|
type,
|
||||||
destination,
|
destination,
|
||||||
context,
|
context,
|
||||||
self.$injector,
|
|
||||||
self.$q,
|
self.$q,
|
||||||
self.navigationService
|
self.navigationService
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ define(
|
|||||||
* @memberof platform/commonUI/browse
|
* @memberof platform/commonUI/browse
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function CreateWizard(type, parent, policyService) {
|
function CreateWizard(type, parent, policyService, initialModel) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.model = type.getInitialModel();
|
this.model = initialModel || type.getInitialModel();
|
||||||
this.properties = type.getProperties();
|
this.properties = type.getProperties();
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.policyService = policyService;
|
this.policyService = policyService;
|
||||||
|
|||||||
@@ -76,19 +76,26 @@ define(
|
|||||||
|
|
||||||
function doWizardSave(parent) {
|
function doWizardSave(parent) {
|
||||||
var context = domainObject.getCapability("context");
|
var context = domainObject.getCapability("context");
|
||||||
var wizard = new CreateWizard(domainObject.useCapability('type'), parent, self.policyService);
|
var wizard = new CreateWizard(domainObject.useCapability('type'), parent, self.policyService, domainObject.getModel());
|
||||||
|
|
||||||
|
function mergeObjects(fromObject, toObject){
|
||||||
|
Object.keys(fromObject).forEach(function(key) {
|
||||||
|
toObject[key] = fromObject[key];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Create and persist the new object, based on user
|
// Create and persist the new object, based on user
|
||||||
// input.
|
// input.
|
||||||
function buildObjectFromInput(formValue) {
|
function buildObjectFromInput(formValue) {
|
||||||
var parent = wizard.getLocation(formValue),
|
var parent = wizard.getLocation(formValue),
|
||||||
newModel = wizard.createModel(formValue);
|
formModel = wizard.createModel(formValue);
|
||||||
|
|
||||||
|
formModel.location = parent.getId();
|
||||||
//Replace domain object model with model collected
|
//Replace domain object model with model collected
|
||||||
// from user form.
|
// from user form.
|
||||||
domainObject.useCapability("mutation", function(){
|
domainObject.useCapability("mutation", function(){
|
||||||
newModel.location = parent.getId();
|
//Replace object model with the model from the form
|
||||||
newModel.composition = domainObject.getModel().composition;
|
return formModel;
|
||||||
return newModel;
|
|
||||||
});
|
});
|
||||||
return domainObject;
|
return domainObject;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user