From 46d378c60f527b493fc1d763c587a5785c5401d9 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 15 Oct 2024 11:47:34 +0200 Subject: [PATCH 01/12] listenToStateInputPorts --- .../class/osparc/desktop/StudyEditor.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) 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 1218c22fc55..b6b12c3faae 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js @@ -287,6 +287,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { this.__listenToNodeProgress(); this.__listenToNoMoreCreditsEvents(); this.__listenToEvent(); + this.__listenToStateInputPorts(); }, __listenToLogger: function() { @@ -414,6 +415,49 @@ qx.Class.define("osparc.desktop.StudyEditor", { } }, + __listenToStateInputPorts: function() { + const socket = osparc.wrapper.WebSocket.getInstance(); + if (!socket.slotExists("stateInputPorts")) { + socket.on("stateInputPorts", data => { + const studyId = data["project_id"]; + if (this.getStudy().getUuid() !== studyId) { + return; + } + + const nodeId = data["node_id"]; + const workbench = this.getStudy().getWorkbench(); + const node = workbench.getNode(nodeId); + if (!node) { + if (osparc.data.Permissions.getInstance().isTester()) { + console.log("Ignored ws 'stateInputPorts' msg", data); + } + return; + } + + if (node.getPropForm()) { + const portId = data["port_key"]; + const portStatus = data["status"]; + switch (portStatus) { + case "DOWNLOAD_STARTED": + case "UPLOAD_STARTED": + node.getPropForm().retrievingPortData(portId); + break; + case "DOWNLOAD_FINISHED_SUCCESSFULLY": + case "UPLOAD_FINISHED_SUCCESSFULLY": + node.getPropForm().retrievedPortData(portId, true); + break; + case "DOWNLOAD_WAS_ABORTED": + case "DOWNLOAD_FINISHED_WITH_ERRROR": + case "UPLOAD_WAS_ABORTED": + case "UPLOAD_FINISHED_WITH_ERRROR": + node.getPropForm().retrievedPortData(portId, false); + break; + } + } + }, this); + } + }, + __reloadSnapshotsAndIterations: function() { const isVCDisabled = osparc.utils.DisabledPlugins.isVersionControlDisabled(); if (!isVCDisabled) { From cab91a0cdc5235d80d38e40c2f69a4e99f553216 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 15 Oct 2024 11:51:05 +0200 Subject: [PATCH 02/12] RETRIEVE_STATUS --- .../class/osparc/form/renderer/PropForm.js | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js index 9150cfe0499..67b02a9217d 100644 --- a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js +++ b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js @@ -78,18 +78,17 @@ qx.Class.define("osparc.form.renderer.PropForm", { supportedTypes.push(osparc.node.ParameterEditor.getParameterOutputTypeFromMD(paramMD)); }); return supportedTypes.includes(field.type); - } - }, + }, - // eslint-disable-next-line qx-rules/no-refs-in-members - members: { - _retrieveStatus: { + RETRIEVE_STATUS: { failed: -1, empty: 0, retrieving: 1, succeed: 2 - }, + } + }, + members: { __ctrlLinkMap: null, __linkUnlinkStackMap: null, __fieldOptsBtnMap: null, @@ -529,7 +528,7 @@ qx.Class.define("osparc.form.renderer.PropForm", { }, retrievingPortData: function(portId) { - const status = this._retrieveStatus.retrieving; + const status = this.self().RETRIEVE_STATUS.retrieving; if (portId) { let data = this._getCtrlFieldChild(portId); if (data) { @@ -553,9 +552,9 @@ qx.Class.define("osparc.form.renderer.PropForm", { }, retrievedPortData: function(portId, succeed, dataSize = -1) { - let status = succeed ? this._retrieveStatus.succeed : this._retrieveStatus.failed; + let status = succeed ? this.self().RETRIEVE_STATUS.succeed : this.self().RETRIEVE_STATUS.failed; if (parseInt(dataSize) === 0) { - status = this._retrieveStatus.empty; + status = this.self().RETRIEVE_STATUS.empty; } if (portId) { let data = this._getCtrlFieldChild(portId); @@ -580,16 +579,16 @@ qx.Class.define("osparc.form.renderer.PropForm", { __setRetrievingStatus: function(status, portId, idx, row) { let icon; switch (status) { - case this._retrieveStatus.failed: + case this.self().RETRIEVE_STATUS.failed: icon = this.self().getRetrievedAtom(false); break; - case this._retrieveStatus.empty: + case this.self().RETRIEVE_STATUS.empty: icon = this.self().getRetrievedEmpty(); break; - case this._retrieveStatus.retrieving: + case this.self().RETRIEVE_STATUS.retrieving: icon = this.self().getRetrievingAtom(); break; - case this._retrieveStatus.succeed: + case this.self().RETRIEVE_STATUS.succeed: icon = this.self().getRetrievedAtom(true); break; } From 3d41aa14542c127bfc984249aac4347302a8a8ed Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 15 Oct 2024 13:20:23 +0200 Subject: [PATCH 03/12] stateOutputPorts --- .../class/osparc/desktop/StudyEditor.js | 83 +++++++++++-------- 1 file changed, 49 insertions(+), 34 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 b6b12c3faae..49fcf901436 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js @@ -419,42 +419,57 @@ qx.Class.define("osparc.desktop.StudyEditor", { const socket = osparc.wrapper.WebSocket.getInstance(); if (!socket.slotExists("stateInputPorts")) { socket.on("stateInputPorts", data => { - const studyId = data["project_id"]; - if (this.getStudy().getUuid() !== studyId) { - return; - } + this.__statePortReceived(data); + }, this); + } + if (!socket.slotExists("stateOutputPorts")) { + socket.on("stateOutputPorts", data => { + this.__statePortReceived(data); + }, this); + } + }, - const nodeId = data["node_id"]; - const workbench = this.getStudy().getWorkbench(); - const node = workbench.getNode(nodeId); - if (!node) { - if (osparc.data.Permissions.getInstance().isTester()) { - console.log("Ignored ws 'stateInputPorts' msg", data); - } - return; - } + __statePortReceived: function(socketData) { + const studyId = socketData["project_id"]; + if (this.getStudy().getUuid() !== studyId) { + return; + } - if (node.getPropForm()) { - const portId = data["port_key"]; - const portStatus = data["status"]; - switch (portStatus) { - case "DOWNLOAD_STARTED": - case "UPLOAD_STARTED": - node.getPropForm().retrievingPortData(portId); - break; - case "DOWNLOAD_FINISHED_SUCCESSFULLY": - case "UPLOAD_FINISHED_SUCCESSFULLY": - node.getPropForm().retrievedPortData(portId, true); - break; - case "DOWNLOAD_WAS_ABORTED": - case "DOWNLOAD_FINISHED_WITH_ERRROR": - case "UPLOAD_WAS_ABORTED": - case "UPLOAD_FINISHED_WITH_ERRROR": - node.getPropForm().retrievedPortData(portId, false); - break; - } - } - }, this); + const nodeId = socketData["node_id"]; + const workbench = this.getStudy().getWorkbench(); + const node = workbench.getNode(nodeId); + if (!node) { + if (osparc.data.Permissions.getInstance().isTester()) { + console.log("Ignored ws 'stateInputPorts' msg", socketData); + } + return; + } + + if (node.getPropForm()) { + const portId = socketData["port_key"]; + const status = socketData["status"]; + switch (status) { + case "DOWNLOAD_STARTED": + node.getPropForm().retrievingPortData( + portId, + osparc.form.renderer.PropForm.RETRIEVE_STATUS.downloading); + break; + case "UPLOAD_STARTED": + node.getPropForm().retrievingPortData( + portId, + osparc.form.renderer.PropForm.RETRIEVE_STATUS.uploading); + break; + case "DOWNLOAD_FINISHED_SUCCESSFULLY": + case "UPLOAD_FINISHED_SUCCESSFULLY": + node.getPropForm().retrievedPortData(portId, true); + break; + case "DOWNLOAD_WAS_ABORTED": + case "DOWNLOAD_FINISHED_WITH_ERRROR": + case "UPLOAD_WAS_ABORTED": + case "UPLOAD_FINISHED_WITH_ERRROR": + node.getPropForm().retrievedPortData(portId, false); + break; + } } }, From 5b8305a180c30e5752a2042347c073d1234c5e39 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 15 Oct 2024 13:21:11 +0200 Subject: [PATCH 04/12] more icons --- .../class/osparc/form/renderer/PropForm.js | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js index 67b02a9217d..4a7c2215632 100644 --- a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js +++ b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js @@ -56,14 +56,24 @@ qx.Class.define("osparc.form.renderer.PropForm", { return new qx.ui.basic.Atom("", "osparc/loading.gif"); }, - getRetrievedAtom: function(success) { - const icon = success ? "@FontAwesome5Solid/check/12" : "@FontAwesome5Solid/times/12"; - return new qx.ui.basic.Atom("", icon); + getDownloadingAtom: function() { + return new qx.ui.basic.Atom("", "@FontAwesome5Solid/download/12"); + }, + + getUploadingAtom: function() { + return new qx.ui.basic.Atom("", "@FontAwesome5Solid/upload/12"); + }, + + getFailedAtom: function() { + return new qx.ui.basic.Atom("", "@FontAwesome5Solid/times/12"); + }, + + getSucceededAtom: function() { + return new qx.ui.basic.Atom("", "@FontAwesome5Solid/check/12"); }, getRetrievedEmpty: function() { - const icon = "@FontAwesome5Solid/dot-circle/10"; - return new qx.ui.basic.Atom("", icon); + return new qx.ui.basic.Atom("", "@FontAwesome5Solid/dot-circle/10"); }, GRID_POS: { @@ -84,7 +94,9 @@ qx.Class.define("osparc.form.renderer.PropForm", { failed: -1, empty: 0, retrieving: 1, - succeed: 2 + downloading: 2, + uploading: 3, + succeed: 4 } }, @@ -527,8 +539,10 @@ qx.Class.define("osparc.form.renderer.PropForm", { } }, - retrievingPortData: function(portId) { - const status = this.self().RETRIEVE_STATUS.retrieving; + retrievingPortData: function(portId, status) { + if (!status) { + status = this.self().RETRIEVE_STATUS.retrieving; + } if (portId) { let data = this._getCtrlFieldChild(portId); if (data) { @@ -580,7 +594,7 @@ qx.Class.define("osparc.form.renderer.PropForm", { let icon; switch (status) { case this.self().RETRIEVE_STATUS.failed: - icon = this.self().getRetrievedAtom(false); + icon = this.self().getFailedAtom(); break; case this.self().RETRIEVE_STATUS.empty: icon = this.self().getRetrievedEmpty(); @@ -588,8 +602,14 @@ qx.Class.define("osparc.form.renderer.PropForm", { case this.self().RETRIEVE_STATUS.retrieving: icon = this.self().getRetrievingAtom(); break; + case this.self().RETRIEVE_STATUS.downloading: + icon = this.self().getDownloadingAtom(); + break; + case this.self().RETRIEVE_STATUS.uploading: + icon = this.self().getUploadingAtom(); + break; case this.self().RETRIEVE_STATUS.succeed: - icon = this.self().getRetrievedAtom(true); + icon = this.self().getSucceededAtom(); break; } icon.key = portId; From feaa28353ae86f525beb7f67c18229cd186bfa63 Mon Sep 17 00:00:00 2001 From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:51:59 +0200 Subject: [PATCH 05/12] Update StudyEditor.js --- .../client/source/class/osparc/desktop/StudyEditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 16e5e701c04..bf6102a5f6e 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js @@ -287,8 +287,8 @@ qx.Class.define("osparc.desktop.StudyEditor", { this.__listenToNodeProgress(); this.__listenToNoMoreCreditsEvents(); this.__listenToEvent(); - this.__listenToStateInputPorts(); this.__listenToServiceStatus(); + this.__listenToStateInputPorts(); }, __listenToLogger: function() { @@ -491,6 +491,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { node.getPropForm().retrievedPortData(portId, false); break; } + } }, __reloadSnapshotsAndIterations: function() { From eeeccff0dc06200dba0a6009139d42d1c4786aa6 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 15 Oct 2024 14:38:16 +0200 Subject: [PATCH 06/12] icons --- .../client/source/class/osparc/form/renderer/PropForm.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js index 4a7c2215632..b0ee6c094d5 100644 --- a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js +++ b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js @@ -57,11 +57,11 @@ qx.Class.define("osparc.form.renderer.PropForm", { }, getDownloadingAtom: function() { - return new qx.ui.basic.Atom("", "@FontAwesome5Solid/download/12"); + return new qx.ui.basic.Atom("", "@FontAwesome5Solid/cloud-download-alt/12"); }, getUploadingAtom: function() { - return new qx.ui.basic.Atom("", "@FontAwesome5Solid/upload/12"); + return new qx.ui.basic.Atom("", "@FontAwesome5Solid/cloud-upload-alt/12"); }, getFailedAtom: function() { From a26c99b1948bb3d89c9dac025ccb47fee283c8f3 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 15 Oct 2024 14:57:46 +0200 Subject: [PATCH 07/12] [skip ci] getIconForStatus --- .../class/osparc/form/renderer/PropForm.js | 47 ++++++++++--------- .../source/class/osparc/widget/NodeOutputs.js | 36 +++++++++++--- 2 files changed, 56 insertions(+), 27 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js index b0ee6c094d5..ced59696b2a 100644 --- a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js +++ b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js @@ -97,6 +97,31 @@ qx.Class.define("osparc.form.renderer.PropForm", { downloading: 2, uploading: 3, succeed: 4 + }, + + getIconForStatus: function(status) { + let icon; + switch (status) { + case this.RETRIEVE_STATUS.failed: + icon = this.getFailedAtom(); + break; + case this.RETRIEVE_STATUS.empty: + icon = this.getRetrievedEmpty(); + break; + case this.RETRIEVE_STATUS.retrieving: + icon = this.getRetrievingAtom(); + break; + case this.RETRIEVE_STATUS.downloading: + icon = this.getDownloadingAtom(); + break; + case this.RETRIEVE_STATUS.uploading: + icon = this.getUploadingAtom(); + break; + case this.RETRIEVE_STATUS.succeed: + icon = this.getSucceededAtom(); + break; + } + return icon; } }, @@ -591,27 +616,7 @@ qx.Class.define("osparc.form.renderer.PropForm", { }, __setRetrievingStatus: function(status, portId, idx, row) { - let icon; - switch (status) { - case this.self().RETRIEVE_STATUS.failed: - icon = this.self().getFailedAtom(); - break; - case this.self().RETRIEVE_STATUS.empty: - icon = this.self().getRetrievedEmpty(); - break; - case this.self().RETRIEVE_STATUS.retrieving: - icon = this.self().getRetrievingAtom(); - break; - case this.self().RETRIEVE_STATUS.downloading: - icon = this.self().getDownloadingAtom(); - break; - case this.self().RETRIEVE_STATUS.uploading: - icon = this.self().getUploadingAtom(); - break; - case this.self().RETRIEVE_STATUS.succeed: - icon = this.self().getSucceededAtom(); - break; - } + const icon = this.self().getIconForStatus(status); icon.key = portId; // remove first if any diff --git a/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js b/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js index df8c4ff6a3d..494afba228e 100644 --- a/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js +++ b/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js @@ -38,11 +38,7 @@ qx.Class.define("osparc.widget.NodeOutputs", { const grid = new qx.ui.layout.Grid(5, 5); grid.setColumnFlex(this.self().POS.LABEL, 1); - grid.setColumnFlex(this.self().POS.INFO, 0); - grid.setColumnFlex(this.self().POS.ICON, 0); grid.setColumnFlex(this.self().POS.VALUE, 1); - grid.setColumnFlex(this.self().POS.UNIT, 0); - grid.setColumnFlex(this.self().POS.PROBE, 0); grid.setColumnMinWidth(this.self().POS.VALUE, 50); Object.keys(this.self().POS).forEach((_, idx) => grid.setColumnAlign(idx, "left", "middle")); const gridLayout = this.__gridLayout = new qx.ui.container.Composite(grid); @@ -88,7 +84,8 @@ qx.Class.define("osparc.widget.NodeOutputs", { ICON: 2, VALUE: 3, UNIT: 4, - PROBE: 5 + PROBE: 5, + RETRIEVE_STATUS: 6, } }, @@ -107,7 +104,7 @@ qx.Class.define("osparc.widget.NodeOutputs", { const label = new qx.ui.basic.Label().set({ rich: true, - value: port.label + " :", + value: port.label, toolTipText: port.label }); // leave ``rich`` set to true. Ellipsis will be handled here: @@ -227,6 +224,33 @@ qx.Class.define("osparc.widget.NodeOutputs", { infoButton.setVisibility(extendedVersion ? "hidden" : "visible"); grid.setColumnMinWidth(this.self().POS.VALUE, extendedVersion ? 150 : 50); } + }, + + setRetrievingStatus: function(portId, status) { + const ports = this.getPorts(); + const portKeys = Object.keys(ports); + const idx = portKeys.findIndex(portId); + if (idx === -1) { + return; + } + + const icon = osparc.form.renderer.PropForm.getIconForStatus(status); + // remove first if any + let children = this._getChildren(); + for (let i=0; i Date: Tue, 15 Oct 2024 16:14:55 +0200 Subject: [PATCH 08/12] make NodeOutputs persistent --- .../source/class/osparc/data/model/Node.js | 16 +++++++++++++++- .../source/class/osparc/desktop/WorkbenchView.js | 7 ++++--- .../class/osparc/node/slideshow/NodeView.js | 9 ++++++--- 3 files changed, 25 insertions(+), 7 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 c54e7e1cf0e..5ca242fbe35 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 @@ -136,7 +136,8 @@ qx.Class.define("osparc.data.model.Node", { outputs: { check: "Object", nullable: false, - event: "changeOutputs" + event: "changeOutputs", + apply: "__applyOutputs", }, status: { @@ -166,6 +167,12 @@ qx.Class.define("osparc.data.model.Node", { apply: "__applyPropsForm" }, + outputsForm: { + check: "osparc.widget.NodeOutputs", + init: null, + nullable: true + }, + marker: { check: "qx.core.Object", init: null, @@ -612,6 +619,13 @@ qx.Class.define("osparc.data.model.Node", { }, this); }, + __applyOutputs: function() { + if (!this.isPropertyInitialized("outputsForm") || !this.getOutputsForm()) { + const nodeOutputs = new osparc.widget.NodeOutputs(this, this.getMetaData().outputs); + this.setOutputsForm(nodeOutputs); + } + }, + removeNodePortConnections: function(inputNodeId) { let inputs = this.__getInputData(); for (const portId in inputs) { diff --git a/services/static-webserver/client/source/class/osparc/desktop/WorkbenchView.js b/services/static-webserver/client/source/class/osparc/desktop/WorkbenchView.js index ad1c351f072..ca51e61093b 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/WorkbenchView.js +++ b/services/static-webserver/client/source/class/osparc/desktop/WorkbenchView.js @@ -1032,11 +1032,12 @@ qx.Class.define("osparc.desktop.WorkbenchView", { // OUTPUTS const outputsBox = new qx.ui.container.Composite(new qx.ui.layout.VBox(spacing)); - if (node.hasOutputs()) { - const nodeOutputs = new osparc.widget.NodeOutputs(node, node.getMetaData().outputs).set({ + const outputsForm = node.getOutputsForm(); + if (node.hasOutputs() && outputsForm) { + outputsForm.set({ offerProbes: true }); - outputsBox.add(nodeOutputs); + outputsBox.add(outputsForm); } const nodeFilesBtn = new qx.ui.form.Button(this.tr("Service data"), "@FontAwesome5Solid/folder-open/14").set({ diff --git a/services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js b/services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js index ee59c8f6370..af05dbb0e90 100644 --- a/services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js +++ b/services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js @@ -92,9 +92,12 @@ qx.Class.define("osparc.node.slideshow.NodeView", { _addOutputs: function() { this._outputsLayout.removeAll(); - const nodeOutputs = new osparc.widget.NodeOutputs(this.getNode(), this.getNode().getMetaData().outputs); - this._mainView.bind("backgroundColor", nodeOutputs, "backgroundColor"); - this._outputsLayout.add(nodeOutputs); + const node = this.getNode(); + const outputsForm = node.getOutputsForm(); + if (node.hasOutputs() && outputsForm) { + this._mainView.bind("backgroundColor", outputsForm, "backgroundColor"); + this._outputsLayout.add(outputsForm); + } this._outputsBtn.set({ value: false, From 45b07da2b7e58a05a496e7b63d3a6b944028024c Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 15 Oct 2024 16:34:47 +0200 Subject: [PATCH 09/12] [skip ci] upload icons working --- .../class/osparc/desktop/StudyEditor.js | 40 ++++++++++++++----- .../source/class/osparc/widget/NodeOutputs.js | 13 +++--- 2 files changed, 37 insertions(+), 16 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 bf6102a5f6e..91434f71170 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js @@ -466,29 +466,49 @@ qx.Class.define("osparc.desktop.StudyEditor", { return; } - if (node.getPropForm()) { + const propsForm = node.getPropsForm(); + if (propsForm) { const portId = socketData["port_key"]; const status = socketData["status"]; switch (status) { case "DOWNLOAD_STARTED": - node.getPropForm().retrievingPortData( + propsForm.retrievingPortData( portId, osparc.form.renderer.PropForm.RETRIEVE_STATUS.downloading); break; + case "DOWNLOAD_FINISHED_SUCCESSFULLY": + propsForm.retrievedPortData(portId, true); + break; + case "DOWNLOAD_WAS_ABORTED": + case "DOWNLOAD_FINISHED_WITH_ERROR": + propsForm.retrievedPortData(portId, false); + break; + } + } + + const outputsForm = node.getOutputsForm(); + if (outputsForm) { + const portId = socketData["port_key"]; + const status = socketData["status"]; + switch (status) { case "UPLOAD_STARTED": - node.getPropForm().retrievingPortData( + outputsForm.setRetrievingStatus( portId, - osparc.form.renderer.PropForm.RETRIEVE_STATUS.uploading); + osparc.form.renderer.PropForm.RETRIEVE_STATUS.uploading + ); break; - case "DOWNLOAD_FINISHED_SUCCESSFULLY": case "UPLOAD_FINISHED_SUCCESSFULLY": - node.getPropForm().retrievedPortData(portId, true); + outputsForm.setRetrievingStatus( + portId, + osparc.form.renderer.PropForm.RETRIEVE_STATUS.succeed + ); break; - case "DOWNLOAD_WAS_ABORTED": - case "DOWNLOAD_FINISHED_WITH_ERRROR": case "UPLOAD_WAS_ABORTED": - case "UPLOAD_FINISHED_WITH_ERRROR": - node.getPropForm().retrievedPortData(portId, false); + case "UPLOAD_FINISHED_WITH_ERROR": + outputsForm.setRetrievingStatus( + portId, + osparc.form.renderer.PropForm.RETRIEVE_STATUS.failed + ); break; } } diff --git a/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js b/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js index 494afba228e..137d2962f82 100644 --- a/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js +++ b/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js @@ -229,14 +229,13 @@ qx.Class.define("osparc.widget.NodeOutputs", { setRetrievingStatus: function(portId, status) { const ports = this.getPorts(); const portKeys = Object.keys(ports); - const idx = portKeys.findIndex(portId); + const idx = portKeys.indexOf(portId); if (idx === -1) { return; } - const icon = osparc.form.renderer.PropForm.getIconForStatus(status); // remove first if any - let children = this._getChildren(); + let children = this.__gridLayout.getChildren(); for (let i=0; i Date: Tue, 15 Oct 2024 17:08:15 +0200 Subject: [PATCH 10/12] Do not remove all --- .../source/class/osparc/widget/NodeOutputs.js | 75 +++++++++++-------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js b/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js index 137d2962f82..64ac0d5ee5e 100644 --- a/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js +++ b/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js @@ -40,6 +40,7 @@ qx.Class.define("osparc.widget.NodeOutputs", { grid.setColumnFlex(this.self().POS.LABEL, 1); grid.setColumnFlex(this.self().POS.VALUE, 1); grid.setColumnMinWidth(this.self().POS.VALUE, 50); + grid.setColumnMaxWidth(this.self().POS.RETRIEVE_STATUS, 25); Object.keys(this.self().POS).forEach((_, idx) => grid.setColumnAlign(idx, "left", "middle")); const gridLayout = this.__gridLayout = new qx.ui.container.Composite(grid); this._add(gridLayout); @@ -49,7 +50,7 @@ qx.Class.define("osparc.widget.NodeOutputs", { ports }); - node.addListener("changeOutputs", () => this.__populateGrid(), this); + node.addListener("changeOutputs", () => this.__outputsChanged(), this); this.addListener("appear", () => this.__makeLabelsResponsive(), this); this.addListener("resize", () => this.__makeLabelsResponsive(), this); @@ -95,7 +96,6 @@ qx.Class.define("osparc.widget.NodeOutputs", { __populateGrid: function() { this.__gridLayout.removeAll(); - const outputs = this.getNode().getOutputs(); const ports = this.getPorts(); const portKeys = Object.keys(ports); for (let i=0; i { if ("resp" in presignedLinkData && presignedLinkData.resp) { - valueLink.setUrl(presignedLinkData.resp.link); + valueWidget.setUrl(presignedLinkData.resp.link); } }); } else if ("downloadLink" in value) { // it's a link const filename = (value.filename && value.filename.length > 0) ? value.filename : osparc.file.FileDownloadLink.extractLabelFromLink(value["downloadLink"]); - valueLink.set({ + valueWidget.set({ value: filename, url: value.downloadLink }); } } else { - const valueEntry = new qx.ui.basic.Label("-"); + valueWidget = new qx.ui.basic.Label("-"); if (value) { - valueEntry.setValue(String(value)); + valueWidget.setValue(String(value)); } - this.__gridLayout.add(valueEntry, { - row: i, - column: this.self().POS.VALUE - }); } + + // remove first if any + this.__removeEntry(row, this.self().POS.VALUE); + + this.__gridLayout.add(valueWidget, { + row: row, + column: this.self().POS.VALUE + }); }, __makeLabelsResponsive: function() { @@ -226,27 +236,32 @@ qx.Class.define("osparc.widget.NodeOutputs", { } }, - setRetrievingStatus: function(portId, status) { - const ports = this.getPorts(); - const portKeys = Object.keys(ports); - const idx = portKeys.indexOf(portId); - if (idx === -1) { - return; - } - - // remove first if any + __removeEntry: function(row, column) { let children = this.__gridLayout.getChildren(); for (let i=0; i Date: Tue, 15 Oct 2024 17:25:21 +0200 Subject: [PATCH 11/12] minors --- .../client/source/class/osparc/data/model/Node.js | 2 +- .../client/source/class/osparc/desktop/StudyEditor.js | 10 +++++----- .../client/source/class/osparc/widget/NodeOutputs.js | 5 ++--- 3 files changed, 8 insertions(+), 9 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 5ca242fbe35..c04e32ab64e 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 @@ -621,7 +621,7 @@ qx.Class.define("osparc.data.model.Node", { __applyOutputs: function() { if (!this.isPropertyInitialized("outputsForm") || !this.getOutputsForm()) { - const nodeOutputs = new osparc.widget.NodeOutputs(this, this.getMetaData().outputs); + const nodeOutputs = new osparc.widget.NodeOutputs(this); this.setOutputsForm(nodeOutputs); } }, 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 91434f71170..63f8f620e0c 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js @@ -440,17 +440,17 @@ qx.Class.define("osparc.desktop.StudyEditor", { const socket = osparc.wrapper.WebSocket.getInstance(); if (!socket.slotExists("stateInputPorts")) { socket.on("stateInputPorts", data => { - this.__statePortReceived(data); + this.__statePortReceived(data, "stateInputPorts"); }, this); } if (!socket.slotExists("stateOutputPorts")) { socket.on("stateOutputPorts", data => { - this.__statePortReceived(data); + this.__statePortReceived(data, "stateOutputPorts"); }, this); } }, - __statePortReceived: function(socketData) { + __statePortReceived: function(socketData, msgName) { const studyId = socketData["project_id"]; if (this.getStudy().getUuid() !== studyId) { return; @@ -467,7 +467,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { } const propsForm = node.getPropsForm(); - if (propsForm) { + if (msgName === "stateInputPorts" && propsForm) { const portId = socketData["port_key"]; const status = socketData["status"]; switch (status) { @@ -487,7 +487,7 @@ qx.Class.define("osparc.desktop.StudyEditor", { } const outputsForm = node.getOutputsForm(); - if (outputsForm) { + if (msgName === "stateOutputPorts" && outputsForm) { const portId = socketData["port_key"]; const status = socketData["status"]; switch (status) { diff --git a/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js b/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js index 64ac0d5ee5e..071db993e30 100644 --- a/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js +++ b/services/static-webserver/client/source/class/osparc/widget/NodeOutputs.js @@ -29,9 +29,8 @@ qx.Class.define("osparc.widget.NodeOutputs", { /** * @param node {osparc.data.model.Node} Node owning the widget - * @param ports {Object} Port owning the widget */ - construct: function(node, ports) { + construct: function(node) { this.base(arguments); this._setLayout(new qx.ui.layout.VBox(15)); @@ -47,7 +46,7 @@ qx.Class.define("osparc.widget.NodeOutputs", { this.set({ node, - ports + ports: node.getMetaData().outputs }); node.addListener("changeOutputs", () => this.__outputsChanged(), this); From 9d402dda7ff8ff9a2579a26c2679707e817368c8 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Tue, 15 Oct 2024 17:41:46 +0200 Subject: [PATCH 12/12] minors --- .../client/source/class/osparc/desktop/StudyEditor.js | 3 ++- .../client/source/class/osparc/form/renderer/PropForm.js | 8 +++----- 2 files changed, 5 insertions(+), 6 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 63f8f620e0c..78ece737e9c 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js +++ b/services/static-webserver/client/source/class/osparc/desktop/StudyEditor.js @@ -474,7 +474,8 @@ qx.Class.define("osparc.desktop.StudyEditor", { case "DOWNLOAD_STARTED": propsForm.retrievingPortData( portId, - osparc.form.renderer.PropForm.RETRIEVE_STATUS.downloading); + osparc.form.renderer.PropForm.RETRIEVE_STATUS.downloading + ); break; case "DOWNLOAD_FINISHED_SUCCESSFULLY": propsForm.retrievedPortData(portId, true); diff --git a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js index ced59696b2a..ac609258130 100644 --- a/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js +++ b/services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js @@ -565,7 +565,7 @@ qx.Class.define("osparc.form.renderer.PropForm", { }, retrievingPortData: function(portId, status) { - if (!status) { + if (status === undefined) { status = this.self().RETRIEVE_STATUS.retrieving; } if (portId) { @@ -616,9 +616,6 @@ qx.Class.define("osparc.form.renderer.PropForm", { }, __setRetrievingStatus: function(status, portId, idx, row) { - const icon = this.self().getIconForStatus(status); - icon.key = portId; - // remove first if any let children = this._getChildren(); for (let i=0; i