Skip to content

Commit 3d41aa1

Browse files
committed
stateOutputPorts
1 parent cab91a0 commit 3d41aa1

File tree

1 file changed

+49
-34
lines changed
  • services/static-webserver/client/source/class/osparc/desktop

1 file changed

+49
-34
lines changed

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

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -419,42 +419,57 @@ qx.Class.define("osparc.desktop.StudyEditor", {
419419
const socket = osparc.wrapper.WebSocket.getInstance();
420420
if (!socket.slotExists("stateInputPorts")) {
421421
socket.on("stateInputPorts", data => {
422-
const studyId = data["project_id"];
423-
if (this.getStudy().getUuid() !== studyId) {
424-
return;
425-
}
422+
this.__statePortReceived(data);
423+
}, this);
424+
}
425+
if (!socket.slotExists("stateOutputPorts")) {
426+
socket.on("stateOutputPorts", data => {
427+
this.__statePortReceived(data);
428+
}, this);
429+
}
430+
},
426431

427-
const nodeId = data["node_id"];
428-
const workbench = this.getStudy().getWorkbench();
429-
const node = workbench.getNode(nodeId);
430-
if (!node) {
431-
if (osparc.data.Permissions.getInstance().isTester()) {
432-
console.log("Ignored ws 'stateInputPorts' msg", data);
433-
}
434-
return;
435-
}
432+
__statePortReceived: function(socketData) {
433+
const studyId = socketData["project_id"];
434+
if (this.getStudy().getUuid() !== studyId) {
435+
return;
436+
}
436437

437-
if (node.getPropForm()) {
438-
const portId = data["port_key"];
439-
const portStatus = data["status"];
440-
switch (portStatus) {
441-
case "DOWNLOAD_STARTED":
442-
case "UPLOAD_STARTED":
443-
node.getPropForm().retrievingPortData(portId);
444-
break;
445-
case "DOWNLOAD_FINISHED_SUCCESSFULLY":
446-
case "UPLOAD_FINISHED_SUCCESSFULLY":
447-
node.getPropForm().retrievedPortData(portId, true);
448-
break;
449-
case "DOWNLOAD_WAS_ABORTED":
450-
case "DOWNLOAD_FINISHED_WITH_ERRROR":
451-
case "UPLOAD_WAS_ABORTED":
452-
case "UPLOAD_FINISHED_WITH_ERRROR":
453-
node.getPropForm().retrievedPortData(portId, false);
454-
break;
455-
}
456-
}
457-
}, this);
438+
const nodeId = socketData["node_id"];
439+
const workbench = this.getStudy().getWorkbench();
440+
const node = workbench.getNode(nodeId);
441+
if (!node) {
442+
if (osparc.data.Permissions.getInstance().isTester()) {
443+
console.log("Ignored ws 'stateInputPorts' msg", socketData);
444+
}
445+
return;
446+
}
447+
448+
if (node.getPropForm()) {
449+
const portId = socketData["port_key"];
450+
const status = socketData["status"];
451+
switch (status) {
452+
case "DOWNLOAD_STARTED":
453+
node.getPropForm().retrievingPortData(
454+
portId,
455+
osparc.form.renderer.PropForm.RETRIEVE_STATUS.downloading);
456+
break;
457+
case "UPLOAD_STARTED":
458+
node.getPropForm().retrievingPortData(
459+
portId,
460+
osparc.form.renderer.PropForm.RETRIEVE_STATUS.uploading);
461+
break;
462+
case "DOWNLOAD_FINISHED_SUCCESSFULLY":
463+
case "UPLOAD_FINISHED_SUCCESSFULLY":
464+
node.getPropForm().retrievedPortData(portId, true);
465+
break;
466+
case "DOWNLOAD_WAS_ABORTED":
467+
case "DOWNLOAD_FINISHED_WITH_ERRROR":
468+
case "UPLOAD_WAS_ABORTED":
469+
case "UPLOAD_FINISHED_WITH_ERRROR":
470+
node.getPropForm().retrievedPortData(portId, false);
471+
break;
472+
}
458473
}
459474
},
460475

0 commit comments

Comments
 (0)