Skip to content

Commit 94f2359

Browse files
committed
curate comparison documents
1 parent fabcc07 commit 94f2359

File tree

1 file changed

+16
-0
lines changed
  • services/static-webserver/client/source/class/osparc/desktop

1 file changed

+16
-0
lines changed

services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
293293
if (data["projectId"] === this.getStudy().getUuid()) {
294294
const myStudy = this.getStudy().serialize();
295295
const updatedStudy = data["document"];
296+
296297
// the updatedStudy model doesn't contain the following properties
297298
[
298299
"accessRights",
@@ -304,12 +305,27 @@ qx.Class.define("osparc.desktop.StudyEditor", {
304305
].forEach(prop => {
305306
delete myStudy[prop];
306307
});
308+
307309
// ignore the ``state`` property, it has its own channel
308310
[
309311
"state",
310312
].forEach(prop => {
311313
delete updatedStudy[prop];
312314
});
315+
// in order to pair it the with frontend's node serialization
316+
// remove null entries
317+
// remove state entries
318+
Object.keys(updatedStudy["workbench"]).forEach(nodeId => {
319+
const node = updatedStudy["workbench"][nodeId];
320+
Object.keys(node).forEach(nodeProp => {
321+
if (nodeProp === "state") {
322+
delete node[nodeProp];
323+
}
324+
if (node[nodeProp] === null) {
325+
delete node[nodeProp];
326+
}
327+
});
328+
});
313329

314330
const delta = osparc.wrapper.JsonDiffPatch.getInstance().diff(myStudy, updatedStudy);
315331
console.log("projectDocument:updated delta", myStudy, updatedStudy, delta);

0 commit comments

Comments
 (0)