Skip to content

Commit 6b3a943

Browse files
authored
Merge branch 'master' into pr-osparc-extend-rclone-options
2 parents 1d51f68 + 7b5cba8 commit 6b3a943

File tree

4 files changed

+70
-25
lines changed

4 files changed

+70
-25
lines changed

packages/service-library/src/servicelib/redis.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from redis.backoff import ExponentialBackoff
1818
from settings_library.redis import RedisDatabase, RedisSettings
1919
from tenacity import retry
20+
from yarl import URL
2021

2122
from .background_task import periodic_task
2223
from .logging_utils import log_catch, log_context
@@ -94,7 +95,8 @@ def __post_init__(self):
9495
async def setup(self) -> None:
9596
if not await self.ping():
9697
await self.shutdown()
97-
raise CouldNotConnectToRedisError(dsn=self.redis_dsn)
98+
url_safe: URL = URL(self.redis_dsn).with_password("???")
99+
raise CouldNotConnectToRedisError(dsn=f"{url_safe}")
98100

99101
self._health_check_task = asyncio.create_task(
100102
self._check_health(),

services/dynamic-sidecar/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ RUN chmod +x services/dynamic-sidecar/docker/*.sh
187187
HEALTHCHECK \
188188
--interval=10s \
189189
--timeout=5s \
190-
--start-period=30s \
190+
--start-period=180s \
191191
--start-interval=1s \
192192
--retries=5 \
193193
CMD ["python3", "services/dynamic-sidecar/docker/healthcheck.py", "http://localhost:8000/health"]

services/dynamic-sidecar/docker/entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ fi
9393
# Change ownership of volumes mount directory
9494
# directories are empty at this point
9595
# each individual subdirectory is a unique volume
96-
chown --verbose --recursive "$SC_USER_NAME":"$GROUPNAME" "${DYNAMIC_SIDECAR_DY_VOLUMES_MOUNT_DIR}"
96+
chown --recursive "$SC_USER_NAME":"$GROUPNAME" "${DYNAMIC_SIDECAR_DY_VOLUMES_MOUNT_DIR}"
9797
# Allow owner and group to edit write and execute
9898
# files from all the subdirectories
9999
# When the service access files downloaded by the dynamic-sidecar
100100
# it uses group permissions
101-
chmod --verbose --recursive 774 "${DYNAMIC_SIDECAR_DY_VOLUMES_MOUNT_DIR}"
101+
chmod --recursive 774 "${DYNAMIC_SIDECAR_DY_VOLUMES_MOUNT_DIR}"
102102

103103
echo "$INFO Starting $* ..."
104104
echo " $SC_USER_NAME rights : $(id "$SC_USER_NAME")"

services/static-webserver/client/source/class/osparc/widget/PersistentIframe.js

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,7 @@ qx.Class.define("osparc.widget.PersistentIframe", {
2727
construct: function(source, el) {
2828
this.base(arguments, source);
2929

30-
this.themeSwitchHandler = msg => {
31-
this.postThemeSwitch(msg.getData());
32-
};
33-
34-
this.postThemeSwitch = theme => {
35-
const iframe = this._getIframeElement();
36-
if (this._getIframeElement()) {
37-
const iframeDomEl = iframe.getDomElement();
38-
const iframeSource = iframe.getSource();
39-
if (iframeDomEl && iframeSource) {
40-
const msg = "osparc;theme=" + theme;
41-
try {
42-
iframeDomEl.contentWindow.postMessage(msg, iframeSource);
43-
} catch (err) {
44-
console.log(`Failed posting message ${msg} to iframe ${iframeSource}\n${err.message}`);
45-
}
46-
}
47-
}
48-
};
49-
50-
qx.event.message.Bus.getInstance().subscribe("themeSwitch", this.themeSwitchHandler);
30+
this.__attachInterframeMessageHandlers();
5131
},
5232

5333
statics: {
@@ -265,6 +245,69 @@ qx.Class.define("osparc.widget.PersistentIframe", {
265245
this.__iframe.setSource(newValue);
266246
},
267247

248+
__attachInterframeMessageHandlers: function() {
249+
this.__attachTriggerers();
250+
this.__attachListeners();
251+
},
252+
253+
__attachTriggerers: function() {
254+
this.postThemeSwitch = theme => {
255+
const iframe = this._getIframeElement();
256+
if (iframe) {
257+
const iframeDomEl = iframe.getDomElement();
258+
const iframeSource = iframe.getSource();
259+
if (iframeDomEl && iframeSource) {
260+
const msg = "osparc;theme=" + theme;
261+
try {
262+
iframeDomEl.contentWindow.postMessage(msg, iframeSource);
263+
} catch (err) {
264+
console.log(`Failed posting message ${msg} to iframe ${iframeSource}\n${err.message}`);
265+
}
266+
}
267+
}
268+
};
269+
270+
this.themeSwitchHandler = msg => {
271+
this.postThemeSwitch(msg.getData());
272+
};
273+
qx.event.message.Bus.getInstance().subscribe("themeSwitch", this.themeSwitchHandler);
274+
},
275+
276+
__attachListeners: function() {
277+
this.__iframe.addListener("load", () => {
278+
const iframe = this._getIframeElement();
279+
if (iframe) {
280+
const iframeDomEl = iframe.getDomElement();
281+
if (iframeDomEl) {
282+
window.addEventListener("message", message => {
283+
const data = message.data;
284+
if (data) {
285+
this.__handleIframeMessage(data);
286+
}
287+
});
288+
}
289+
}
290+
}, this);
291+
},
292+
293+
__handleIframeMessage: function(data) {
294+
if (data["type"] && data["message"]) {
295+
if (data["type"] === "theme") {
296+
// switch theme driven by the iframe
297+
const message = data["message"];
298+
if (message.includes("osparc;theme=")) {
299+
const themeName = message.replace("osparc;theme=", "");
300+
const validThemes = osparc.ui.switch.ThemeSwitcher.getValidThemes();
301+
const themeFound = validThemes.find(theme => theme.basename === themeName);
302+
const themeManager = qx.theme.manager.Meta.getInstance();
303+
if (themeFound !== themeManager.getTheme()) {
304+
themeManager.setTheme(themeFound);
305+
}
306+
}
307+
}
308+
}
309+
},
310+
268311
// override
269312
_getIframeElement: function() {
270313
return this.__iframe._getIframeElement(); // eslint-disable-line no-underscore-dangle

0 commit comments

Comments
 (0)