From 888afd88b819a94fa2eea49c6a860ca4511461e0 Mon Sep 17 00:00:00 2001 From: Andrew Henry Date: Thu, 10 Sep 2020 19:11:14 -0700 Subject: [PATCH] Update namespace of object after location selected --- platform/commonUI/edit/src/creation/CreateWizard.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/platform/commonUI/edit/src/creation/CreateWizard.js b/platform/commonUI/edit/src/creation/CreateWizard.js index 4d262ab9a3..0fd053d364 100644 --- a/platform/commonUI/edit/src/creation/CreateWizard.js +++ b/platform/commonUI/edit/src/creation/CreateWizard.js @@ -112,6 +112,9 @@ define( formModel = this.createModel(formValue); formModel.location = parent.getId(); + + this.updateNamespaceFromParent(parent); + this.domainObject.useCapability("mutation", function () { return formModel; }); @@ -119,6 +122,14 @@ define( return this.domainObject; }; + /** @private */ + CreateWizard.prototype.updateNamespaceFromParent = function (parent) { + let childIdentifier = this.domainObject.useCapability('adapter').identifier; + let parentIdentifier = parent.useCapability('adapter').identifier; + childIdentifier.namespace = parentIdentifier.namespace; + this.domainObject.id = this.openmct.objects.makeKeyString(childIdentifier); + }; + /** * Get the initial value for the form being described. * This will include the values for all properties described