Skip to content

Commit 3457e01

Browse files
authored
✨ [Frontend] New product: TIP lite 🚨 (#6346)
1 parent 913ff92 commit 3457e01

File tree

27 files changed

+385
-69
lines changed

27 files changed

+385
-69
lines changed

services/catalog/src/simcore_service_catalog/services/services_api.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,19 @@ async def list_services_paginated(
9797
product_name=product_name, user_id=user_id, limit=limit, offset=offset
9898
)
9999

100-
# injects access-rights
101-
access_rights: dict[
102-
tuple[str, str], list[ServiceAccessRightsAtDB]
103-
] = await repo.list_services_access_rights(
104-
((s.key, s.version) for s in services), product_name=product_name
105-
)
106-
if not access_rights:
107-
raise CatalogForbiddenError(
108-
name="any service",
109-
user_id=user_id,
110-
product_name=product_name,
100+
if services:
101+
# injects access-rights
102+
access_rights: dict[
103+
tuple[str, str], list[ServiceAccessRightsAtDB]
104+
] = await repo.list_services_access_rights(
105+
((s.key, s.version) for s in services), product_name=product_name
111106
)
107+
if not access_rights:
108+
raise CatalogForbiddenError(
109+
name="any service",
110+
user_id=user_id,
111+
product_name=product_name,
112+
)
112113

113114
# get manifest of those with access rights
114115
got = await manifest.get_batch_services(

services/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ services:
528528
- traefik.http.services.${SWARM_STACK_NAME}_static_webserver.loadbalancer.healthcheck.interval=2000ms
529529
- traefik.http.services.${SWARM_STACK_NAME}_static_webserver.loadbalancer.healthcheck.timeout=1000ms
530530
- traefik.http.middlewares.${SWARM_STACK_NAME}_static_webserver_retry.retry.attempts=2
531-
- traefik.http.routers.${SWARM_STACK_NAME}_static_webserver.rule=(Path(`/osparc`) || Path(`/s4l`) || Path(`/s4llite`) || Path(`/s4lacad`) || Path(`/s4lengine`) || Path(`/s4ldesktop`) || Path(`/s4ldesktopacad`) || Path(`/tis`) || Path(`/transpiled`) || Path(`/resource`) || PathPrefix(`/osparc/`) || PathPrefix(`/s4l/`) || PathPrefix(`/s4llite/`) || PathPrefix(`/s4lacad/`) || PathPrefix(`/s4lengine/`) || PathPrefix(`/s4ldesktop/`) || PathPrefix(`/s4ldesktopacad/`) || PathPrefix(`/tis/`) || PathPrefix(`/transpiled/`) || PathPrefix(`/resource/`))
531+
- traefik.http.routers.${SWARM_STACK_NAME}_static_webserver.rule=(Path(`/osparc`) || Path(`/s4l`) || Path(`/s4llite`) || Path(`/s4lacad`) || Path(`/s4lengine`) || Path(`/s4ldesktop`) || Path(`/s4ldesktopacad`) || Path(`/tis`) || Path(`/tiplite`) || Path(`/transpiled`) || Path(`/resource`) || PathPrefix(`/osparc/`) || PathPrefix(`/s4l/`) || PathPrefix(`/s4llite/`) || PathPrefix(`/s4lacad/`) || PathPrefix(`/s4lengine/`) || PathPrefix(`/s4ldesktop/`) || PathPrefix(`/s4ldesktopacad/`) || PathPrefix(`/tis/`) || PathPrefix(`/tiplite/`) || PathPrefix(`/transpiled/`) || PathPrefix(`/resource/`))
532532
- traefik.http.routers.${SWARM_STACK_NAME}_static_webserver.service=${SWARM_STACK_NAME}_static_webserver
533533
- traefik.http.routers.${SWARM_STACK_NAME}_static_webserver.entrypoints=http
534534
- traefik.http.routers.${SWARM_STACK_NAME}_static_webserver.priority=2

services/static-webserver/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Used for static content serving.
66

77
In the future will fully serve all static content. Currently the `webserver` is still serving the following routes:
88

9-
- `/` resolves to one of the three index.html pages inside the 4 products (osparc, tis, s4l, s4llite, s4lacad, s4lengine, s4ldesktop, s4ldesktopacad)
9+
- `/` resolves to one of the many index.html pages inside the products (osparc, tis, s4l...)
1010
- `/static-frontend-data.json` contains information required by the fronted

services/static-webserver/client/compile.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,22 @@
147147
},
148148
"addTimestampsToUrls": true,
149149
"bootPath": "source/boot"
150+
},
151+
{
152+
"class": "osparc.Application",
153+
"theme": "osparc.theme.products.tis.ThemeDark",
154+
"name": "tiplite",
155+
"title": "TI Plan lite - IT'IS",
156+
"include": [
157+
"iconfont.material.Load",
158+
"iconfont.fontawesome5.Load",
159+
"osparc.theme.products.tis.ThemeLight"
160+
],
161+
"environment": {
162+
"product.name": "tiplite"
163+
},
164+
"addTimestampsToUrls": true,
165+
"bootPath": "source/boot"
150166
}
151167
],
152168
"eslintConfig": {

services/static-webserver/client/scripts/apps_metadata.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@
5656
"replace_me_og_description": "A tool powered by o²S²PARC technology that reduces optimization of targeted neurostimulation protocols.",
5757
"replace_me_og_image": "https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/master/services/static-webserver/client/source/resource/osparc/tip_splitimage.png"
5858
}
59+
}, {
60+
"application": "tiplite",
61+
"replacements": {
62+
"replace_me_og_title": "TI Plan lite - IT'IS",
63+
"replace_me_og_description": "A tool powered by o²S²PARC technology that reduces optimization of targeted neurostimulation protocols.",
64+
"replace_me_og_image": "https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/master/services/static-webserver/client/source/resource/osparc/tip_splitimage.png"
65+
}
5966
}
6067
]
6168
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ qx.Class.define("osparc.Application", {
469469
let title = this.tr("Privacy Policy");
470470
let height = 160;
471471
if (osparc.product.Utils.showLicenseExtra()) {
472-
// "tis" and "s4llite" include the license terms
472+
// "tis", "tiplite" and "s4llite" include the license terms
473473
title = this.tr("Privacy Policy and License Terms");
474474
height = 210;
475475
}
@@ -519,6 +519,7 @@ qx.Class.define("osparc.Application", {
519519
view = new osparc.auth.LoginPageS4L();
520520
break;
521521
case "tis":
522+
case "tiplite":
522523
view = new osparc.auth.LoginPageTI();
523524
break;
524525
default: {

services/static-webserver/client/source/class/osparc/auth/ui/LoginView.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,21 @@ qx.Class.define("osparc.auth.ui.LoginView", {
121121

122122
this.add(grp);
123123

124-
if (osparc.product.Utils.isProduct("tis")) {
125-
const text = `
126-
1) The TIP tool is designed for research purposes only and is not intended for clinical use.
127-
</br>
128-
</br>
129-
2) Users are responsible for ensuring the anonymization and privacy protection of personal data.
130-
</br>
131-
</br>
132-
3) The development, maintenance and usage of the TIP tool is fully sponsored by the IT’IS Foundation, with the exception of the 61 complex 3D electromagnetic simulations on the AWS cluster required for the personalized plans.
133-
`;
124+
if (osparc.product.Utils.isProduct("tis") || osparc.product.Utils.isProduct("tiplite")) {
125+
let text = "";
126+
if (osparc.product.Utils.isProduct("tiplite")) {
127+
text = "The TIP tool is designed for research purposes only and is not intended for clinical use."
128+
} else {
129+
text = `
130+
1) The TIP tool is designed for research purposes only and is not intended for clinical use.
131+
</br>
132+
</br>
133+
2) Users are responsible for ensuring the anonymization and privacy protection of personal data.
134+
</br>
135+
</br>
136+
3) The development, maintenance and usage of the TIP tool is fully sponsored by the IT’IS Foundation, with the exception of the 61 complex 3D electromagnetic simulations on the AWS cluster required for the personalized plans.
137+
`;
138+
}
134139
const disclaimer = osparc.announcement.AnnouncementUIFactory.createLoginAnnouncement(this.tr("Disclaimer"), text);
135140
this.add(disclaimer);
136141

services/static-webserver/client/source/class/osparc/auth/ui/RequestAccount.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
6262
case "osparc":
6363
this._form.add(email, this.tr("Email"), qx.util.Validate.email(), "email");
6464
break;
65+
case "tiplite":
6566
case "s4lacad":
6667
case "s4ldesktopacad":
6768
this._form.add(email, this.tr("University Email"), qx.util.Validate.email(), "email");
@@ -80,6 +81,7 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
8081
break;
8182
case "s4lacad":
8283
case "s4ldesktopacad":
84+
case "tiplite":
8385
this._form.add(organization, this.tr("University"), null, "university");
8486
break;
8587
case "tis":
@@ -294,6 +296,7 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
294296
switch (osparc.product.Utils.getProductName()) {
295297
case "osparc":
296298
case "tis":
299+
case "tiplite":
297300
ppLink = osparc.CookiePolicy.getITISPrivacyPolicyLink("our privacy policy");
298301
break;
299302
default:

services/static-webserver/client/source/class/osparc/dashboard/NewStudies.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
qx.Class.define("osparc.dashboard.NewStudies", {
1919
extend: qx.ui.core.Widget,
2020

21-
construct: function(newStudies, groups) {
21+
construct: function(newStudiesData) {
2222
this.base(arguments);
2323

24-
this.__newStudies = newStudies;
25-
this.__groups = groups || [];
24+
const newButtonsInfo = newStudiesData.resources;
25+
this.__groups = newStudiesData.categories || [];
26+
this.__groupedContainers = [];
2627

2728
this._setLayout(new qx.ui.layout.VBox(10));
2829

@@ -35,7 +36,18 @@ qx.Class.define("osparc.dashboard.NewStudies", {
3536
});
3637
this._add(this.__flatList);
3738

38-
this.__groupedContainers = [];
39+
osparc.data.Resources.get("templates")
40+
.then(templates => {
41+
const displayTemplates = newButtonsInfo.filter(newButtonInfo => {
42+
if (newButtonInfo.showDisabled) {
43+
return true;
44+
}
45+
return templates.find(t => t.name === newButtonInfo.expectedTemplateLabel);
46+
});
47+
this.__newStudies = displayTemplates;
48+
})
49+
.catch(console.error)
50+
.finally(() => this.fireEvent("templatesLoaded"));
3951
},
4052

4153
properties: {
@@ -48,7 +60,8 @@ qx.Class.define("osparc.dashboard.NewStudies", {
4860
},
4961

5062
events: {
51-
"newStudyClicked": "qx.event.type.Data"
63+
"templatesLoaded": "qx.event.type.Event",
64+
"newStudyClicked": "qx.event.type.Data",
5265
},
5366

5467
statics: {
@@ -89,11 +102,15 @@ qx.Class.define("osparc.dashboard.NewStudies", {
89102
this._add(this.__flatList);
90103
}
91104

92-
let cards = [];
105+
const newCards = [];
93106
this.__newStudies.forEach(resourceData => {
94-
Array.prototype.push.apply(cards, this.__resourceToCards(resourceData));
107+
const cards = this.__resourceToCards(resourceData);
108+
cards.forEach(newCard => {
109+
newCard.setEnabled(!(resourceData.showDisabled));
110+
newCards.push(newCard);
111+
});
95112
});
96-
return cards;
113+
return newCards;
97114
},
98115

99116
__resourceToCards: function(resourceData) {

services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -239,21 +239,21 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
239239
this.__addStudiesToList(studies);
240240

241241
// Show Quick Start if there are no studies in the root folder of the personal workspace
242-
const quickStart = osparc.product.quickStart.Utils.getQuickStart();
243-
if (quickStart) {
244-
const dontShow = osparc.utils.Utils.localCache.getLocalStorageItem(quickStart.localStorageStr);
242+
const quickStartInfo = osparc.product.quickStart.Utils.getQuickStart();
243+
if (quickStartInfo) {
244+
const dontShow = osparc.utils.Utils.localCache.getLocalStorageItem(quickStartInfo.localStorageStr);
245245
if (dontShow === "true") {
246246
return;
247247
}
248248
const nStudies = "_meta" in resp ? resp["_meta"]["total"] : 0;
249249
if (
250250
nStudies === 0 &&
251-
this.getWorkspaceId() === null &&
251+
this.getCurrentWorkspaceId() === null &&
252252
this.getCurrentFolderId() === null
253253
) {
254-
const tutorialWindow = quickStart.tutorial();
255-
tutorialWindow.center();
256-
tutorialWindow.open();
254+
const quickStartWindow = quickStartInfo.tutorial();
255+
quickStartWindow.center();
256+
quickStartWindow.open();
257257
}
258258
}
259259
})
@@ -751,6 +751,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
751751
this.__addEmptyStudyPlusButton();
752752
break;
753753
case "tis":
754+
case "tiplite":
754755
this.__addTIPPlusButtons();
755756
break;
756757
case "s4l":
@@ -787,7 +788,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
787788
.then(newStudiesData => {
788789
const product = osparc.product.Utils.getProductName()
789790
if (product in newStudiesData) {
790-
const newButtonsInfo = newStudiesData[product].resources;
791791
const mode = this._resourcesContainer.getMode();
792792
const title = this.tr("New Plan");
793793
const desc = this.tr("Choose Plan in pop-up");
@@ -803,24 +803,24 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
803803
newStudyBtn.addListener("execute", () => {
804804
newStudyBtn.setValue(false);
805805

806-
const foundTemplates = newButtonsInfo.filter(newButtonInfo => templates.find(t => t.name === newButtonInfo.expectedTemplateLabel));
807-
const groups = newStudiesData[product].categories;
808-
const newStudies = new osparc.dashboard.NewStudies(foundTemplates, groups);
809-
newStudies.setGroupBy("category");
810-
const winTitle = this.tr("New Plan");
811-
const win = osparc.ui.window.Window.popUpInWindow(newStudies, winTitle, osparc.dashboard.NewStudies.WIDTH+40, 300).set({
812-
clickAwayClose: false,
813-
resizable: true
806+
const newStudies = new osparc.dashboard.NewStudies(newStudiesData[product]);
807+
newStudies.addListener("templatesLoaded", () => {
808+
newStudies.setGroupBy("category");
809+
const winTitle = this.tr("New Plan");
810+
const win = osparc.ui.window.Window.popUpInWindow(newStudies, winTitle, osparc.dashboard.NewStudies.WIDTH+40, 300).set({
811+
clickAwayClose: false,
812+
resizable: true
813+
});
814+
newStudies.addListener("newStudyClicked", e => {
815+
win.close();
816+
const templateInfo = e.getData();
817+
const templateData = templates.find(t => t.name === templateInfo.expectedTemplateLabel);
818+
if (templateData) {
819+
this.__newPlanBtnClicked(templateData, templateInfo.newStudyLabel);
820+
}
821+
});
822+
osparc.utils.Utils.setIdToWidget(win, "newStudiesWindow");
814823
});
815-
newStudies.addListener("newStudyClicked", e => {
816-
win.close();
817-
const templateInfo = e.getData();
818-
const templateData = templates.find(t => t.name === templateInfo.expectedTemplateLabel);
819-
if (templateData) {
820-
this.__newPlanBtnClicked(templateData, templateInfo.newStudyLabel);
821-
}
822-
});
823-
osparc.utils.Utils.setIdToWidget(win, "newStudiesWindow");
824824
});
825825
}
826826
});

0 commit comments

Comments
 (0)