From 7ba392b85e057a4d3ec82df2d03144ea06c001f7 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 8 Sep 2025 15:26:54 +0200 Subject: [PATCH 1/6] not needed anymore --- .../class/osparc/desktop/StudyEditor.js | 77 +------------------ 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js index e50d1cbfc614..f35f4a885203 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js @@ -155,8 +155,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { __viewsStack: null, __workbenchView: null, __slideshowView: null, - __autoSaveTimer: null, - __savingTimer: null, __studyEditorIdlingTracker: null, __lastSyncedProjectDocument: null, __lastSyncedProjectVersion: null, @@ -267,10 +265,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { } } - if (osparc.data.model.Study.canIWrite(study.getAccessRights())) { - this.__startAutoSaveTimer(); - this.__startSavingTimer(); - } else { + if (!osparc.data.model.Study.canIWrite(study.getAccessRights())) { const msg = this.self().READ_ONLY_TEXT; osparc.FlashMessenger.logAs(msg, "WARNING"); } @@ -953,67 +948,8 @@ qx.Class.define("osparc.desktop.StudyEditor", { }, // ------------------ IDLING TRACKER ------------------ - // ------------------ AUTO SAVER ------------------ - __startAutoSaveTimer: function() { - if (osparc.utils.Utils.eventDrivenPatch()) { - // If event driven patch is enabled, auto save is not needed - return; - } - - // Save every 3 seconds - const timer = this.__autoSaveTimer = new qx.event.Timer(this.self().AUTO_SAVE_INTERVAL); - timer.addListener("interval", () => { - if (!osparc.wrapper.WebSocket.getInstance().isConnected()) { - return; - } - this.__checkStudyChanges(); - }, this); - timer.start(); - }, - - __stopAutoSaveTimer: function() { - if (this.__autoSaveTimer && this.__autoSaveTimer.isEnabled()) { - this.__autoSaveTimer.stop(); - this.__autoSaveTimer.setEnabled(false); - } - }, - - __restartAutoSaveTimer: function() { - if (this.__autoSaveTimer && this.__autoSaveTimer.isEnabled()) { - this.__autoSaveTimer.restart(); - } - }, - // ------------------ AUTO SAVER ------------------ - - // ---------------- SAVING TIMER ------------------ - __startSavingTimer: function() { - if (osparc.utils.Utils.eventDrivenPatch()) { - // If event driven patch is enabled, saving timer indicator is not needed - return; - } - - const timer = this.__savingTimer = new qx.event.Timer(this.self().DIFF_CHECK_INTERVAL); - timer.addListener("interval", () => { - if (!osparc.wrapper.WebSocket.getInstance().isConnected()) { - return; - } - this.getStudy().setSavePending(this.didStudyChange()); - }, this); - timer.start(); - }, - - __stopSavingTimer: function() { - if (this.__savingTimer && this.__savingTimer.isEnabled()) { - this.__savingTimer.stop(); - this.__savingTimer.setEnabled(false); - } - }, - // ---------------- SAVING TIMER ------------------ - __stopTimers: function() { this.__stopIdlingTracker(); - this.__stopAutoSaveTimer(); - this.__stopSavingTimer(); }, __getStudyDiffs: function() { @@ -1040,17 +976,6 @@ qx.Class.define("osparc.desktop.StudyEditor", { return changed; }, - __checkStudyChanges: function() { - if (this.didStudyChange()) { - if (this.__updatingStudy > 0) { - // throttle update - this.__updateThrottled = true; - } else { - this.updateStudyDocument(); - } - } - }, - /** * @param {JSON Patch} data It will soon be used to patch the project document https://datatracker.ietf.org/doc/html/rfc6902 */ From 81bb3864b3148c424a2dbfac725fee89103724f6 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 8 Sep 2025 15:42:10 +0200 Subject: [PATCH 2/6] remove unnecessary events --- .../source/class/osparc/data/model/Node.js | 1 - .../class/osparc/data/model/Workbench.js | 22 ++++--------------- .../class/osparc/desktop/StudyEditor.js | 9 ++------ .../class/osparc/node/BootOptionsView.js | 1 - .../source/class/osparc/node/LifeCycleView.js | 1 - .../client/source/class/osparc/utils/Utils.js | 4 ---- 6 files changed, 6 insertions(+), 32 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/Node.js b/services/static-webserver/client/source/class/osparc/data/model/Node.js index ce0d98d11b21..fd2be7aa4dc5 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Node.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Node.js @@ -196,7 +196,6 @@ qx.Class.define("osparc.data.model.Node", { }, events: { - "updateStudyDocument": "qx.event.type.Event", "projectDocumentChanged": "qx.event.type.Data", "reloadModel": "qx.event.type.Event", "retrieveInputs": "qx.event.type.Data", diff --git a/services/static-webserver/client/source/class/osparc/data/model/Workbench.js b/services/static-webserver/client/source/class/osparc/data/model/Workbench.js index f827f08017e8..e6e55021667d 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Workbench.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Workbench.js @@ -50,9 +50,7 @@ qx.Class.define("osparc.data.model.Workbench", { }, events: { - "updateStudyDocument": "qx.event.type.Event", "projectDocumentChanged": "qx.event.type.Data", - "restartAutoSaveTimer": "qx.event.type.Event", "pipelineChanged": "qx.event.type.Event", "nodeAdded": "qx.event.type.Data", "nodeRemoved": "qx.event.type.Data", @@ -352,7 +350,6 @@ qx.Class.define("osparc.data.model.Workbench", { return null; } - this.fireEvent("restartAutoSaveTimer"); // create the node in the backend first const params = { url: { @@ -368,7 +365,6 @@ qx.Class.define("osparc.data.model.Workbench", { const resp = await osparc.data.Resources.fetch("studies", "addNode", params); const nodeId = resp["node_id"]; - this.fireEvent("restartAutoSaveTimer"); const node = this.__createNode(key, version, nodeId); node.fetchMetadataAndPopulate() .then(() => { @@ -394,15 +390,11 @@ qx.Class.define("osparc.data.model.Workbench", { }, __initNodeSignals: function(node) { - if (osparc.utils.Utils.eventDrivenPatch()) { - node.listenToChanges(); - node.addListener("projectDocumentChanged", e => this.fireDataEvent("projectDocumentChanged", e.getData()), this); - } + node.listenToChanges(); + node.addListener("projectDocumentChanged", e => this.fireDataEvent("projectDocumentChanged", e.getData()), this); node.addListener("keyChanged", () => this.fireEvent("reloadModel"), this); node.addListener("changeInputNodes", () => this.fireDataEvent("pipelineChanged"), this); node.addListener("reloadModel", () => this.fireEvent("reloadModel"), this); - node.addListener("updateStudyDocument", () => this.fireEvent("updateStudyDocument"), this); - node.addListener("showInLogger", e => this.fireDataEvent("showInLogger", e.getData()), this); node.addListener("retrieveInputs", e => this.fireDataEvent("retrieveInputs", e.getData()), this); node.addListener("fileRequested", e => this.fireDataEvent("fileRequested", e.getData()), this); @@ -633,7 +625,6 @@ qx.Class.define("osparc.data.model.Workbench", { return; } - this.fireEvent("restartAutoSaveTimer"); let node = this.getNode(nodeId); if (node) { // remove the node in the backend first @@ -645,8 +636,6 @@ qx.Class.define("osparc.data.model.Workbench", { }, __nodeRemoved: function(nodeId) { - this.fireEvent("restartAutoSaveTimer"); - delete this.__nodes[nodeId]; // remove first the connected edges @@ -1002,14 +991,11 @@ qx.Class.define("osparc.data.model.Workbench", { __createNodeOld: function(metadata, nodeId) { const node = new osparc.data.model.Node(this.getStudy(), metadata["key"], metadata["version"], nodeId); node.setMetadata(metadata); - if (osparc.utils.Utils.eventDrivenPatch()) { - node.listenToChanges(); - node.addListener("projectDocumentChanged", e => this.fireDataEvent("projectDocumentChanged", e.getData()), this); - } + node.listenToChanges(); + node.addListener("projectDocumentChanged", e => this.fireDataEvent("projectDocumentChanged", e.getData()), this); node.addListener("keyChanged", () => this.fireEvent("reloadModel"), this); node.addListener("changeInputNodes", () => this.fireDataEvent("pipelineChanged"), this); node.addListener("reloadModel", () => this.fireEvent("reloadModel"), this); - node.addListener("updateStudyDocument", () => this.fireEvent("updateStudyDocument"), this); osparc.utils.Utils.localCache.serviceToFavs(metadata["key"]); this.__initNodeSignals(node); diff --git a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js index f35f4a885203..01342db2c426 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js @@ -287,13 +287,8 @@ qx.Class.define("osparc.desktop.StudyEditor", { this.nodeSelected(nodeId); }, this); - if (osparc.utils.Utils.eventDrivenPatch()) { - study.listenToChanges(); // this includes the listener on the workbench and ui - study.addListener("projectDocumentChanged", e => this.projectDocumentChanged(e.getData()), this); - } else { - workbench.addListener("updateStudyDocument", () => this.updateStudyDocument()); - workbench.addListener("restartAutoSaveTimer", () => this.__restartAutoSaveTimer()); - } + study.listenToChanges(); // this includes the listener on the workbench and ui + study.addListener("projectDocumentChanged", e => this.projectDocumentChanged(e.getData()), this); if (osparc.utils.DisabledPlugins.isRTCEnabled()) { this.__listenToProjectDocument(); diff --git a/services/static-webserver/client/source/class/osparc/node/BootOptionsView.js b/services/static-webserver/client/source/class/osparc/node/BootOptionsView.js index 8725dddfce69..02ba8b5f7530 100644 --- a/services/static-webserver/client/source/class/osparc/node/BootOptionsView.js +++ b/services/static-webserver/client/source/class/osparc/node/BootOptionsView.js @@ -54,7 +54,6 @@ qx.Class.define("osparc.node.BootOptionsView", { "boot_mode": newBootModeId }; node.setBootOptions(data); - node.fireEvent("updateStudyDocument"); node.fireDataEvent("projectDocumentChanged", { "op": "replace", "path": `/workbench/${nodeId}/bootOptions`, diff --git a/services/static-webserver/client/source/class/osparc/node/LifeCycleView.js b/services/static-webserver/client/source/class/osparc/node/LifeCycleView.js index d67382c725da..6e2f86f02ab1 100644 --- a/services/static-webserver/client/source/class/osparc/node/LifeCycleView.js +++ b/services/static-webserver/client/source/class/osparc/node/LifeCycleView.js @@ -119,7 +119,6 @@ qx.Class.define("osparc.node.LifeCycleView", { newData["version"] = latestCompatible["version"]; } node.set(newData); - node.fireEvent("updateStudyDocument"); node.fireDataEvent("projectDocumentChanged", [{ "op": "replace", "path": `/workbench/${nodeId}/key`, diff --git a/services/static-webserver/client/source/class/osparc/utils/Utils.js b/services/static-webserver/client/source/class/osparc/utils/Utils.js index 471c076c542a..c7e93416d908 100644 --- a/services/static-webserver/client/source/class/osparc/utils/Utils.js +++ b/services/static-webserver/client/source/class/osparc/utils/Utils.js @@ -542,10 +542,6 @@ qx.Class.define("osparc.utils.Utils", { return (["dev", "master"].includes(platformName)); }, - eventDrivenPatch: function() { - return osparc.utils.DisabledPlugins.isRTCEnabled(); - }, - getEditButton: function(isVisible = true) { return new qx.ui.form.Button(null, "@FontAwesome5Solid/pencil-alt/12").set({ appearance: "form-button-outlined", From e4106aa84e08765200b05d1eee07e77dbc52d5d9 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 8 Sep 2025 16:16:50 +0200 Subject: [PATCH 3/6] deprecated --- .../class/osparc/data/model/Workbench.js | 74 ------------------- 1 file changed, 74 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/Workbench.js b/services/static-webserver/client/source/class/osparc/data/model/Workbench.js index e6e55021667d..33c03962ad6c 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Workbench.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Workbench.js @@ -944,79 +944,5 @@ qx.Class.define("osparc.data.model.Workbench", { node.updateNodeFromPatch(nodePatches); }); }, - - /** - * @deprecated This method is deprecated and will be removed in a future release. - * Please use `__deserialize` instead for deserializing workbench data. - * Migration: Replace calls to `__deserializeOld` with `__deserialize`. - */ - __deserializeOld: function(workbenchInitData, workbenchUIInitData) { - this.__deserializeNodesOld(workbenchInitData, workbenchUIInitData) - .then(() => { - this.__deserializeEdges(workbenchInitData); - workbenchInitData = null; - workbenchUIInitData = null; - this.setDeserialized(true); - }); - }, - - __deserializeNodesOld: function(workbenchData, workbenchUIData = {}) { - const nodeIds = Object.keys(workbenchData); - const serviceMetadataPromises = []; - nodeIds.forEach(nodeId => { - const nodeData = workbenchData[nodeId]; - serviceMetadataPromises.push(osparc.store.Services.getService(nodeData.key, nodeData.version)); - }); - return Promise.allSettled(serviceMetadataPromises) - .then(results => { - const missing = results.filter(result => result.status === "rejected" || result.value === null) - if (missing.length) { - const errorMsg = qx.locale.Manager.tr("Service metadata missing"); - osparc.FlashMessenger.logError(errorMsg); - return; - } - const values = results.map(result => result.value); - // Create first all the nodes - for (let i=0; i this.fireDataEvent("projectDocumentChanged", e.getData()), this); - node.addListener("keyChanged", () => this.fireEvent("reloadModel"), this); - node.addListener("changeInputNodes", () => this.fireDataEvent("pipelineChanged"), this); - node.addListener("reloadModel", () => this.fireEvent("reloadModel"), this); - osparc.utils.Utils.localCache.serviceToFavs(metadata["key"]); - - this.__initNodeSignals(node); - this.__addNode(node); - - return node; - }, - - __populateNodesDataOld: function(workbenchData, workbenchUIData) { - Object.entries(workbenchData).forEach(([nodeId, nodeData]) => { - this.getNode(nodeId).populateNodeData(nodeData); - - if ("position" in nodeData) { - // old place to store the position - this.getNode(nodeId).populateNodeUIData(nodeData); - } - if (workbenchUIData && "workbench" in workbenchUIData && nodeId in workbenchUIData["workbench"]) { - // new place to store the position and marker - this.getNode(nodeId).populateNodeUIData(workbenchUIData["workbench"][nodeId]); - } - }); - }, } }); From 31ed55f34e435f2329863d0243a2592b13ec47f7 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 8 Sep 2025 16:19:08 +0200 Subject: [PATCH 4/6] listenToChanges --- .../source/class/osparc/data/model/Node.js | 39 +++++++++---------- .../class/osparc/data/model/Workbench.js | 1 - 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/Node.js b/services/static-webserver/client/source/class/osparc/data/model/Node.js index fd2be7aa4dc5..8a7448bd893f 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Node.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Node.js @@ -489,6 +489,7 @@ qx.Class.define("osparc.data.model.Node", { this.populateNodeUIData(nodeData); // new place to store the position and marker this.populateNodeUIData(nodeUiData); + this.listenToChanges(); }) .catch(err => { console.log(err); @@ -1350,28 +1351,26 @@ qx.Class.define("osparc.data.model.Node", { this.self().ListenChangesProps.forEach(key => { switch (key) { case "inputs": - if (this.hasPropsForm()) { - // listen to changes in the props form - this.getPropsForm().addListener("changeData", () => { - const data = this.__getInputData(); - this.fireDataEvent("projectDocumentChanged", { - "op": "replace", - "path": `/workbench/${nodeId}/inputs`, - "value": data, - "osparc-resource": "node", - }); + // listen to changes in the props form + this.getPropsForm().addListener("changeData", () => { + const data = this.__getInputData(); + this.fireDataEvent("projectDocumentChanged", { + "op": "replace", + "path": `/workbench/${nodeId}/inputs`, + "value": data, + "osparc-resource": "node", }); - // listen to changes in link and unlink of ports - this.getPropsForm().addListener("linkFieldModified", () => { - const data = this.__getInputData(); - this.fireDataEvent("projectDocumentChanged", { - "op": "replace", - "path": `/workbench/${nodeId}/inputs`, - "value": data, - "osparc-resource": "node", - }); + }); + // listen to changes in link and unlink of ports + this.getPropsForm().addListener("linkFieldModified", () => { + const data = this.__getInputData(); + this.fireDataEvent("projectDocumentChanged", { + "op": "replace", + "path": `/workbench/${nodeId}/inputs`, + "value": data, + "osparc-resource": "node", }); - } + }); break; case "inputsUnits": if (this.hasPropsForm()) { diff --git a/services/static-webserver/client/source/class/osparc/data/model/Workbench.js b/services/static-webserver/client/source/class/osparc/data/model/Workbench.js index 33c03962ad6c..736632534619 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Workbench.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Workbench.js @@ -390,7 +390,6 @@ qx.Class.define("osparc.data.model.Workbench", { }, __initNodeSignals: function(node) { - node.listenToChanges(); node.addListener("projectDocumentChanged", e => this.fireDataEvent("projectDocumentChanged", e.getData()), this); node.addListener("keyChanged", () => this.fireEvent("reloadModel"), this); node.addListener("changeInputNodes", () => this.fireDataEvent("pipelineChanged"), this); From ca29a3fab0b229539ed6418915f6280c03236d32 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 8 Sep 2025 16:20:00 +0200 Subject: [PATCH 5/6] minor --- .../source/class/osparc/data/model/Node.js | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/data/model/Node.js b/services/static-webserver/client/source/class/osparc/data/model/Node.js index 8a7448bd893f..0426f16e8532 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/Node.js +++ b/services/static-webserver/client/source/class/osparc/data/model/Node.js @@ -1351,26 +1351,28 @@ qx.Class.define("osparc.data.model.Node", { this.self().ListenChangesProps.forEach(key => { switch (key) { case "inputs": - // listen to changes in the props form - this.getPropsForm().addListener("changeData", () => { - const data = this.__getInputData(); - this.fireDataEvent("projectDocumentChanged", { - "op": "replace", - "path": `/workbench/${nodeId}/inputs`, - "value": data, - "osparc-resource": "node", + if (this.hasPropsForm()) { + // listen to changes in the props form + this.getPropsForm().addListener("changeData", () => { + const data = this.__getInputData(); + this.fireDataEvent("projectDocumentChanged", { + "op": "replace", + "path": `/workbench/${nodeId}/inputs`, + "value": data, + "osparc-resource": "node", + }); }); - }); - // listen to changes in link and unlink of ports - this.getPropsForm().addListener("linkFieldModified", () => { - const data = this.__getInputData(); - this.fireDataEvent("projectDocumentChanged", { - "op": "replace", - "path": `/workbench/${nodeId}/inputs`, - "value": data, - "osparc-resource": "node", + // listen to changes in link and unlink of ports + this.getPropsForm().addListener("linkFieldModified", () => { + const data = this.__getInputData(); + this.fireDataEvent("projectDocumentChanged", { + "op": "replace", + "path": `/workbench/${nodeId}/inputs`, + "value": data, + "osparc-resource": "node", + }); }); - }); + } break; case "inputsUnits": if (this.hasPropsForm()) { From b6faf1e0ee3e65d1ac9d7f2065914a8f4d90d2d3 Mon Sep 17 00:00:00 2001 From: odeimaiz Date: Mon, 8 Sep 2025 16:33:12 +0200 Subject: [PATCH 6/6] minors --- .../client/source/class/osparc/node/LifeCycleView.js | 1 + .../client/source/class/osparc/workbench/WorkbenchUI.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/node/LifeCycleView.js b/services/static-webserver/client/source/class/osparc/node/LifeCycleView.js index 6e2f86f02ab1..b64672cb88a5 100644 --- a/services/static-webserver/client/source/class/osparc/node/LifeCycleView.js +++ b/services/static-webserver/client/source/class/osparc/node/LifeCycleView.js @@ -119,6 +119,7 @@ qx.Class.define("osparc.node.LifeCycleView", { newData["version"] = latestCompatible["version"]; } node.set(newData); + const nodeId = node.getNodeId(); node.fireDataEvent("projectDocumentChanged", [{ "op": "replace", "path": `/workbench/${nodeId}/key`, diff --git a/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js b/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js index b1b6c6869311..e68c6774f326 100644 --- a/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js +++ b/services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js @@ -540,7 +540,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", { nodeUI.addListener("dbltap", e => { this.fireDataEvent("nodeSelected", nodeUI.getNodeId()); - if (nodeUI.getNode().canNodeStart()) { + if (nodeUI.getNode().canNodeStart() && !nodeUI.getNode().getStudy().getDisableServiceAutoStart()) { nodeUI.getNode().requestStartNode(); } e.stopPropagation();