Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1033,11 +1033,13 @@ qx.Class.define("osparc.utils.Utils", {
// Function that creates a unique tabId even for duplicated tabs
getClientSessionID: function() {
const getUniqueSessionId = () => {
const uuid = osparc.utils.Utils.uuidV4();
// before creating a new one, check if the websocket has it set
const webSocket = osparc.wrapper.WebSocket.getInstance().getSocket();
const clientSessionId = webSocket ? webSocket.io.engine.opts.query["client_session_id"] : osparc.utils.Utils.uuidV4();
// Set window.name. This property is persistent on window reloads, but it doesn't get copied in a duplicated tab
window.name = uuid;
sessionStorage.setItem("clientsessionid", uuid);
return uuid;
window.name = clientSessionId;
sessionStorage.setItem("clientsessionid", clientSessionId);
return clientSessionId;
};

let uniqueSessionId = sessionStorage.getItem("clientsessionid");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ qx.Class.define("osparc.viewer.NodeViewer", {
__attachSocketEventHandlers: function() {
this.__listenToNodeUpdated();
this.__listenToNodeProgress();
this.__listenToServiceStatus();
},

__listenToNodeUpdated: function() {
Expand All @@ -127,6 +128,26 @@ qx.Class.define("osparc.viewer.NodeViewer", {
this.getStudy().nodeNodeProgressSequence(data);
}, this);
}
},

__listenToServiceStatus: function() {
const socket = osparc.wrapper.WebSocket.getInstance();

// callback for events
if (!socket.slotExists("serviceStatus")) {
socket.on("serviceStatus", data => {
const nodeId = data["service_uuid"];
const workbench = this.getStudy().getWorkbench();
const node = workbench.getNode(nodeId);
if (node) {
if (node.getIframeHandler()) {
node.getIframeHandler().onNodeState(data);
}
} else if (osparc.data.Permissions.getInstance().isTester()) {
console.log("Ignored ws 'progress' msg", data);
}
}, this);
}
}
}
});
Loading