From f9f2148daf4a9a78a6c4cdc639d3fa781b6f4d28 Mon Sep 17 00:00:00 2001 From: Odei Maiz <33152403+odeimaiz@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:59:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20[Frontend]=20Show=20support=20em?= =?UTF-8?q?ail=20in=20About=20window=20(#6890)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/class/osparc/CookiePolicy.js | 20 ++-- .../class/osparc/navigation/UserMenu.js | 6 +- .../class/osparc/product/AboutProduct.js | 108 ++++++++++++------ .../source/class/osparc/product/Utils.js | 7 +- .../osparc/product/quickStart/s4l/Welcome.js | 12 +- .../product/quickStart/s4lacad/Welcome.js | 12 +- .../product/quickStart/s4llite/Slides.js | 12 +- .../source/class/osparc/store/Support.js | 26 ++--- 8 files changed, 121 insertions(+), 82 deletions(-) diff --git a/services/static-webserver/client/source/class/osparc/CookiePolicy.js b/services/static-webserver/client/source/class/osparc/CookiePolicy.js index 7a0327c09f6..378ff902da4 100644 --- a/services/static-webserver/client/source/class/osparc/CookiePolicy.js +++ b/services/static-webserver/client/source/class/osparc/CookiePolicy.js @@ -154,17 +154,15 @@ qx.Class.define("osparc.CookiePolicy", { control = new qx.ui.basic.Label(text).set({ rich : true }); - osparc.store.Support.getLicenseURL() - .then(licenseLink => { - const lbl = control.getValue(); - if (licenseLink) { - const color = qx.theme.manager.Color.getInstance().resolve("text"); - const textLink = `Licensing.`; - control.setValue(lbl + textLink); - } else { - control.setValue(lbl + this.tr("Licensing.")); - } - }); + const licenseLink = osparc.store.Support.getLicenseURL(); + const lbl = control.getValue(); + if (licenseLink) { + const color = qx.theme.manager.Color.getInstance().resolve("text"); + const textLink = `Licensing.`; + control.setValue(lbl + textLink); + } else { + control.setValue(lbl + this.tr("Licensing.")); + } this._add(control, { column: 0, row: 2 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 dc029edbba9..be4a1c8f4a8 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js +++ b/services/static-webserver/client/source/class/osparc/navigation/UserMenu.js @@ -127,8 +127,8 @@ qx.Class.define("osparc.navigation.UserMenu", { case "license": control = new qx.ui.menu.Button(this.tr("License")); osparc.utils.Utils.setIdToWidget(control, "userMenuLicenseBtn"); - osparc.store.Support.getLicenseURL() - .then(licenseURL => control.addListener("execute", () => window.open(licenseURL))); + const licenseURL = osparc.store.Support.getLicenseURL(); + control.addListener("execute", () => window.open(licenseURL)); this.add(control); break; case "tip-lite-button": @@ -257,7 +257,7 @@ qx.Class.define("osparc.navigation.UserMenu", { } this.getChildControl("about"); - if (!osparc.product.Utils.isProduct("osparc")) { + if (osparc.product.Utils.showAboutProduct()) { this.getChildControl("about-product"); } this.getChildControl("license"); diff --git a/services/static-webserver/client/source/class/osparc/product/AboutProduct.js b/services/static-webserver/client/source/class/osparc/product/AboutProduct.js index 97e18eeadfd..c0760d01082 100644 --- a/services/static-webserver/client/source/class/osparc/product/AboutProduct.js +++ b/services/static-webserver/client/source/class/osparc/product/AboutProduct.js @@ -57,6 +57,10 @@ qx.Class.define("osparc.product.AboutProduct", { case "s4llite": this.__buildS4LLiteLayout(); break; + case "tis": + case "tiplite": + this.__buildTIPLayout(); + break; default: { const noInfoText = this.tr("Information not available"); const noInfoLabel = osparc.product.quickStart.Utils.createLabel(noInfoText); @@ -67,43 +71,43 @@ qx.Class.define("osparc.product.AboutProduct", { }, __buildS4LLayout: function() { - osparc.store.Support.getLicenseURL() - .then(licenseUrl => { - const text = this.tr(` - sim4life.io is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \ - The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \ - It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology. -

- sim4life.io makes use of technologies developed by our research partner for the o2S2PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\ -

- For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "https://sim4life.swiss/")}. -

- To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}. - `); - - const label = osparc.product.quickStart.Utils.createLabel(text); - this.add(label); - }); + const licenseUrl = osparc.store.Support.getLicenseURL(); + const text = this.tr(` + sim4life.io is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \ + The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \ + It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology. +

+ sim4life.io makes use of technologies developed by our research partner for the o2S2PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\ +

+ For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "https://sim4life.swiss/")}. +

+ To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}. +

+ Send us an email ${this.__getMailTo()} + `); + + const label = osparc.product.quickStart.Utils.createLabel(text); + this.add(label); }, __buildS4LAcademicLayout: function() { - osparc.store.Support.getLicenseURL() - .then(licenseUrl => { - const text = this.tr(` - sim4life.science is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \ - The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \ - It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology. -

- sim4life.science makes use of technologies developed by our research partner for the o2S2PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\ -

- For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "href='https://sim4life.swiss/")}. -

- To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}. - `); - - const label = osparc.product.quickStart.Utils.createLabel(text); - this.add(label); - }); + const licenseUrl = osparc.store.Support.getLicenseURL(); + const text = this.tr(` + sim4life.science is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \ + The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \ + It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology. +

+ sim4life.science makes use of technologies developed by our research partner for the o2S2PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\ +

+ For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "href='https://sim4life.swiss/")}. +

+ To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}. +

+ Send us an email ${this.__getMailTo()} + `); + + const label = osparc.product.quickStart.Utils.createLabel(text); + this.add(label); }, __buildS4LLiteLayout: function() { @@ -117,10 +121,13 @@ qx.Class.define("osparc.product.AboutProduct", { const moreInfoUrl = "https://zmt.swiss/"; const moreInfoText = `For more information about Sim4Life.lite, visit ${osparc.utils.Utils.createHTMLLink("our website", moreInfoUrl)}.`; + const emailText = `Send us an email ${this.__getMailTo()}`; + [ introText, licenseText, - moreInfoText + moreInfoText, + emailText, ].forEach(text => { const label = osparc.product.quickStart.Utils.createLabel(text); this.add(label); @@ -129,6 +136,35 @@ qx.Class.define("osparc.product.AboutProduct", { this.__addCopyright(); }, + __buildTIPLayout: function() { + const licenseUrl = osparc.store.Support.getLicenseURL(); + const text = this.tr(` + TIP (TI Planning Tool) is an innovative online platform designed to optimize targeted neurostimulation protocols using \ + temporal interference (TI) stimulation. Developed by IT'IS Foundation, TIP simplifies the complex process of planning deep \ + brain stimulation. +

+ Powered by o2S2PARC technology, TIP utilizes sophisticated electromagnetic simulations, detailed anatomical head models, \ + and automated optimization to generate comprehensive reports with quantitative and visual information. This tool is \ + invaluable for neuroscientists and brain stimulation experts, especially those with limited computational modeling experience, \ + enabling them to create effective and safe stimulation protocols for their research. \ +

+ For more information about TIP, please visit ${osparc.utils.Utils.createHTMLLink("itis.swiss", "https://itis.swiss/tools-and-systems/ti-planning/overview")}. +

+ To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}. +

+ Send us an email ${this.__getMailTo()} + `); + + const label = osparc.product.quickStart.Utils.createLabel(text); + this.add(label); + }, + + __getMailTo: function() { + const supportEmail = osparc.store.VendorInfo.getInstance().getSupportEmail(); + const productName = osparc.store.StaticInfo.getInstance().getDisplayName(); + return osparc.store.Support.mailToText(supportEmail, "Support " + productName, false); + }, + __addCopyright: function() { const copyrightLink = new osparc.ui.basic.LinkLabel().set({ font: "link-label-14" @@ -141,6 +177,6 @@ qx.Class.define("osparc.product.AboutProduct", { }); } this.add(copyrightLink); - } + }, } }); diff --git a/services/static-webserver/client/source/class/osparc/product/Utils.js b/services/static-webserver/client/source/class/osparc/product/Utils.js index 45d3b7de661..4535f1ca8b6 100644 --- a/services/static-webserver/client/source/class/osparc/product/Utils.js +++ b/services/static-webserver/client/source/class/osparc/product/Utils.js @@ -225,7 +225,12 @@ qx.Class.define("osparc.product.Utils", { }, showAboutProduct: function() { - return (this.isS4LProduct() || this.isProduct("s4llite")); + return ( + this.isS4LProduct() || + this.isProduct("s4llite") || + this.isProduct("tis") || + this.isProduct("tiplite") + ); }, showPreferencesTokens: function() { diff --git a/services/static-webserver/client/source/class/osparc/product/quickStart/s4l/Welcome.js b/services/static-webserver/client/source/class/osparc/product/quickStart/s4l/Welcome.js index bec6916504e..518416f1373 100644 --- a/services/static-webserver/client/source/class/osparc/product/quickStart/s4l/Welcome.js +++ b/services/static-webserver/client/source/class/osparc/product/quickStart/s4l/Welcome.js @@ -125,12 +125,12 @@ qx.Class.define("osparc.product.quickStart.s4l.Welcome", { textAlign: "center", rich : true }); - osparc.store.Support.getLicenseURL() - .then(licenseUrl => { - const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl); - licenseLink.setValue(link); - licenseLink.show(); - }); + const licenseUrl = osparc.store.Support.getLicenseURL(); + if (licenseUrl) { + const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl); + licenseLink.setValue(link); + licenseLink.show(); + } footerItems.push(licenseLink); const dontShowCB = osparc.product.quickStart.Utils.createDontShowAgain("s4lDontShowQuickStart"); diff --git a/services/static-webserver/client/source/class/osparc/product/quickStart/s4lacad/Welcome.js b/services/static-webserver/client/source/class/osparc/product/quickStart/s4lacad/Welcome.js index ed8a78dbdb6..c81b9813d51 100644 --- a/services/static-webserver/client/source/class/osparc/product/quickStart/s4lacad/Welcome.js +++ b/services/static-webserver/client/source/class/osparc/product/quickStart/s4lacad/Welcome.js @@ -125,12 +125,12 @@ qx.Class.define("osparc.product.quickStart.s4lacad.Welcome", { textAlign: "center", rich : true }); - osparc.store.Support.getLicenseURL() - .then(licenseUrl => { - const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl); - licenseLink.setValue(link); - licenseLink.show(); - }); + const licenseUrl = osparc.store.Support.getLicenseURL(); + if (licenseUrl) { + const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl); + licenseLink.setValue(link); + licenseLink.show(); + } footerItems.push(licenseLink); const dontShowCB = osparc.product.quickStart.Utils.createDontShowAgain("s4lDontShowQuickStart"); diff --git a/services/static-webserver/client/source/class/osparc/product/quickStart/s4llite/Slides.js b/services/static-webserver/client/source/class/osparc/product/quickStart/s4llite/Slides.js index 3d3bcf6e048..d7726632407 100644 --- a/services/static-webserver/client/source/class/osparc/product/quickStart/s4llite/Slides.js +++ b/services/static-webserver/client/source/class/osparc/product/quickStart/s4llite/Slides.js @@ -53,12 +53,12 @@ qx.Class.define("osparc.product.quickStart.s4llite.Slides", { textAlign: "center", rich : true }); - osparc.store.Support.getLicenseURL() - .then(licenseUrl => { - const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl); - licenseLink.setValue(link); - licenseLink.show(); - }); + const licenseUrl = osparc.store.Support.getLicenseURL(); + if (licenseUrl) { + const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl); + licenseLink.setValue(link); + licenseLink.show(); + } footerItems.push(licenseLink); const dontShowCB = osparc.product.quickStart.Utils.createDontShowAgain("s4lliteDontShowQuickStart"); diff --git a/services/static-webserver/client/source/class/osparc/store/Support.js b/services/static-webserver/client/source/class/osparc/store/Support.js index e79de4d1a27..1352ef2eac9 100644 --- a/services/static-webserver/client/source/class/osparc/store/Support.js +++ b/services/static-webserver/client/source/class/osparc/store/Support.js @@ -4,18 +4,15 @@ qx.Class.define("osparc.store.Support", { statics: { getLicenseURL: function() { - return new Promise(resolve => { - const vendor = osparc.store.VendorInfo.getInstance().getVendor(); - if (vendor) { - if ("license_url" in vendor) { - resolve(vendor["license_url"]); - } else if ("url" in vendor) { - resolve(vendor["url"]); - } else { - resolve(""); - } + const vendor = osparc.store.VendorInfo.getInstance().getVendor(); + if (vendor) { + if ("license_url" in vendor) { + return vendor["license_url"]; + } else if ("url" in vendor) { + return vendor["url"]; } - }); + } + return ""; }, getManuals: function() { @@ -135,9 +132,12 @@ qx.Class.define("osparc.store.Support", { }); }, - mailToText: function(email, subject) { + mailToText: function(email, subject, centered = true) { const color = qx.theme.manager.Color.getInstance().resolve("text"); - const textLink = `
${email}  
`; + let textLink = `${email}  `; + if (centered) { + textLink = `
${textLink}
` + } return textLink; },