Skip to content

Commit e220eac

Browse files
committed
serialize nodeUI
1 parent c84ee62 commit e220eac

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

services/static-webserver/client/source/class/osparc/data/model/Node.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,19 @@ qx.Class.define("osparc.data.model.Node", {
13071307
}
13081308

13091309
return filteredNodeEntry;
1310-
}
1310+
},
1311+
1312+
serializeUI: function() {
1313+
const uiInfo = {
1314+
"position": this.getPosition(),
1315+
};
1316+
const marker = this.getMarker();
1317+
if (marker) {
1318+
uiInfo["marker"] = {
1319+
"color": marker.getColor()
1320+
};
1321+
}
1322+
return uiInfo;
1323+
},
13111324
}
13121325
});

services/static-webserver/client/source/class/osparc/data/model/Workbench.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -743,9 +743,8 @@ qx.Class.define("osparc.data.model.Workbench", {
743743
// workbench is not initialized
744744
return this.__workbenchInitData;
745745
}
746-
let workbench = {};
747-
const allModels = this.getNodes();
748-
const nodes = Object.values(allModels);
746+
const workbench = {};
747+
const nodes = Object.values(this.getNodes());
749748
for (const node of nodes) {
750749
const data = node.serialize(clean);
751750
if (data) {
@@ -760,17 +759,12 @@ qx.Class.define("osparc.data.model.Workbench", {
760759
// workbenchUI is not initialized
761760
return this.__workbenchUIInitData;
762761
}
763-
let workbenchUI = {};
764-
const nodes = this.getNodes();
765-
for (const nodeId in nodes) {
766-
const node = nodes[nodeId];
767-
workbenchUI[nodeId] = {};
768-
workbenchUI[nodeId]["position"] = node.getPosition();
769-
const marker = node.getMarker();
770-
if (marker) {
771-
workbenchUI[nodeId]["marker"] = {
772-
color: marker.getColor()
773-
};
762+
const workbenchUI = {};
763+
const nodes = Object.values(this.getNodes());
764+
for (const node of nodes) {
765+
const data = node.serializeUI(clean);
766+
if (data) {
767+
workbench[node.getNodeId()] = data;
774768
}
775769
}
776770
return workbenchUI;

0 commit comments

Comments
 (0)