From 6c40c8a537ec8e1d89da72f6de5352b767c40b57 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 11:56:54 +0100 Subject: [PATCH 01/10] refactor --- .../announcement/AnnouncementUIFactory.js | 31 +++++++++++++------ .../class/osparc/announcement/Tracker.js | 28 +++-------------- 2 files changed, 26 insertions(+), 33 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js index 8f126387642..9c6e6ee0524 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js +++ b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js @@ -63,14 +63,9 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { } return loginAnnouncement; - } - }, - - members: { - __ribbonAnnouncement: null, + }, - __isValid: function(widgetType) { - const announcement = this.getAnnouncement(); + isValid: function(announcement, widgetType) { if (announcement) { const now = new Date(); const validPeriod = now > announcement.getStart() && now < announcement.getEnd(); @@ -80,6 +75,19 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { } return false; }, + }, + + members: { + __announcements: null, + __ribbonAnnouncement: null, + + setAnnouncementsData: function(announcementsData) { + this.__announcements = []; + announcementsData.forEach(announcementData => { + const announcement = new osparc.announcement.Announcement(announcementData); + this.__announcements.push(announcement); + }); + }, __applyAnnouncement: function() { if (this.__ribbonAnnouncement) { @@ -92,15 +100,18 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { }, hasLoginAnnouncement: function() { - return this.__isValid("login"); + const announcement = this.getAnnouncement(); + return this.self().isValid(announcement, "login"); }, __hasRibbonAnnouncement: function() { - return this.__isValid("ribbon"); + const announcement = this.getAnnouncement(); + return this.self().isValid(announcement, "ribbon"); }, hasUserMenuAnnouncement: function() { - return this.__isValid("user-menu") && this.getAnnouncement().getLink(); + const announcement = this.getAnnouncement(); + return this.self().isValid(announcement, "user-menu") && announcement.getLink(); }, createLoginAnnouncement: function() { diff --git a/services/static-webserver/client/source/class/osparc/announcement/Tracker.js b/services/static-webserver/client/source/class/osparc/announcement/Tracker.js index da6a8f17e38..ebd9c137179 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/Tracker.js +++ b/services/static-webserver/client/source/class/osparc/announcement/Tracker.js @@ -25,21 +25,13 @@ qx.Class.define("osparc.announcement.Tracker", { members: { __checkInterval: null, - __announcements: null, checkAnnouncements: async function() { - return new Promise(resolve => { - osparc.data.Resources.get("announcements") - .then(announcements => { - if (announcements && announcements.length) { - this.__setAnnouncements(announcements); - } else { - this.__setAnnouncements(null); - } - resolve(); - }) - .catch(err => console.error(err)); - }); + osparc.data.Resources.get("announcements") + .then(announcements => { + osparc.announcement.AnnouncementUIFactory.getInstance().setAnnouncements((announcements && announcements.length) ? announcements : []); + }) + .catch(err => console.error(err)); }, startTracker: function() { @@ -52,15 +44,5 @@ qx.Class.define("osparc.announcement.Tracker", { clearInterval(this.__checkInterval); } }, - - __setAnnouncements: function(announcementsData) { - this.__announcements = {}; - if (announcementsData) { - announcementsData.forEach(announcementData => { - const announcement = new osparc.announcement.Announcement(announcementData); - osparc.announcement.AnnouncementUIFactory.getInstance().setAnnouncement(announcement); - }); - } - } } }); From d7dda43732d8c8600241f09b9630e9e88a47d2ba Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 13:26:34 +0100 Subject: [PATCH 02/10] setAnnouncementsData --- .../announcement/AnnouncementUIFactory.js | 23 +++++++++++-------- .../class/osparc/announcement/Tracker.js | 2 +- .../source/class/osparc/auth/ui/LoginView.js | 4 ++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js index 9c6e6ee0524..c7080406707 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js +++ b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js @@ -100,24 +100,27 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { }, hasLoginAnnouncement: function() { - const announcement = this.getAnnouncement(); - return this.self().isValid(announcement, "login"); + return this.__announcements && this.__announcements.some(announcement => this.self().isValid(announcement, "login")); }, __hasRibbonAnnouncement: function() { - const announcement = this.getAnnouncement(); - return this.self().isValid(announcement, "ribbon"); + return this.__announcements && this.__announcements.some(announcement => this.self().isValid(announcement, "ribbon")); }, hasUserMenuAnnouncement: function() { - const announcement = this.getAnnouncement(); - return this.self().isValid(announcement, "user-menu") && announcement.getLink(); + return this.__announcements && this.__announcements.some(announcement => this.self().isValid(announcement, "ribbon") && announcement.getLink()); }, - createLoginAnnouncement: function() { - const announcement = this.getAnnouncement(); - const loginAnnouncement = this.self().createLoginAnnouncement(announcement.getTitle(), announcement.getDescription()); - return loginAnnouncement; + createLoginAnnouncements: function() { + const loginAnnouncements = []; + this.__announcements.forEach(announcement => { + if (this.self().isValid(announcement, "login")) { + loginAnnouncements.push(this.self().createLoginAnnouncement(announcement.getTitle(), announcement.getDescription())); + } + }); + const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); + loginAnnouncements.forEach(loginAnnouncement => layout.add(loginAnnouncement)); + return layout; }, __addRibbonAnnouncement: function() { diff --git a/services/static-webserver/client/source/class/osparc/announcement/Tracker.js b/services/static-webserver/client/source/class/osparc/announcement/Tracker.js index ebd9c137179..368fbd6dd00 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/Tracker.js +++ b/services/static-webserver/client/source/class/osparc/announcement/Tracker.js @@ -29,7 +29,7 @@ qx.Class.define("osparc.announcement.Tracker", { checkAnnouncements: async function() { osparc.data.Resources.get("announcements") .then(announcements => { - osparc.announcement.AnnouncementUIFactory.getInstance().setAnnouncements((announcements && announcements.length) ? announcements : []); + osparc.announcement.AnnouncementUIFactory.getInstance().setAnnouncementsData((announcements && announcements.length) ? announcements : []); }) .catch(err => console.error(err)); }, diff --git a/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js b/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js index d52f03e4784..ce01c4829db 100644 --- a/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js +++ b/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js @@ -42,11 +42,11 @@ qx.Class.define("osparc.auth.ui.LoginView", { _buildPage: function() { const announcementUIFactory = osparc.announcement.AnnouncementUIFactory.getInstance(); if (announcementUIFactory.hasLoginAnnouncement()) { - this.addAt(announcementUIFactory.createLoginAnnouncement(), 0); + this.addAt(announcementUIFactory.createLoginAnnouncements(), 0); } else { announcementUIFactory.addListenerOnce("changeAnnouncement", e => { if (announcementUIFactory.hasLoginAnnouncement()) { - this.addAt(announcementUIFactory.createLoginAnnouncement(), 0); + this.addAt(announcementUIFactory.createLoginAnnouncements(), 0); } }); } From a69e0b5da2c80a410ae220fd06181f42942f0591 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 13:45:48 +0100 Subject: [PATCH 03/10] createUserMenuAnnouncements --- .../announcement/AnnouncementUIFactory.js | 18 +++++++++++------- .../source/class/osparc/navigation/UserMenu.js | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js index c7080406707..afd03da868d 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js +++ b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js @@ -140,13 +140,17 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { osparc.notification.RibbonNotifications.getInstance().addNotification(ribbonAnnouncement); }, - createUserMenuAnnouncement: function() { - const announcement = this.getAnnouncement(); - - const link = announcement.getLink(); - const userMenuAnnouncement = new qx.ui.menu.Button(announcement.getTitle() + "..."); - userMenuAnnouncement.addListener("execute", () => window.open(link)); - return userMenuAnnouncement; + createUserMenuAnnouncements: function() { + const userMenuAnnouncements = []; + this.__announcements.forEach(announcement => { + if (this.self().isValid(announcement, "user-menu")) { + const link = announcement.getLink(); + const userMenuAnnouncement = new qx.ui.menu.Button(announcement.getTitle() + "..."); + userMenuAnnouncement.addListener("execute", () => window.open(link)); + userMenuAnnouncements.push(userMenuAnnouncement); + } + }); + return userMenuAnnouncements; } } }); diff --git a/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js b/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js index b18f0a4d7b3..fbf3061c6e3 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js +++ b/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js @@ -171,7 +171,7 @@ qx.Class.define("osparc.navigation.UserMenu", { const announcementUIFactory = osparc.announcement.AnnouncementUIFactory.getInstance(); if (announcementUIFactory.hasUserMenuAnnouncement()) { - this.add(announcementUIFactory.createUserMenuAnnouncement()); + announcementUIFactory.createUserMenuAnnouncements().forEach(announcement => this.add(announcement)); } this.getChildControl("about"); if (osparc.product.Utils.showAboutProduct()) { @@ -227,7 +227,7 @@ qx.Class.define("osparc.navigation.UserMenu", { const announcementUIFactory = osparc.announcement.AnnouncementUIFactory.getInstance(); if (announcementUIFactory.hasUserMenuAnnouncement()) { - this.add(announcementUIFactory.createUserMenuAnnouncement()); + announcementUIFactory.createUserMenuAnnouncements().forEach(announcement => this.add(announcement)); } this.getChildControl("about"); if (!osparc.product.Utils.isProduct("osparc")) { From 624247e41a7296e0a9f2fcfc813b328a7226f026 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 13:46:24 +0100 Subject: [PATCH 04/10] __loginAnnouncements --- .../osparc/announcement/AnnouncementUIFactory.js | 11 +++-------- .../source/class/osparc/auth/ui/LoginView.js | 16 +++++++++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js index afd03da868d..f641ff24cfc 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js +++ b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js @@ -19,14 +19,8 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { extend: qx.core.Object, type: "singleton", - properties: { - announcement: { - check: "osparc.announcement.Announcement", - init: null, - nullable: false, - event: "changeAnnouncement", - apply: "__applyAnnouncement" - } + events: { + "changeAnnouncements": "qx.event.type.Event", }, statics: { @@ -87,6 +81,7 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { const announcement = new osparc.announcement.Announcement(announcementData); this.__announcements.push(announcement); }); + this.fireEvent("changeAnnouncements"); }, __applyAnnouncement: function() { diff --git a/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js b/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js index ce01c4829db..d05e9ddeb63 100644 --- a/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js +++ b/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js @@ -37,17 +37,23 @@ qx.Class.define("osparc.auth.ui.LoginView", { members: { __loginBtn: null, + __loginAnnouncements: null, // overrides base _buildPage: function() { const announcementUIFactory = osparc.announcement.AnnouncementUIFactory.getInstance(); + const showAnnouncement = () => { + if (this.__loginAnnouncements) { + this.remove(this.__loginAnnouncements); + } + this.__loginAnnouncements = announcementUIFactory.createLoginAnnouncements(); + this.addAt(this.__loginAnnouncements, 0); + }; if (announcementUIFactory.hasLoginAnnouncement()) { - this.addAt(announcementUIFactory.createLoginAnnouncements(), 0); + showAnnouncement(); } else { - announcementUIFactory.addListenerOnce("changeAnnouncement", e => { - if (announcementUIFactory.hasLoginAnnouncement()) { - this.addAt(announcementUIFactory.createLoginAnnouncements(), 0); - } + announcementUIFactory.addListenerOnce("changeAnnouncements", () => { + showAnnouncement(); }); } From d0e200346091567b16663a604212fdeddec96cd4 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 13:57:52 +0100 Subject: [PATCH 05/10] slide-bar of login announcements --- .../announcement/AnnouncementUIFactory.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js index f641ff24cfc..9cde8285710 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js +++ b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js @@ -110,12 +110,22 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { const loginAnnouncements = []; this.__announcements.forEach(announcement => { if (this.self().isValid(announcement, "login")) { - loginAnnouncements.push(this.self().createLoginAnnouncement(announcement.getTitle(), announcement.getDescription())); + const loginAnnouncement = this.self().createLoginAnnouncement(announcement.getTitle(), announcement.getDescription()) + loginAnnouncement.setWidth(osparc.auth.core.BaseAuthPage.FORM_WIDTH-5); // show 1-2 pixel of the nearby announcement + loginAnnouncements.push(loginAnnouncement); } }); - const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(10)); - loginAnnouncements.forEach(loginAnnouncement => layout.add(loginAnnouncement)); - return layout; + const slideBar = new osparc.widget.SlideBar().set({ + allowGrowX: true, + }); + slideBar.getChildControl("button-backward").set({ + backgroundColor: "transparent" + }); + slideBar.getChildControl("button-forward").set({ + backgroundColor: "transparent" + }); + loginAnnouncements.forEach(loginAnnouncement => slideBar.add(loginAnnouncement)); + return slideBar; }, __addRibbonAnnouncement: function() { From 86280d35a20102171a743ff11533e83913283038 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 14:02:53 +0100 Subject: [PATCH 06/10] minor --- .../source/class/osparc/announcement/AnnouncementUIFactory.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js index 9cde8285710..1ef3fbaa5f7 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js +++ b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js @@ -115,6 +115,9 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { loginAnnouncements.push(loginAnnouncement); } }); + if (loginAnnouncements.length === 1) { + return loginAnnouncements[0]; + } const slideBar = new osparc.widget.SlideBar().set({ allowGrowX: true, }); From 9056344a062eb05fa08a0e396a95025b6ab46610 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 14:14:59 +0100 Subject: [PATCH 07/10] minor --- .../client/source/class/osparc/auth/ui/LoginView.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js b/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js index d05e9ddeb63..56972d7eb6f 100644 --- a/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js +++ b/services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js @@ -42,7 +42,7 @@ qx.Class.define("osparc.auth.ui.LoginView", { // overrides base _buildPage: function() { const announcementUIFactory = osparc.announcement.AnnouncementUIFactory.getInstance(); - const showAnnouncement = () => { + const addAnnouncements = () => { if (this.__loginAnnouncements) { this.remove(this.__loginAnnouncements); } @@ -50,11 +50,9 @@ qx.Class.define("osparc.auth.ui.LoginView", { this.addAt(this.__loginAnnouncements, 0); }; if (announcementUIFactory.hasLoginAnnouncement()) { - showAnnouncement(); + addAnnouncements(); } else { - announcementUIFactory.addListenerOnce("changeAnnouncements", () => { - showAnnouncement(); - }); + announcementUIFactory.addListenerOnce("changeAnnouncements", () => addAnnouncements()); } // form From f2c66932383415ccff671eae5696747c57a19809 Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 14:17:24 +0100 Subject: [PATCH 08/10] __addAnnouncements --- .../source/class/osparc/navigation/UserMenu.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js b/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js index fbf3061c6e3..bac3af85122 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js +++ b/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js @@ -169,10 +169,7 @@ qx.Class.define("osparc.navigation.UserMenu", { this.getChildControl("theme-switcher"); this.addSeparator(); - const announcementUIFactory = osparc.announcement.AnnouncementUIFactory.getInstance(); - if (announcementUIFactory.hasUserMenuAnnouncement()) { - announcementUIFactory.createUserMenuAnnouncements().forEach(announcement => this.add(announcement)); - } + this.__addAnnouncements(); this.getChildControl("about"); if (osparc.product.Utils.showAboutProduct()) { this.getChildControl("about-product"); @@ -188,6 +185,13 @@ qx.Class.define("osparc.navigation.UserMenu", { osparc.utils.Utils.prettifyMenu(this); }, + __addAnnouncements: function() { + const announcementUIFactory = osparc.announcement.AnnouncementUIFactory.getInstance(); + if (announcementUIFactory.hasUserMenuAnnouncement()) { + announcementUIFactory.createUserMenuAnnouncements().forEach(announcement => this.add(announcement)); + } + }, + populateMenuCompact: function() { this.removeAll(); const authData = osparc.auth.Data.getInstance(); @@ -225,10 +229,7 @@ qx.Class.define("osparc.navigation.UserMenu", { this.getChildControl("theme-switcher"); this.addSeparator(); - const announcementUIFactory = osparc.announcement.AnnouncementUIFactory.getInstance(); - if (announcementUIFactory.hasUserMenuAnnouncement()) { - announcementUIFactory.createUserMenuAnnouncements().forEach(announcement => this.add(announcement)); - } + this.__addAnnouncements(); this.getChildControl("about"); if (!osparc.product.Utils.isProduct("osparc")) { this.getChildControl("about-product"); From 24b8e0ad691b0826b233a807df6e6ea8133be1bc Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 14:25:25 +0100 Subject: [PATCH 09/10] __addToRibbon --- .../announcement/AnnouncementUIFactory.js | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js index 1ef3fbaa5f7..ae19185bcab 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js +++ b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js @@ -82,26 +82,31 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { this.__announcements.push(announcement); }); this.fireEvent("changeAnnouncements"); + + this.__addToRibbon(); }, - __applyAnnouncement: function() { - if (this.__ribbonAnnouncement) { - osparc.notification.RibbonNotifications.getInstance().removeNotification(this.__ribbonAnnouncement); - this.__ribbonAnnouncement = null; - } - if (this.__hasRibbonAnnouncement()) { - this.__addRibbonAnnouncement(); + __addToRibbon: function() { + if (this.__ribbonAnnouncements && this.__ribbonAnnouncements.length) { + this.__ribbonAnnouncements.forEach(ribbonAnnouncement => { + osparc.notification.RibbonNotifications.getInstance().removeNotification(ribbonAnnouncement); + }); } + this.__ribbonAnnouncements = []; + this.__announcements.forEach(announcement => { + if (this.self().isValid(announcement, "ribbon")) { + const ribbonAnnouncement = this.__addRibbonAnnouncement(announcement); + if (ribbonAnnouncement) { + this.__ribbonAnnouncements.push(ribbonAnnouncement); + } + } + }); }, hasLoginAnnouncement: function() { return this.__announcements && this.__announcements.some(announcement => this.self().isValid(announcement, "login")); }, - __hasRibbonAnnouncement: function() { - return this.__announcements && this.__announcements.some(announcement => this.self().isValid(announcement, "ribbon")); - }, - hasUserMenuAnnouncement: function() { return this.__announcements && this.__announcements.some(announcement => this.self().isValid(announcement, "ribbon") && announcement.getLink()); }, @@ -131,21 +136,25 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { return slideBar; }, - __addRibbonAnnouncement: function() { - const announcement = this.getAnnouncement(); - + __addRibbonAnnouncement: function(announcement) { if (osparc.utils.Utils.localCache.isDontShowAnnouncement(announcement.getId())) { - return; + return null; } - let text = announcement.getTitle(); + let text = ""; + if (announcement.getTitle()) { + text += announcement.getTitle(); + } + if (announcement.getTitle() && announcement.getDescription()) { + text += ": "; + } if (announcement.getDescription()) { - text += ": " + announcement.getDescription(); + text += announcement.getDescription(); } - - const ribbonAnnouncement = this.__ribbonAnnouncement = new osparc.notification.RibbonNotification(text, "announcement", true); + const ribbonAnnouncement = new osparc.notification.RibbonNotification(text, "announcement", true); ribbonAnnouncement.announcementId = announcement.getId(); osparc.notification.RibbonNotifications.getInstance().addNotification(ribbonAnnouncement); + return ribbonAnnouncement; }, createUserMenuAnnouncements: function() { From ba8d1a0da9ed5f8b335f5ea0f0d6866a9fcb179d Mon Sep 17 00:00:00 2001 From: Odei Maiz Date: Fri, 15 Nov 2024 14:29:46 +0100 Subject: [PATCH 10/10] minor --- .../source/class/osparc/announcement/AnnouncementUIFactory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js index ae19185bcab..6533fc0444a 100644 --- a/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js +++ b/services/static-webserver/client/source/class/osparc/announcement/AnnouncementUIFactory.js @@ -73,7 +73,7 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", { members: { __announcements: null, - __ribbonAnnouncement: null, + __ribbonAnnouncements: null, setAnnouncementsData: function(announcementsData) { this.__announcements = [];