Skip to content

Commit 920710a

Browse files
authored
🎨 [Frontend] All users know about the Support group (#8305)
1 parent d224dfa commit 920710a

File tree

18 files changed

+176
-106
lines changed

18 files changed

+176
-106
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
5252
statics: {
5353
SHARE_ICON: "@FontAwesome5Solid/share-alt/13",
5454
SHARED_USER: "@FontAwesome5Solid/user/13",
55+
SHARED_SUPPORT: "@FontAwesome5Solid/question/13",
5556
SHARED_ORGS: "@FontAwesome5Solid/users/13",
5657
SHARED_ALL: "@FontAwesome5Solid/globe/13",
5758
PERM_READ: "@FontAwesome5Solid/eye/13",
@@ -188,17 +189,25 @@ qx.Class.define("osparc.dashboard.CardBase", {
188189
// Icon
189190
const groupsStore = osparc.store.Groups.getInstance();
190191
const everyoneGroupIds = groupsStore.getEveryoneGroupIds();
192+
const supportGroup = groupsStore.getSupportGroup();
191193
const organizations = groupsStore.getOrganizations();
192194
const myGroupId = groupsStore.getMyGroupId();
193195

194196
const organizationIds = Object.keys(organizations).map(key => parseInt(key));
195197
if (gids.some(gid => everyoneGroupIds.includes(gid))) {
198+
// shared with "1" or product everyone
196199
shareIcon.setSource(osparc.dashboard.CardBase.SHARED_ALL);
200+
} else if (supportGroup && gids.includes(supportGroup.getGroupId())) {
201+
// shared with support group, show as if it was a group
202+
shareIcon.setSource(osparc.dashboard.CardBase.SHARED_ORGS);
197203
} else if (organizationIds.filter(value => gids.includes(value)).length) { // find intersection
204+
// shared with at least one organization
198205
shareIcon.setSource(osparc.dashboard.CardBase.SHARED_ORGS);
199206
} else if (gids.length === 1 && gids[0] === myGroupId) {
207+
// not shared
200208
shareIcon.setSource(osparc.dashboard.CardBase.SHARE_ICON);
201209
} else {
210+
// shared with some users
202211
shareIcon.setSource(osparc.dashboard.CardBase.SHARED_USER);
203212
}
204213

@@ -227,10 +236,14 @@ qx.Class.define("osparc.dashboard.CardBase", {
227236
addHintFromGids: function(icon, gids) {
228237
const groupsStore = osparc.store.Groups.getInstance();
229238
const everyoneGroups = groupsStore.getEveryoneGroups();
239+
const supportGroup = groupsStore.getSupportGroup();
230240
const organizations = groupsStore.getOrganizations();
231241
const myGroupId = groupsStore.getMyGroupId();
232242

233243
const groups = everyoneGroups.slice();
244+
if (supportGroup) {
245+
groups.push(supportGroup);
246+
}
234247
groups.push(...Object.values(organizations));
235248
const sharedGrps = [];
236249
groups.forEach(group => {
@@ -267,10 +280,14 @@ qx.Class.define("osparc.dashboard.CardBase", {
267280
sharedGrpLabels.push("...");
268281
break;
269282
}
270-
let sharedGrpLabel = sharedGrps[i].getLabel();
271-
if (everyoneGroups.includes(sharedGrps[i])) {
283+
const sharedGroup = sharedGrps[i];
284+
let sharedGrpLabel = sharedGroup.getLabel();
285+
if (everyoneGroups.includes(sharedGroup)) {
272286
sharedGrpLabel = "Public";
273287
}
288+
if (supportGroup && supportGroup.getGroupId() === sharedGroup.getGroupId()) {
289+
sharedGrpLabel = supportGroup.getLabel();
290+
}
274291
if (!sharedGrpLabels.includes(sharedGrpLabel)) {
275292
sharedGrpLabels.push(sharedGrpLabel);
276293
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,11 +580,11 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
580580
let icon = "";
581581
if (group.getThumbnail()) {
582582
icon = group.getThumbnail();
583-
} else if (group["collabType"] === 0) {
583+
} else if (group["collabType"] === osparc.store.Groups.COLLAB_TYPE.EVERYONE) {
584584
icon = "@FontAwesome5Solid/globe/24";
585-
} else if (group["collabType"] === 1) {
585+
} else if (group["collabType"] === osparc.store.Groups.COLLAB_TYPE.ORGANIZATION) {
586586
icon = "@FontAwesome5Solid/users/24";
587-
} else if (group["collabType"] === 2) {
587+
} else if (group["collabType"] === osparc.store.Groups.COLLAB_TYPE.USER) {
588588
icon = "@FontAwesome5Solid/user/24";
589589
}
590590
groupContainer.set({

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ qx.Class.define("osparc.data.model.Group", {
8282
},
8383

8484
groupType: {
85-
check: ["me", "organization", "productEveryone", "everyone"],
85+
check: ["me", "organization", "support", "productEveryone", "everyone"],
8686
nullable: false,
8787
init: null,
8888
},

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,7 @@ qx.Class.define("osparc.data.model.User", {
5555
phoneNumber: userData["phone"] || null,
5656
});
5757

58-
let description = this.getFullName();
59-
if (email) {
60-
if (description) {
61-
description += " - "
62-
}
63-
description += email;
64-
}
58+
const description = osparc.data.model.User.userDataToDescription(firstName, lastName, email);
6559
this.set({
6660
label: userData["userName"] || description,
6761
description,

services/static-webserver/client/source/class/osparc/filter/CollaboratorToggleButton.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,23 @@ qx.Class.define("osparc.filter.CollaboratorToggleButton", {
2828
let label = null;
2929
let toolTipText = "";
3030
switch (collaborator["collabType"]) {
31-
case 0:
32-
iconPath = "@FontAwesome5Solid/globe/14";
31+
case osparc.store.Groups.COLLAB_TYPE.EVERYONE:
32+
iconPath = osparc.dashboard.CardBase.SHARED_ALL;
3333
label = this.tr("Public");
3434
toolTipText = this.tr("Public to all users");
3535
break;
36-
case 1:
37-
iconPath = "@FontAwesome5Solid/users/14";
36+
case osparc.store.Groups.COLLAB_TYPE.SUPPORT:
37+
iconPath = osparc.dashboard.CardBase.SHARED_SUPPORT;
3838
label = collaborator.getLabel();
3939
toolTipText = collaborator.getDescription();
4040
break;
41-
case 2: {
42-
iconPath = "@FontAwesome5Solid/user/14";
41+
case osparc.store.Groups.COLLAB_TYPE.ORGANIZATION:
42+
iconPath = osparc.dashboard.CardBase.SHARED_ORGS;
43+
label = collaborator.getLabel();
44+
toolTipText = collaborator.getDescription();
45+
break;
46+
case osparc.store.Groups.COLLAB_TYPE.USER: {
47+
iconPath = osparc.dashboard.CardBase.SHARED_USER;
4348
label = collaborator.getLabel();
4449
if (collaborator.getEmail()) {
4550
toolTipText += collaborator.getEmail() + "<br>";

services/static-webserver/client/source/class/osparc/filter/OrganizationsAndMembers.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,21 @@ qx.Class.define("osparc.filter.OrganizationsAndMembers", {
6464

6565
const visibleCollaborators = Object.values(this.__visibleCollaborators);
6666

67+
// define the priority order
68+
const collabTypeOrder = [
69+
osparc.store.Groups.COLLAB_TYPE.EVERYONE,
70+
osparc.store.Groups.COLLAB_TYPE.SUPPORT,
71+
osparc.store.Groups.COLLAB_TYPE.ORGANIZATION,
72+
osparc.store.Groups.COLLAB_TYPE.USER
73+
];
6774
// sort them first
6875
visibleCollaborators.sort((a, b) => {
69-
if (a["collabType"] > b["collabType"]) {
70-
return 1;
71-
}
72-
if (a["collabType"] < b["collabType"]) {
73-
return -1;
74-
}
75-
if (a.getLabel() > b.getLabel()) {
76-
return 1;
77-
}
78-
return -1;
76+
const typeDiff = collabTypeOrder.indexOf(a["collabType"]) - collabTypeOrder.indexOf(b["collabType"]);
77+
if (typeDiff !== 0) {
78+
return typeDiff;
79+
}
80+
// fallback: sort alphabetically by label
81+
return a.getLabel().localeCompare(b.getLabel());
7982
});
8083

8184
visibleCollaborators.forEach(visibleCollaborator => {
@@ -85,14 +88,14 @@ qx.Class.define("osparc.filter.OrganizationsAndMembers", {
8588
const btn = this.addOption(visibleCollaborator);
8689
let iconPath = null;
8790
switch (visibleCollaborator["collabType"]) {
88-
case 0:
89-
iconPath = "@FontAwesome5Solid/globe/14";
91+
case osparc.store.Groups.COLLAB_TYPE.EVERYONE:
92+
iconPath = osparc.dashboard.CardBase.SHARED_ALL;
9093
break;
91-
case 1:
92-
iconPath = "@FontAwesome5Solid/users/14";
94+
case osparc.store.Groups.COLLAB_TYPE.ORGANIZATION:
95+
iconPath = osparc.dashboard.CardBase.SHARED_ORGS;
9396
break;
94-
case 2:
95-
iconPath = "@FontAwesome5Solid/user/14";
97+
case osparc.store.Groups.COLLAB_TYPE.USER:
98+
iconPath = osparc.dashboard.CardBase.SHARED_USER;
9699
break;
97100
}
98101
btn.setIcon(iconPath);

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,5 @@ qx.Class.define("osparc.product.Utils", {
450450
groupServices: function() {
451451
return Boolean(osparc.store.Products.getInstance().getGroupedServicesUiConfig());
452452
},
453-
454-
isSupportEnabled: function() {
455-
return Boolean(osparc.store.Products.getInstance().getSupportGroupId());
456-
},
457453
}
458454
});

services/static-webserver/client/source/class/osparc/share/Collaborators.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ qx.Class.define("osparc.share.Collaborators", {
437437
const usersStore = osparc.store.Users.getInstance();
438438
const groupsStore = osparc.store.Groups.getInstance();
439439
const everyoneGroupIds = groupsStore.getEveryoneGroupIds();
440+
const supportGroup = groupsStore.getSupportGroup();
440441
const allGroups = groupsStore.getAllGroups();
441442
const showOptions = this.__canIChangePermissions();
442443
const accessRights = this._serializedDataCopy["accessRights"];
@@ -461,6 +462,8 @@ qx.Class.define("osparc.share.Collaborators", {
461462
// organization
462463
if (everyoneGroupIds.includes(parseInt(gid))) {
463464
collaborator["thumbnail"] = "@FontAwesome5Solid/globe/32";
465+
} else if (supportGroup && supportGroup.getGroupId() === parseInt(gid)) {
466+
collaborator["thumbnail"] = supportGroup.getThumbnail();
464467
} else if (!collaborator["thumbnail"]) {
465468
collaborator["thumbnail"] = "@FontAwesome5Solid/users/26";
466469
}

services/static-webserver/client/source/class/osparc/share/NewCollaboratorsManager.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
1717
allowMaximize: false,
1818
showMinimize: false,
1919
showMaximize: false,
20+
resizable: true,
2021
autoDestroy: true,
2122
modal: true,
2223
width: 430,
23-
maxHeight: 500,
24-
clickAwayClose: true
24+
height: 500,
25+
clickAwayClose: true,
2526
});
2627

2728
this.__resourceData = resourceData;
@@ -120,9 +121,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
120121
break;
121122
}
122123
case "potential-collaborators-list": {
123-
control = new qx.ui.container.Composite(new qx.ui.layout.VBox()).set({
124-
minHeight: 160,
125-
});
124+
control = new qx.ui.container.Composite(new qx.ui.layout.VBox());
126125
const scrollContainer = new qx.ui.container.Scroll();
127126
scrollContainer.add(control);
128127
this.add(scrollContainer, {
@@ -242,7 +241,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
242241
const text = this.getChildControl("text-filter").getChildControl("textfield").getValue();
243242
osparc.store.Users.getInstance().searchUsers(text)
244243
.then(users => {
245-
users.forEach(user => user["collabType"] = 2);
244+
users.forEach(user => user["collabType"] = osparc.store.Groups.COLLAB_TYPE.USER);
246245
this.__addPotentialCollaborators(users);
247246
})
248247
.catch(err => osparc.FlashMessenger.logError(err))
@@ -338,18 +337,21 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
338337
const potentialCollaborators = Object.values(this.__potentialCollaborators).concat(foundCollaborators);
339338
const potentialCollaboratorList = this.getChildControl("potential-collaborators-list");
340339

340+
// define the priority order
341+
const collabTypeOrder = [
342+
osparc.store.Groups.COLLAB_TYPE.EVERYONE,
343+
osparc.store.Groups.COLLAB_TYPE.SUPPORT,
344+
osparc.store.Groups.COLLAB_TYPE.ORGANIZATION,
345+
osparc.store.Groups.COLLAB_TYPE.USER
346+
];
341347
// sort them first
342348
potentialCollaborators.sort((a, b) => {
343-
if (a["collabType"] > b["collabType"]) {
344-
return 1;
345-
}
346-
if (a["collabType"] < b["collabType"]) {
347-
return -1;
348-
}
349-
if (a.getLabel() > b.getLabel()) {
350-
return 1;
349+
const typeDiff = collabTypeOrder.indexOf(a["collabType"]) - collabTypeOrder.indexOf(b["collabType"]);
350+
if (typeDiff !== 0) {
351+
return typeDiff;
351352
}
352-
return -1;
353+
// fallback: sort alphabetically by label
354+
return a.getLabel().localeCompare(b.getLabel());
353355
});
354356

355357
let existingCollabs = [];
@@ -383,7 +385,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
383385
return;
384386
}
385387
// maybe, do not list the organizations
386-
if (this.__showOrganizations === false && potentialCollaborator["collabType"] !== 2) {
388+
if (this.__showOrganizations === false && potentialCollaborator["collabType"] !== osparc.store.Groups.COLLAB_TYPE.USER) {
387389
return;
388390
}
389391
potentialCollaboratorList.add(this.__collaboratorButton(potentialCollaborator));

0 commit comments

Comments
 (0)