Skip to content

Commit 1a403bf

Browse files
committed
more properties
1 parent c201b47 commit 1a403bf

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ qx.Class.define("osparc.data.model.Study", {
145145
check: "String",
146146
nullable: true,
147147
event: "changeThumbnail",
148-
init: null
148+
init: ""
149149
},
150150

151151
workbench: {

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,33 @@ qx.Class.define("osparc.desktop.StudyEditor", {
345345
this.__blockUpdates = true;
346346
const delta = osparc.wrapper.JsonDiffPatch.getInstance().diff(myStudy, updatedStudy);
347347
console.log("projectDocument:updated delta", myStudy, updatedStudy, osparc.utils.Utils.deepCloneObject(delta));
348+
if ("workbench" in delta) {
349+
// OM todo
350+
// this.getStudy().getWorkbench().updateWorkbenchFromDiff(delta["workbench"]);
351+
delete delta["workbench"];
352+
}
348353
if ("ui" in delta) {
349354
this.getStudy().getUi().updateUiFromDiff(delta["ui"]);
350355
delete delta["ui"];
351356
}
357+
const studyPropertyKeys = osparc.data.model.Study.getProperties();
358+
studyPropertyKeys.forEach(studyPropertyKey => {
359+
if (studyPropertyKey in delta) {
360+
const newValue = delta[studyPropertyKey][1];
361+
if ("lastChangeDate" === studyPropertyKey) {
362+
this.getStudy().setLastChangeDate(new Date(newValue));
363+
return;
364+
}
365+
const upKey = qx.lang.String.firstUp(studyPropertyKey);
366+
const setter = "set" + upKey;
367+
this.getStudy()[setter](newValue);
368+
delete delta[studyPropertyKey];
369+
}
370+
});
371+
if(Object.keys(delta).length > 0) {
372+
console.warn("projectDocument:updated delta has unhandled properties", delta);
373+
}
374+
352375
this.__blockUpdates = false;
353376
}
354377
}, this);

0 commit comments

Comments
 (0)