Skip to content

Commit 46d378c

Browse files
committed
listenToStateInputPorts
1 parent b25d613 commit 46d378c

File tree

1 file changed

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

1 file changed

+44
-0
lines changed

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ qx.Class.define("osparc.desktop.StudyEditor", {
287287
this.__listenToNodeProgress();
288288
this.__listenToNoMoreCreditsEvents();
289289
this.__listenToEvent();
290+
this.__listenToStateInputPorts();
290291
},
291292

292293
__listenToLogger: function() {
@@ -414,6 +415,49 @@ qx.Class.define("osparc.desktop.StudyEditor", {
414415
}
415416
},
416417

418+
__listenToStateInputPorts: function() {
419+
const socket = osparc.wrapper.WebSocket.getInstance();
420+
if (!socket.slotExists("stateInputPorts")) {
421+
socket.on("stateInputPorts", data => {
422+
const studyId = data["project_id"];
423+
if (this.getStudy().getUuid() !== studyId) {
424+
return;
425+
}
426+
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+
}
436+
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);
458+
}
459+
},
460+
417461
__reloadSnapshotsAndIterations: function() {
418462
const isVCDisabled = osparc.utils.DisabledPlugins.isVersionControlDisabled();
419463
if (!isVCDisabled) {

0 commit comments

Comments
 (0)