Skip to content

Commit f9f2148

Browse files
authored
🎨 [Frontend] Show support email in About window (#6890)
1 parent 59aeb99 commit f9f2148

File tree

8 files changed

+121
-82
lines changed

8 files changed

+121
-82
lines changed

services/static-webserver/client/source/class/osparc/CookiePolicy.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,15 @@ qx.Class.define("osparc.CookiePolicy", {
154154
control = new qx.ui.basic.Label(text).set({
155155
rich : true
156156
});
157-
osparc.store.Support.getLicenseURL()
158-
.then(licenseLink => {
159-
const lbl = control.getValue();
160-
if (licenseLink) {
161-
const color = qx.theme.manager.Color.getInstance().resolve("text");
162-
const textLink = `<a href=${licenseLink} style='color: ${color}' target='_blank'>Licensing.</a>`;
163-
control.setValue(lbl + textLink);
164-
} else {
165-
control.setValue(lbl + this.tr("Licensing."));
166-
}
167-
});
157+
const licenseLink = osparc.store.Support.getLicenseURL();
158+
const lbl = control.getValue();
159+
if (licenseLink) {
160+
const color = qx.theme.manager.Color.getInstance().resolve("text");
161+
const textLink = `<a href=${licenseLink} style='color: ${color}' target='_blank'>Licensing.</a>`;
162+
control.setValue(lbl + textLink);
163+
} else {
164+
control.setValue(lbl + this.tr("Licensing."));
165+
}
168166
this._add(control, {
169167
column: 0,
170168
row: 2

services/static-webserver/client/source/class/osparc/navigation/UserMenu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ qx.Class.define("osparc.navigation.UserMenu", {
127127
case "license":
128128
control = new qx.ui.menu.Button(this.tr("License"));
129129
osparc.utils.Utils.setIdToWidget(control, "userMenuLicenseBtn");
130-
osparc.store.Support.getLicenseURL()
131-
.then(licenseURL => control.addListener("execute", () => window.open(licenseURL)));
130+
const licenseURL = osparc.store.Support.getLicenseURL();
131+
control.addListener("execute", () => window.open(licenseURL));
132132
this.add(control);
133133
break;
134134
case "tip-lite-button":
@@ -257,7 +257,7 @@ qx.Class.define("osparc.navigation.UserMenu", {
257257
}
258258

259259
this.getChildControl("about");
260-
if (!osparc.product.Utils.isProduct("osparc")) {
260+
if (osparc.product.Utils.showAboutProduct()) {
261261
this.getChildControl("about-product");
262262
}
263263
this.getChildControl("license");

services/static-webserver/client/source/class/osparc/product/AboutProduct.js

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ qx.Class.define("osparc.product.AboutProduct", {
5757
case "s4llite":
5858
this.__buildS4LLiteLayout();
5959
break;
60+
case "tis":
61+
case "tiplite":
62+
this.__buildTIPLayout();
63+
break;
6064
default: {
6165
const noInfoText = this.tr("Information not available");
6266
const noInfoLabel = osparc.product.quickStart.Utils.createLabel(noInfoText);
@@ -67,43 +71,43 @@ qx.Class.define("osparc.product.AboutProduct", {
6771
},
6872

6973
__buildS4LLayout: function() {
70-
osparc.store.Support.getLicenseURL()
71-
.then(licenseUrl => {
72-
const text = this.tr(`
73-
sim4life.io is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \
74-
The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \
75-
It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology.
76-
<br><br>
77-
sim4life.io makes use of technologies developed by our research partner for the o<sup>2</sup>S<sup>2</sup>PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\
78-
<br><br>
79-
For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "https://sim4life.swiss/")}.
80-
<br><br>
81-
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
82-
`);
83-
84-
const label = osparc.product.quickStart.Utils.createLabel(text);
85-
this.add(label);
86-
});
74+
const licenseUrl = osparc.store.Support.getLicenseURL();
75+
const text = this.tr(`
76+
sim4life.io is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \
77+
The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \
78+
It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology.
79+
<br><br>
80+
sim4life.io makes use of technologies developed by our research partner for the o<sup>2</sup>S<sup>2</sup>PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\
81+
<br><br>
82+
For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "https://sim4life.swiss/")}.
83+
<br><br>
84+
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
85+
<br><br>
86+
Send us an email ${this.__getMailTo()}
87+
`);
88+
89+
const label = osparc.product.quickStart.Utils.createLabel(text);
90+
this.add(label);
8791
},
8892

8993
__buildS4LAcademicLayout: function() {
90-
osparc.store.Support.getLicenseURL()
91-
.then(licenseUrl => {
92-
const text = this.tr(`
93-
sim4life.science is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \
94-
The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \
95-
It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology.
96-
<br><br>
97-
sim4life.science makes use of technologies developed by our research partner for the o<sup>2</sup>S<sup>2</sup>PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\
98-
<br><br>
99-
For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "href='https://sim4life.swiss/")}.
100-
<br><br>
101-
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
102-
`);
103-
104-
const label = osparc.product.quickStart.Utils.createLabel(text);
105-
this.add(label);
106-
});
94+
const licenseUrl = osparc.store.Support.getLicenseURL();
95+
const text = this.tr(`
96+
sim4life.science is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \
97+
The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \
98+
It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology.
99+
<br><br>
100+
sim4life.science makes use of technologies developed by our research partner for the o<sup>2</sup>S<sup>2</sup>PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\
101+
<br><br>
102+
For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "href='https://sim4life.swiss/")}.
103+
<br><br>
104+
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
105+
<br><br>
106+
Send us an email ${this.__getMailTo()}
107+
`);
108+
109+
const label = osparc.product.quickStart.Utils.createLabel(text);
110+
this.add(label);
107111
},
108112

109113
__buildS4LLiteLayout: function() {
@@ -117,10 +121,13 @@ qx.Class.define("osparc.product.AboutProduct", {
117121
const moreInfoUrl = "https://zmt.swiss/";
118122
const moreInfoText = `For more information about Sim4Life.lite, visit ${osparc.utils.Utils.createHTMLLink("our website", moreInfoUrl)}.`;
119123

124+
const emailText = `Send us an email ${this.__getMailTo()}`;
125+
120126
[
121127
introText,
122128
licenseText,
123-
moreInfoText
129+
moreInfoText,
130+
emailText,
124131
].forEach(text => {
125132
const label = osparc.product.quickStart.Utils.createLabel(text);
126133
this.add(label);
@@ -129,6 +136,35 @@ qx.Class.define("osparc.product.AboutProduct", {
129136
this.__addCopyright();
130137
},
131138

139+
__buildTIPLayout: function() {
140+
const licenseUrl = osparc.store.Support.getLicenseURL();
141+
const text = this.tr(`
142+
TIP (TI Planning Tool) is an innovative online platform designed to optimize targeted neurostimulation protocols using \
143+
temporal interference (TI) stimulation. Developed by IT'IS Foundation, TIP simplifies the complex process of planning deep \
144+
brain stimulation.
145+
<br><br>
146+
Powered by o<sup>2</sup>S<sup>2</sup>PARC technology, TIP utilizes sophisticated electromagnetic simulations, detailed anatomical head models, \
147+
and automated optimization to generate comprehensive reports with quantitative and visual information. This tool is \
148+
invaluable for neuroscientists and brain stimulation experts, especially those with limited computational modeling experience, \
149+
enabling them to create effective and safe stimulation protocols for their research. \
150+
<br><br>
151+
For more information about TIP, please visit ${osparc.utils.Utils.createHTMLLink("itis.swiss", "https://itis.swiss/tools-and-systems/ti-planning/overview")}.
152+
<br><br>
153+
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
154+
<br><br>
155+
Send us an email ${this.__getMailTo()}
156+
`);
157+
158+
const label = osparc.product.quickStart.Utils.createLabel(text);
159+
this.add(label);
160+
},
161+
162+
__getMailTo: function() {
163+
const supportEmail = osparc.store.VendorInfo.getInstance().getSupportEmail();
164+
const productName = osparc.store.StaticInfo.getInstance().getDisplayName();
165+
return osparc.store.Support.mailToText(supportEmail, "Support " + productName, false);
166+
},
167+
132168
__addCopyright: function() {
133169
const copyrightLink = new osparc.ui.basic.LinkLabel().set({
134170
font: "link-label-14"
@@ -141,6 +177,6 @@ qx.Class.define("osparc.product.AboutProduct", {
141177
});
142178
}
143179
this.add(copyrightLink);
144-
}
180+
},
145181
}
146182
});

services/static-webserver/client/source/class/osparc/product/Utils.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,12 @@ qx.Class.define("osparc.product.Utils", {
225225
},
226226

227227
showAboutProduct: function() {
228-
return (this.isS4LProduct() || this.isProduct("s4llite"));
228+
return (
229+
this.isS4LProduct() ||
230+
this.isProduct("s4llite") ||
231+
this.isProduct("tis") ||
232+
this.isProduct("tiplite")
233+
);
229234
},
230235

231236
showPreferencesTokens: function() {

services/static-webserver/client/source/class/osparc/product/quickStart/s4l/Welcome.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ qx.Class.define("osparc.product.quickStart.s4l.Welcome", {
125125
textAlign: "center",
126126
rich : true
127127
});
128-
osparc.store.Support.getLicenseURL()
129-
.then(licenseUrl => {
130-
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
131-
licenseLink.setValue(link);
132-
licenseLink.show();
133-
});
128+
const licenseUrl = osparc.store.Support.getLicenseURL();
129+
if (licenseUrl) {
130+
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
131+
licenseLink.setValue(link);
132+
licenseLink.show();
133+
}
134134
footerItems.push(licenseLink);
135135

136136
const dontShowCB = osparc.product.quickStart.Utils.createDontShowAgain("s4lDontShowQuickStart");

services/static-webserver/client/source/class/osparc/product/quickStart/s4lacad/Welcome.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ qx.Class.define("osparc.product.quickStart.s4lacad.Welcome", {
125125
textAlign: "center",
126126
rich : true
127127
});
128-
osparc.store.Support.getLicenseURL()
129-
.then(licenseUrl => {
130-
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
131-
licenseLink.setValue(link);
132-
licenseLink.show();
133-
});
128+
const licenseUrl = osparc.store.Support.getLicenseURL();
129+
if (licenseUrl) {
130+
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
131+
licenseLink.setValue(link);
132+
licenseLink.show();
133+
}
134134
footerItems.push(licenseLink);
135135

136136
const dontShowCB = osparc.product.quickStart.Utils.createDontShowAgain("s4lDontShowQuickStart");

services/static-webserver/client/source/class/osparc/product/quickStart/s4llite/Slides.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ qx.Class.define("osparc.product.quickStart.s4llite.Slides", {
5353
textAlign: "center",
5454
rich : true
5555
});
56-
osparc.store.Support.getLicenseURL()
57-
.then(licenseUrl => {
58-
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
59-
licenseLink.setValue(link);
60-
licenseLink.show();
61-
});
56+
const licenseUrl = osparc.store.Support.getLicenseURL();
57+
if (licenseUrl) {
58+
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
59+
licenseLink.setValue(link);
60+
licenseLink.show();
61+
}
6262
footerItems.push(licenseLink);
6363

6464
const dontShowCB = osparc.product.quickStart.Utils.createDontShowAgain("s4lliteDontShowQuickStart");

services/static-webserver/client/source/class/osparc/store/Support.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ qx.Class.define("osparc.store.Support", {
44

55
statics: {
66
getLicenseURL: function() {
7-
return new Promise(resolve => {
8-
const vendor = osparc.store.VendorInfo.getInstance().getVendor();
9-
if (vendor) {
10-
if ("license_url" in vendor) {
11-
resolve(vendor["license_url"]);
12-
} else if ("url" in vendor) {
13-
resolve(vendor["url"]);
14-
} else {
15-
resolve("");
16-
}
7+
const vendor = osparc.store.VendorInfo.getInstance().getVendor();
8+
if (vendor) {
9+
if ("license_url" in vendor) {
10+
return vendor["license_url"];
11+
} else if ("url" in vendor) {
12+
return vendor["url"];
1713
}
18-
});
14+
}
15+
return "";
1916
},
2017

2118
getManuals: function() {
@@ -135,9 +132,12 @@ qx.Class.define("osparc.store.Support", {
135132
});
136133
},
137134

138-
mailToText: function(email, subject) {
135+
mailToText: function(email, subject, centered = true) {
139136
const color = qx.theme.manager.Color.getInstance().resolve("text");
140-
const textLink = `<center><a href="mailto:${email}?subject=${subject}" style='color: ${color}' target='_blank'>${email}</a>&nbsp&nbsp<center>`;
137+
let textLink = `<a href="mailto:${email}?subject=${subject}" style='color: ${color}' target='_blank'>${email}</a>&nbsp&nbsp`;
138+
if (centered) {
139+
textLink = `<center>${textLink}</center>`
140+
}
141141
return textLink;
142142
},
143143

0 commit comments

Comments
 (0)