From c38d810658002963d47fd8a76e923b8cdb31453d Mon Sep 17 00:00:00 2001 From: Deep Tailor Date: Fri, 24 May 2019 12:04:41 -0700 Subject: [PATCH] Fix import export (#2407) * working import/export, need to check with objects that have name-spaces * use keystrings instead of key --- .../import-export/src/actions/ImportAsJSONAction.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/platform/import-export/src/actions/ImportAsJSONAction.js b/platform/import-export/src/actions/ImportAsJSONAction.js index deb57be834..8b253af155 100644 --- a/platform/import-export/src/actions/ImportAsJSONAction.js +++ b/platform/import-export/src/actions/ImportAsJSONAction.js @@ -80,15 +80,17 @@ define(['zepto'], function ($) { var newObj; seen.push(parent.getId()); - parentModel.composition.forEach(function (childId, index) { - if (!tree[childId] || seen.includes(childId)) { + + parentModel.composition.forEach(function (childId) { + let keystring = this.openmct.objects.makeKeyString(childId); + + if (!tree[keystring] || seen.includes(keystring)) { return; } - newObj = this.instantiate(tree[childId], childId); - parent.getCapability("composition").add(newObj); + newObj = this.instantiate(tree[keystring], keystring); newObj.getCapability("location") - .setPrimaryLocation(tree[childId].location); + .setPrimaryLocation(tree[keystring].location); this.deepInstantiate(newObj, tree, seen); }, this); }