diff --git a/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_user_services.py b/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_user_services.py index 64563278d4c..a6976796560 100644 --- a/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_user_services.py +++ b/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_user_services.py @@ -237,9 +237,9 @@ async def progress_create_containers( start_duration = ( scheduler_data.dynamic_sidecar.instrumentation.elapsed_since_start_request() ) - assert start_duration is not None # nosec - get_instrumentation(app).dynamic_sidecar_metrics.start_time_duration.labels( - **get_metrics_labels(scheduler_data) - ).observe(start_duration) + if start_duration is not None: + get_instrumentation(app).dynamic_sidecar_metrics.start_time_duration.labels( + **get_metrics_labels(scheduler_data) + ).observe(start_duration) _logger.info("Internal state after creating user services %s", scheduler_data) diff --git a/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py b/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py index e861ad9f30c..e3b6d024bf8 100644 --- a/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py +++ b/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py @@ -385,10 +385,10 @@ async def attempt_pod_removal_and_data_saving( stop_duration = ( scheduler_data.dynamic_sidecar.instrumentation.elapsed_since_close_request() ) - assert stop_duration is not None # nosec - get_instrumentation(app).dynamic_sidecar_metrics.stop_time_duration.labels( - **get_metrics_labels(scheduler_data) - ).observe(stop_duration) + if stop_duration is not None: + get_instrumentation(app).dynamic_sidecar_metrics.stop_time_duration.labels( + **get_metrics_labels(scheduler_data) + ).observe(stop_duration) async def attach_project_networks(app: FastAPI, scheduler_data: SchedulerData) -> None: diff --git a/services/static-webserver/client/source/class/osparc/data/model/User.js b/services/static-webserver/client/source/class/osparc/data/model/User.js index f0c8a5dabb1..fbdc80c6adf 100644 --- a/services/static-webserver/client/source/class/osparc/data/model/User.js +++ b/services/static-webserver/client/source/class/osparc/data/model/User.js @@ -39,7 +39,7 @@ qx.Class.define("osparc.data.model.User", { if (userData["login"]) { description += userData["login"]; } - const thumbnail = osparc.utils.Avatar.emailToThumbnail(userData["login"]); + const thumbnail = osparc.utils.Avatar.emailToThumbnail(userData["login"], userData["userName"]); this.set({ userId: parseInt(userData["id"]), groupId: parseInt(userData["gid"]), diff --git a/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js b/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js index 2380a9745f3..40a3e5b5918 100644 --- a/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js +++ b/services/static-webserver/client/source/class/osparc/desktop/account/MyAccount.js @@ -42,11 +42,11 @@ qx.Class.define("osparc.desktop.account.MyAccount", { }); const authData = osparc.auth.Data.getInstance(); - + const username = authData.getUsername(); const email = authData.getEmail(); const avatarSize = 80; const img = new qx.ui.basic.Image().set({ - source: osparc.utils.Avatar.getUrl(email, avatarSize), + source: osparc.utils.Avatar.emailToThumbnail(email, username, avatarSize), maxWidth: avatarSize, maxHeight: avatarSize, scale: true, diff --git a/services/static-webserver/client/source/class/osparc/info/CommentAdd.js b/services/static-webserver/client/source/class/osparc/info/CommentAdd.js index b8f36a839e6..53b26c23bad 100644 --- a/services/static-webserver/client/source/class/osparc/info/CommentAdd.js +++ b/services/static-webserver/client/source/class/osparc/info/CommentAdd.js @@ -68,9 +68,11 @@ qx.Class.define("osparc.info.CommentAdd", { maxHeight: 32, decorator: "rounded", }); - const myEmail = osparc.auth.Data.getInstance().getEmail(); + const authData = osparc.auth.Data.getInstance(); + const myUsername = authData.getUsername(); + const myEmail = authData.getEmail(); control.set({ - source: osparc.utils.Avatar.getUrl(myEmail, 32) + source: osparc.utils.Avatar.emailToThumbnail(myEmail, myUsername, 32) }); const layout = this.getChildControl("add-comment-layout"); layout.add(control, { diff --git a/services/static-webserver/client/source/class/osparc/info/CommentUI.js b/services/static-webserver/client/source/class/osparc/info/CommentUI.js index ea6df760a08..94450f804b7 100644 --- a/services/static-webserver/client/source/class/osparc/info/CommentUI.js +++ b/services/static-webserver/client/source/class/osparc/info/CommentUI.js @@ -104,7 +104,7 @@ qx.Class.define("osparc.info.CommentUI", { __buildLayout: function() { const thumbnail = this.getChildControl("thumbnail"); - thumbnail.setSource(osparc.utils.Avatar.getUrl("", 32)); + thumbnail.setSource(osparc.utils.Avatar.emailToThumbnail("", "", 32)); const userName = this.getChildControl("user-name"); userName.setValue("Unknown"); diff --git a/services/static-webserver/client/source/class/osparc/navigation/UserMenuButton.js b/services/static-webserver/client/source/class/osparc/navigation/UserMenuButton.js index e53fc4e7e1c..e1726533215 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/UserMenuButton.js +++ b/services/static-webserver/client/source/class/osparc/navigation/UserMenuButton.js @@ -51,6 +51,7 @@ qx.Class.define("osparc.navigation.UserMenuButton", { const preferencesSettings = osparc.Preferences.getInstance(); preferencesSettings.addListener("changeCreditsWarningThreshold", () => this.__updateHaloColor()); + const myUsername = authData.getUsername() || "Username"; const myEmail = authData.getEmail() || "bizzy@itis.ethz.ch"; const icon = this.getChildControl("icon"); authData.bind("role", this, "icon", { @@ -64,7 +65,7 @@ qx.Class.define("osparc.navigation.UserMenuButton", { icon.getContentElement().setStyles({ "margin-left": "-4px" }); - return osparc.utils.Avatar.getUrl(myEmail, 32); + return osparc.utils.Avatar.emailToThumbnail(myEmail, myUsername, 32); } }); }, diff --git a/services/static-webserver/client/source/class/osparc/store/Groups.js b/services/static-webserver/client/source/class/osparc/store/Groups.js index 21e2d4b2a29..e954de7aba6 100644 --- a/services/static-webserver/client/source/class/osparc/store/Groups.js +++ b/services/static-webserver/client/source/class/osparc/store/Groups.js @@ -96,7 +96,7 @@ qx.Class.define("osparc.store.Groups", { groupMe.set({ label: myAuthData.getUsername(), description: `${myAuthData.getFirstName()} ${myAuthData.getLastName()} - ${myAuthData.getEmail()}`, - thumbnail: osparc.utils.Avatar.emailToThumbnail(myAuthData.getEmail()), + thumbnail: osparc.utils.Avatar.emailToThumbnail(myAuthData.getEmail(), myAuthData.getUsername()), }) return orgs; }); diff --git a/services/static-webserver/client/source/class/osparc/store/Store.js b/services/static-webserver/client/source/class/osparc/store/Store.js index ea05e789754..e9146a1402f 100644 --- a/services/static-webserver/client/source/class/osparc/store/Store.js +++ b/services/static-webserver/client/source/class/osparc/store/Store.js @@ -222,7 +222,7 @@ qx.Class.define("osparc.store.Store", { check: "Array", init: [] }, - market: { + licensedItems: { check: "Array", init: [] }, @@ -618,7 +618,7 @@ qx.Class.define("osparc.store.Store", { __getOrgClassifiers: function(orgId, useCache = false) { const params = { url: { - "gid": orgId + "gid": parseInt(orgId) } }; return osparc.data.Resources.get("classifiers", params, useCache); @@ -640,7 +640,7 @@ qx.Class.define("osparc.store.Store", { } const classifierPromises = []; orgs.forEach(org => { - classifierPromises.push(this.__getOrgClassifiers(org["gid"], !reload)); + classifierPromises.push(this.__getOrgClassifiers(org.getGroupId(), !reload)); }); Promise.all(classifierPromises) .then(orgsClassifiersMD => { diff --git a/services/static-webserver/client/source/class/osparc/utils/Avatar.js b/services/static-webserver/client/source/class/osparc/utils/Avatar.js index a2d40081bcb..c108a661355 100644 --- a/services/static-webserver/client/source/class/osparc/utils/Avatar.js +++ b/services/static-webserver/client/source/class/osparc/utils/Avatar.js @@ -26,7 +26,7 @@ * Here is a little example of how to use the widget. * *
- *   let image = osparc.utils.Avatar.getUrl(userEmail);
+ *   let image = osparc.utils.Avatar.emailToThumbnail(userEmail);
  * 
*/ @@ -34,13 +34,14 @@ qx.Class.define("osparc.utils.Avatar", { type: "static", statics: { - emailToThumbnail: function(email) { - return this.getUrl(email, 32) + emailToThumbnail: function(email, username) { + return this.__getUrl(email, username, 32); }, - getUrl: function(email = "", size = 100, defIcon = "identicon", rating = "g") { + __getUrl: function(email, username, size = 100) { + email = email || ""; // MD5 (Message-Digest Algorithm) by WebToolkit - let MD5 = function(s) { + const MD5 = function(s) { function L(k, d) { return (k << d) | (k >>> (32 - d)); } @@ -257,8 +258,9 @@ qx.Class.define("osparc.utils.Avatar", { return i.toLowerCase(); }; - return "https://secure.gravatar.com/avatar/" + MD5(email) + "?s=" + size + "&d=" + defIcon + "&r=" + rating; - } - + const emailHash = MD5(email); + const defaultImageUrl = `https://ui-avatars.com/api/${username}/${size}`; + return `https://www.gravatar.com/avatar/${emailHash}?d=${defaultImageUrl}&s=${size}&r=g`; + }, } }); diff --git a/tests/e2e-playwright/tests/conftest.py b/tests/e2e-playwright/tests/conftest.py index 20c40c3a291..e815ff6c522 100644 --- a/tests/e2e-playwright/tests/conftest.py +++ b/tests/e2e-playwright/tests/conftest.py @@ -417,7 +417,7 @@ def log_in_and_out( def _open_with_resources(page: Page, *, click_it: bool): study_title_field = page.get_by_test_id("studyTitleField") # wait until the title is automatically filled up - expect(study_title_field).not_to_have_value("", timeout=5000) + expect(study_title_field).not_to_have_value("") open_with_resources_button = page.get_by_test_id("openWithResources") if click_it: