Skip to content

Commit 7e4059d

Browse files
committed
handleIframeStateChange
1 parent 9d227a4 commit 7e4059d

File tree

3 files changed

+18
-35
lines changed

3 files changed

+18
-35
lines changed

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -768,17 +768,7 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
768768
},
769769

770770
__iFrameStateChanged: function(node) {
771-
this.__iframePage.removeAll();
772-
773-
if (node && node.getIFrame()) {
774-
const loadingPage = node.getLoadingPage();
775-
const iFrame = node.getIFrame();
776-
const src = iFrame.getSource();
777-
const iFrameView = (src === null || src === "about:blank") ? loadingPage : iFrame;
778-
this.__iframePage.add(iFrameView, {
779-
flex: 1
780-
});
781-
}
771+
osparc.node.slideshow.NodeView.handleIframeStateChange(node, this.__iframePage);
782772
},
783773

784774
__populateSecondaryColumn: function(node) {

services/static-webserver/client/source/class/osparc/node/slideshow/NodeView.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,21 @@ qx.Class.define("osparc.node.slideshow.NodeView", {
4040
LOGGER_HEIGHT: 28,
4141
},
4242

43+
statics: {
44+
handleIframeStateChange: function(node, iframeLayout) {
45+
iframeLayout.removeAll();
46+
if (node && node.getIFrame()) {
47+
const loadingPage = node.getLoadingPage();
48+
const iFrame = node.getIFrame();
49+
const src = iFrame.getSource();
50+
const iFrameView = (src === null || src === "about:blank") ? loadingPage : iFrame;
51+
iframeLayout.add(iFrameView, {
52+
flex: 1
53+
});
54+
}
55+
},
56+
},
57+
4358
members: {
4459
__loggerPanel: null,
4560

@@ -134,18 +149,7 @@ qx.Class.define("osparc.node.slideshow.NodeView", {
134149
},
135150

136151
__iFrameStateChanged: function() {
137-
this._iFrameLayout.removeAll();
138-
139-
const node = this.getNode();
140-
if (node && node.getIFrame()) {
141-
const loadingPage = node.getLoadingPage();
142-
const iFrame = node.getIFrame();
143-
const src = iFrame.getSource();
144-
const iFrameView = (src === null || src === "about:blank") ? loadingPage : iFrame;
145-
this._iFrameLayout.add(iFrameView, {
146-
flex: 1
147-
});
148-
}
152+
osparc.node.slideshow.NodeView.handleIframeStateChange(this.getNode(), this._iFrameLayout);
149153
}
150154
}
151155
});

services/static-webserver/client/source/class/osparc/viewer/NodeViewer.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,7 @@ qx.Class.define("osparc.viewer.NodeViewer", {
8989
},
9090

9191
__iFrameStateChanged: function() {
92-
this._removeAll();
93-
94-
if (this.getNode() && this.getNode().getIframeHandler()) {
95-
const iframeHandler = this.getNode().getIframeHandler();
96-
const loadingPage = iframeHandler.getLoadingPage();
97-
const iFrame = iframeHandler.getIFrame();
98-
const src = iFrame.getSource();
99-
const iFrameView = (src === null || src === "about:blank") ? loadingPage : iFrame;
100-
this._add(iFrameView, {
101-
flex: 1
102-
});
103-
}
92+
osparc.node.slideshow.NodeView.handleIframeStateChange(this.getNode(), this);
10493
},
10594

10695
__attachSocketEventHandlers: function() {

0 commit comments

Comments
 (0)