Skip to content

Commit f6a95e9

Browse files
authored
🎨 [Frontend] TIP: Update Texts and Quick Start visuals (#6112)
1 parent ee178bb commit f6a95e9

File tree

27 files changed

+269
-141
lines changed

27 files changed

+269
-141
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,15 @@ qx.Class.define("osparc.Application", {
7979
// to provide our own message here
8080
window.addEventListener("beforeunload", e => {
8181
const downloadLinkTracker = osparc.DownloadLinkTracker.getInstance();
82-
// The downloadLinkTracker uses an external link for downloading files.
83-
// When it starts (click), triggers an unload event. This condition avoids the false positive
84-
if (!downloadLinkTracker.isDownloading() && webSocket.isConnected()) {
82+
if (
83+
// The downloadLinkTracker uses an external link for downloading files.
84+
// When it starts (click), triggers an unload event. This condition avoids the false positive
85+
!downloadLinkTracker.isDownloading() &&
86+
// allow reloading in login page
87+
webSocket.isConnected() &&
88+
// allow reloading in dashboard
89+
osparc.store.Store.getInstance().getCurrentStudy()
90+
) {
8591
// Cancel the event as stated by the standard.
8692
e.preventDefault();
8793
// Chrome requires returnValue to be set.

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,13 @@ qx.Class.define("osparc.auth.ui.LoginView", {
125125

126126
if (osparc.product.Utils.isProduct("tis")) {
127127
const text = `
128-
1) The TIP tool is designed exclusively for research purposes and it is not intended for clinical use.
128+
1) The TIP tool is designed for research purposes only and is not intended for clinical use.
129129
</br>
130130
</br>
131-
2) Users are responsible for ensuring the anonymization and protection of privacy of medical data.
131+
2) Users are responsible for ensuring the anonymization and privacy protection of personal data.
132+
</br>
133+
</br>
134+
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.
132135
`;
133136
const disclaimer = osparc.announcement.AnnouncementUIFactory.createLoginAnnouncement(this.tr("Disclaimer"), text);
134137
this.add(disclaimer);

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ qx.Class.define("osparc.dashboard.GridButtonNew", {
3636
appearance: "pb-new"
3737
});
3838

39-
this._buildLayout();
40-
4139
if (title) {
4240
const titleLabel = this.getChildControl("title");
4341
titleLabel.set({
@@ -51,22 +49,12 @@ qx.Class.define("osparc.dashboard.GridButtonNew", {
5149
descLabel.setValue(description.toString());
5250
}
5351

52+
this.setIcon(osparc.dashboard.CardBase.NEW_ICON);
53+
5454
this.getChildControl("footer").exclude();
5555
},
5656

5757
members: {
58-
_buildLayout: function() {
59-
const title = this.getChildControl("title");
60-
title.setValue(this.tr("Empty") + " " + osparc.product.Utils.getStudyAlias({
61-
firstUpperCase: true
62-
}));
63-
64-
const desc = this.getChildControl("subtitle-text");
65-
desc.setValue(this.tr("Start with an empty study").toString());
66-
67-
this.setIcon(osparc.dashboard.CardBase.NEW_ICON);
68-
},
69-
7058
_onToggleChange: function(e) {
7159
this.setValue(false);
7260
},

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ qx.Class.define("osparc.dashboard.GroupedToggleButtonContainer", {
9797
maxWidth: 32,
9898
maxHeight: 32
9999
});
100+
control.getChildControl("label").set({
101+
rich: true,
102+
wrap: true
103+
})
100104
control.getContentElement().setStyles({
101105
"border-top-left-radius": "4px",
102106
"border-top-right-radius": "4px"

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

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,23 @@ qx.Class.define("osparc.dashboard.ListButtonNew", {
3333
appearance: "pb-new"
3434
});
3535

36-
this._buildLayout();
37-
3836
if (title) {
3937
const titleLabel = this.getChildControl("title");
40-
titleLabel.setValue(title);
38+
titleLabel.set({
39+
value: title,
40+
rich: true
41+
});
4142
}
4243

4344
if (description) {
4445
const descLabel = this.getChildControl("description");
45-
descLabel.setValue(description.toString());
46+
descLabel.setValue(description);
4647
}
48+
49+
this.setIcon(osparc.dashboard.CardBase.NEW_ICON);
4750
},
4851

4952
members: {
50-
_buildLayout: function() {
51-
const title = this.getChildControl("title");
52-
title.setValue(this.tr("Empty") + " " + osparc.product.Utils.getStudyAlias({
53-
firstUpperCase: true
54-
}));
55-
56-
const desc = this.getChildControl("description");
57-
desc.setValue(this.tr("Start with an empty study").toString());
58-
59-
this.setIcon(osparc.dashboard.CardBase.NEW_ICON);
60-
},
61-
6253
_onToggleChange: function(e) {
6354
this.setValue(false);
6455
},

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ qx.Class.define("osparc.dashboard.NewStudies", {
5151
"newStudyClicked": "qx.event.type.Data"
5252
},
5353

54+
statics: {
55+
WIDTH: 600
56+
},
57+
5458
members: {
5559
__newStudies: null,
5660
__groups: null,
@@ -126,7 +130,10 @@ qx.Class.define("osparc.dashboard.NewStudies", {
126130
});
127131
osparc.utils.Utils.setIdToWidget(groupContainer, groupId.toString() + "Group");
128132
const atom = groupContainer.getChildControl("header");
129-
atom.setFont("text-16");
133+
atom.set({
134+
font: "text-16",
135+
maxWidth: this.self().WIDTH
136+
});
130137
this.__groupedContainers.push(groupContainer);
131138
return groupContainer;
132139
},

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
464464

465465
__addEmptyStudyPlusButton: function() {
466466
const mode = this._resourcesContainer.getMode();
467-
const newStudyBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew() : new osparc.dashboard.ListButtonNew();
467+
const title = this.tr("Empty") + " " + osparc.product.Utils.getStudyAlias({
468+
firstUpperCase: true
469+
})
470+
const desc = this.tr("Start with an empty study");
471+
const newStudyBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title, desc) : new osparc.dashboard.ListButtonNew(title, desc);
468472
newStudyBtn.setCardKey("new-study");
469473
newStudyBtn.subscribeToFilterGroup("searchBarFilter");
470474
osparc.utils.Utils.setIdToWidget(newStudyBtn, "newStudyBtn");
@@ -477,7 +481,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
477481
},
478482

479483
__addTIPPlusButtons: function() {
480-
const mode = this._resourcesContainer.getMode();
481484
osparc.data.Resources.get("templates")
482485
.then(templates => {
483486
if (templates) {
@@ -486,6 +489,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
486489
const product = osparc.product.Utils.getProductName()
487490
if (product in newStudiesData) {
488491
const newButtonsInfo = newStudiesData[product].resources;
492+
const mode = this._resourcesContainer.getMode();
489493
const title = this.tr("New Plan");
490494
const desc = this.tr("Choose Plan in pop-up");
491495
const newStudyBtn = (mode === "grid") ? new osparc.dashboard.GridButtonNew(title, desc) : new osparc.dashboard.ListButtonNew(title, desc);
@@ -505,7 +509,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
505509
const newStudies = new osparc.dashboard.NewStudies(foundTemplates, groups);
506510
newStudies.setGroupBy("category");
507511
const winTitle = this.tr("New Plan");
508-
const win = osparc.ui.window.Window.popUpInWindow(newStudies, winTitle, 640, 600).set({
512+
const win = osparc.ui.window.Window.popUpInWindow(newStudies, winTitle, osparc.dashboard.NewStudies.WIDTH+40, 300).set({
509513
clickAwayClose: false,
510514
resizable: true
511515
});

services/static-webserver/client/source/class/osparc/data/model/Slideshow.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ qx.Class.define("osparc.data.model.Slideshow", {
125125
return "";
126126
},
127127

128+
setInstructions: function(nodeId, instructions) {
129+
const slideshow = this.getData();
130+
if (nodeId in slideshow) {
131+
slideshow[nodeId]["instructions"] = instructions;
132+
}
133+
},
134+
128135
addNodeToSlideshow: function(newNode, leftNodeId, rightNodeId) {
129136
const nodeId = newNode.getNodeId();
130137
if (leftNodeId) {

services/static-webserver/client/source/class/osparc/desktop/organizations/MembersList.js

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
196196
const orgMember = e.getData();
197197
this.__deleteMember(orgMember);
198198
});
199+
item.addListener("leaveResource", e => {
200+
const orgMember = e.getData();
201+
this.__deleteMyself(orgMember);
202+
});
199203
}
200204
});
201205

@@ -278,6 +282,15 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
278282
];
279283
}
280284
}
285+
// Let me go?
286+
const openStudy = osparc.store.Store.getInstance().getCurrentStudy();
287+
if (
288+
openStudy === null &&
289+
canIWrite &&
290+
members.length > 1 && member["gid"] === osparc.auth.Data.getInstance().getGroupId()
291+
) {
292+
options.push("leave");
293+
}
281294
member["options"] = options;
282295
member["showOptions"] = Boolean(options.length);
283296
membersList.push(member);
@@ -469,7 +482,6 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
469482
};
470483
osparc.data.Resources.fetch("organizationMembers", "patch", params)
471484
.then(() => {
472-
// osparc.FlashMessenger.getInstance().logAs(orgMember["name"] + this.tr(" successfully demoted to Member"));
473485
osparc.FlashMessenger.getInstance().logAs(orgMember["name"] + this.tr(` successfully demoted to ${osparc.data.Roles.ORG[1].label}`));
474486
osparc.store.Store.getInstance().reset("organizationMembers");
475487
this.__reloadOrgMembers();
@@ -496,7 +508,6 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
496508
};
497509
osparc.data.Resources.fetch("organizationMembers", "patch", params)
498510
.then(() => {
499-
// osparc.FlashMessenger.getInstance().logAs(orgMember["name"] + this.tr(" successfully demoted to Manager"));
500511
osparc.FlashMessenger.getInstance().logAs(orgMember["name"] + this.tr(` successfully demoted to ${osparc.data.Roles.ORG[3].label}`));
501512
osparc.store.Store.getInstance().reset("organizationMembers");
502513
this.__reloadOrgMembers();
@@ -507,27 +518,67 @@ qx.Class.define("osparc.desktop.organizations.MembersList", {
507518
});
508519
},
509520

510-
__deleteMember: function(orgMember) {
511-
if (this.__currentOrg === null) {
512-
return;
513-
}
514-
521+
__doDeleteMember: function(orgMember) {
515522
const params = {
516523
url: {
517524
"gid": this.__currentOrg.getGid(),
518525
"uid": orgMember["id"]
519526
}
520527
};
521-
osparc.data.Resources.fetch("organizationMembers", "delete", params)
528+
return osparc.data.Resources.fetch("organizationMembers", "delete", params)
522529
.then(() => {
523530
osparc.FlashMessenger.getInstance().logAs(orgMember["name"] + this.tr(" successfully removed"));
524531
osparc.store.Store.getInstance().reset("organizationMembers");
525-
this.__reloadOrgMembers();
526532
})
527533
.catch(err => {
528534
osparc.FlashMessenger.getInstance().logAs(this.tr("Something went wrong removing ") + orgMember["name"], "ERROR");
529535
console.error(err);
530536
});
537+
},
538+
539+
__deleteMember: function(orgMember) {
540+
if (this.__currentOrg === null) {
541+
return;
542+
}
543+
544+
this.__doDeleteMember(orgMember)
545+
.then(() => this.__reloadOrgMembers());
546+
},
547+
548+
__deleteMyself: function(orgMember) {
549+
if (this.__currentOrg === null) {
550+
return;
551+
}
552+
553+
const params = {
554+
url: {
555+
"gid": this.__currentOrg.getGid()
556+
}
557+
};
558+
osparc.data.Resources.get("organizationMembers", params)
559+
.then(members => {
560+
const isThereAnyAdmin = members.some(member => member["accessRights"]["delete"]);
561+
const isThereAnyManager = members.some(member => member["accessRights"]["write"]);
562+
let rUSure = this.tr("Are you sure you want to leave?");
563+
if (isThereAnyAdmin) {
564+
rUSure += `<br>There is no ${osparc.data.Roles.ORG[2].label} in this Organization.`;
565+
} else if (isThereAnyManager) {
566+
rUSure += `<br>There is no ${osparc.data.Roles.ORG[3].label} in this Organization.`;
567+
}
568+
rUSure += "<br><br>" + this.tr("If you Leave, the page will be reloaded.");
569+
const confirmationWin = new osparc.ui.window.Confirmation(rUSure).set({
570+
confirmText: this.tr("Leave"),
571+
confirmAction: "delete"
572+
});
573+
confirmationWin.center();
574+
confirmationWin.open();
575+
confirmationWin.addListener("close", () => {
576+
if (confirmationWin.getConfirmed()) {
577+
this.__doDeleteMember(orgMember)
578+
.then(() => window.location.reload());
579+
}
580+
}, this);
581+
});
531582
}
532583
}
533584
});

services/static-webserver/client/source/class/osparc/desktop/organizations/OrganizationsList.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ qx.Class.define("osparc.desktop.organizations.OrganizationsList", {
179179
const orgsModel = this.__orgsModel;
180180
orgsModel.removeAll();
181181

182-
osparc.data.Resources.get("organizations")
182+
const useCache = false;
183+
osparc.data.Resources.get("organizations", null, useCache)
183184
.then(async respOrgs => {
184185
const orgs = respOrgs["organizations"];
185186
const promises = await orgs.map(async org => {

0 commit comments

Comments
 (0)