Skip to content

Commit 7f1280d

Browse files
committed
__statusInteractiveChanged
1 parent 5a6c3ab commit 7f1280d

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

services/static-webserver/client/source/class/osparc/data/model/IframeHandler.js

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ qx.Class.define("osparc.data.model.IframeHandler", {
2323
this.setStudy(study);
2424
this.setNode(node);
2525

26+
node.getStatus().addListener("changeInteractive", e => {
27+
const newStatus = e.getData();
28+
const oldStatus = e.getData();
29+
this.__statusInteractiveChanged(newStatus, oldStatus);
30+
});
31+
2632
this.__initLoadingPage();
2733
this.__initIFrame();
2834
},
@@ -245,6 +251,7 @@ qx.Class.define("osparc.data.model.IframeHandler", {
245251
} = osparc.utils.Utils.computeServiceUrl(data);
246252
node.setDynamicV2(isDynamicV2);
247253
if (srvUrl) {
254+
status.setInteractive("connecting");
248255
this.__retriesLeft = 40;
249256
this.__waitForServiceReady(srvUrl);
250257
}
@@ -270,8 +277,6 @@ qx.Class.define("osparc.data.model.IframeHandler", {
270277
},
271278

272279
__waitForServiceReady: function(srvUrl) {
273-
this.getNode().getStatus().setInteractive("connecting");
274-
275280
if (this.__retriesLeft === 0) {
276281
return;
277282
}
@@ -318,16 +323,29 @@ qx.Class.define("osparc.data.model.IframeHandler", {
318323
const node = this.getNode();
319324
node.setServiceUrl(srvUrl);
320325
node.getStatus().setInteractive("ready");
321-
const msg = "Service ready on " + srvUrl;
322-
const msgData = {
323-
nodeId: node.getNodeId(),
324-
msg,
325-
level: "INFO"
326-
};
327-
node.fireDataEvent("showInLogger", msgData);
328-
this.__restartIFrame();
329-
if (!node.isDynamicV2()) {
330-
node.callRetrieveInputs();
326+
},
327+
328+
__statusInteractiveChanged: function(newStatus, oldStatus) {
329+
const node = this.getNode();
330+
331+
if (newStatus === "ready") {
332+
const srvUrl = node.getServiceUrl();
333+
const msg = "Service ready on " + srvUrl;
334+
const msgData = {
335+
nodeId: node.getNodeId(),
336+
msg,
337+
level: "INFO"
338+
};
339+
node.fireDataEvent("showInLogger", msgData);
340+
// will switch to iframe's content
341+
this.__restartIFrame();
342+
if (!node.isDynamicV2()) {
343+
node.callRetrieveInputs();
344+
}
345+
}
346+
if (oldStatus === "ready") {
347+
// will switch to loading page
348+
this.__restartIFrame();
331349
}
332350
},
333351

0 commit comments

Comments
 (0)