diff --git a/platform/commonUI/browse/bundle.json b/platform/commonUI/browse/bundle.json index ccf4234ddd..5cb4b09502 100644 --- a/platform/commonUI/browse/bundle.json +++ b/platform/commonUI/browse/bundle.json @@ -150,7 +150,7 @@ "provides": "actionService", "type": "provider", "implementation": "creation/CreateActionProvider.js", - "depends": [ "$injector", "$q", "typeService", + "depends": ["$q", "typeService", "navigationService"] }, { diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index c829731f7c..77a612da15 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -51,7 +51,7 @@ define( * which handles changes in navigation. It allows the object * being browsed/edited to be set. */ - function CreateAction(type, parent, context, $injector, $q, navigationService) { + function CreateAction(type, parent, context, $q, navigationService) { this.metadata = { key: 'create', glyph: type.getGlyph(), diff --git a/platform/commonUI/browse/src/creation/CreateActionProvider.js b/platform/commonUI/browse/src/creation/CreateActionProvider.js index 9be8052ecf..2624dc0961 100644 --- a/platform/commonUI/browse/src/creation/CreateActionProvider.js +++ b/platform/commonUI/browse/src/creation/CreateActionProvider.js @@ -46,10 +46,9 @@ define( * introduced in this bundle), responsible for handling actual * object creation. */ - function CreateActionProvider($injector, $q, typeService, navigationService) { + function CreateActionProvider($q, typeService, navigationService) { this.typeService = typeService; this.navigationService = navigationService; - this.$injector = $injector; this.$q = $q; } @@ -75,7 +74,6 @@ define( type, destination, context, - self.$injector, self.$q, self.navigationService ); diff --git a/platform/commonUI/browse/src/creation/CreateWizard.js b/platform/commonUI/browse/src/creation/CreateWizard.js index e902301977..caa60c6150 100644 --- a/platform/commonUI/browse/src/creation/CreateWizard.js +++ b/platform/commonUI/browse/src/creation/CreateWizard.js @@ -34,9 +34,9 @@ define( * @memberof platform/commonUI/browse * @constructor */ - function CreateWizard(type, parent, policyService) { + function CreateWizard(type, parent, policyService, initialModel) { this.type = type; - this.model = type.getInitialModel(); + this.model = initialModel || type.getInitialModel(); this.properties = type.getProperties(); this.parent = parent; this.policyService = policyService; diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index e484be4922..684b320fb1 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -76,19 +76,26 @@ define( function doWizardSave(parent) { 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 // input. function buildObjectFromInput(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 // from user form. domainObject.useCapability("mutation", function(){ - newModel.location = parent.getId(); - newModel.composition = domainObject.getModel().composition; - return newModel; + //Replace object model with the model from the form + return formModel; }); return domainObject; }