Merge pull request #3364 from nasa/create-namespace-fix

Update namespace of object after location selected
This commit is contained in:
Shefali Joshi 2020-09-14 09:28:50 -07:00 committed by GitHub
commit 9f6bfa2351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,6 +112,9 @@ define(
formModel = this.createModel(formValue); formModel = this.createModel(formValue);
formModel.location = parent.getId(); formModel.location = parent.getId();
this.updateNamespaceFromParent(parent);
this.domainObject.useCapability("mutation", function () { this.domainObject.useCapability("mutation", function () {
return formModel; return formModel;
}); });
@ -119,6 +122,14 @@ define(
return this.domainObject; 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. * Get the initial value for the form being described.
* This will include the values for all properties described * This will include the values for all properties described