Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f437d19
supportGroup as prop
odeimaiz Sep 4, 2025
dab82bc
support group
odeimaiz Sep 4, 2025
db8d7b8
Merge branch 'master' into enh/all-users-get-support-group
odeimaiz Sep 4, 2025
a3a5399
Merge branch 'enh/all-users-get-support-group' of github.com:odeimaiz…
odeimaiz Sep 4, 2025
2211521
not needed
odeimaiz Sep 4, 2025
5a8906d
minor
odeimaiz Sep 4, 2025
9ad6201
show icon
odeimaiz Sep 4, 2025
f712dbb
show tooltip
odeimaiz Sep 4, 2025
c6ad1e5
supportGroup in list
odeimaiz Sep 4, 2025
1977626
getAllGroups
odeimaiz Sep 4, 2025
814f65c
getAllMyGroupIds
odeimaiz Sep 4, 2025
a301a30
getPotentialCollaborators
odeimaiz Sep 4, 2025
c68397b
minor
odeimaiz Sep 4, 2025
19bff14
refactor
odeimaiz Sep 4, 2025
962f10a
working
odeimaiz Sep 4, 2025
3bd6d5d
Update services/static-webserver/client/source/class/osparc/dashboard…
odeimaiz Sep 4, 2025
a16dda4
minor
odeimaiz Sep 4, 2025
0be79f9
Merge branch 'enh/all-users-get-support-group' of github.com:odeimaiz…
odeimaiz Sep 4, 2025
4954a6e
userDataToDescription
odeimaiz Sep 4, 2025
aff1208
minor
odeimaiz Sep 4, 2025
462cf96
minor
odeimaiz Sep 4, 2025
21f472d
Merge branch 'master' into enh/all-users-get-support-group
odeimaiz Sep 4, 2025
69cd34c
Merge branch 'master' into enh/all-users-get-support-group
odeimaiz Sep 4, 2025
dc904b0
minor fix
odeimaiz Sep 4, 2025
c8cba5d
Merge branch 'enh/all-users-get-support-group' of github.com:odeimaiz…
odeimaiz Sep 4, 2025
84dc743
Merge branch 'master' into enh/all-users-get-support-group
odeimaiz Sep 4, 2025
69ce65c
Merge branch 'master' into enh/all-users-get-support-group
odeimaiz Sep 4, 2025
1ab4a8c
Merge branch 'enh/all-users-get-support-group' of github.com:odeimaiz…
odeimaiz Sep 4, 2025
18af48d
Merge branch 'master' into enh/all-users-get-support-group
odeimaiz Sep 4, 2025
9c8de6e
Merge branch 'master' into enh/all-users-get-support-group
odeimaiz Sep 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
statics: {
SHARE_ICON: "@FontAwesome5Solid/share-alt/13",
SHARED_USER: "@FontAwesome5Solid/user/13",
SHARED_SUPPORT: "@FontAwesome5Solid/question/13",
SHARED_ORGS: "@FontAwesome5Solid/users/13",
SHARED_ALL: "@FontAwesome5Solid/globe/13",
PERM_READ: "@FontAwesome5Solid/eye/13",
Expand Down Expand Up @@ -188,17 +189,25 @@ qx.Class.define("osparc.dashboard.CardBase", {
// Icon
const groupsStore = osparc.store.Groups.getInstance();
const everyoneGroupIds = groupsStore.getEveryoneGroupIds();
const supportGroup = groupsStore.getSupportGroup();
const organizations = groupsStore.getOrganizations();
const myGroupId = groupsStore.getMyGroupId();

const organizationIds = Object.keys(organizations).map(key => parseInt(key));
if (gids.some(gid => everyoneGroupIds.includes(gid))) {
// shared with "1" or product everyone
shareIcon.setSource(osparc.dashboard.CardBase.SHARED_ALL);
} else if (supportGroup && gids.includes(supportGroup.getGroupId())) {
// shared with support group, show as if it was a group
shareIcon.setSource(osparc.dashboard.CardBase.SHARED_ORGS);
} else if (organizationIds.filter(value => gids.includes(value)).length) { // find intersection
// shared with at least one organization
shareIcon.setSource(osparc.dashboard.CardBase.SHARED_ORGS);
} else if (gids.length === 1 && gids[0] === myGroupId) {
// not shared
shareIcon.setSource(osparc.dashboard.CardBase.SHARE_ICON);
} else {
// shared with some users
shareIcon.setSource(osparc.dashboard.CardBase.SHARED_USER);
}

Expand Down Expand Up @@ -227,10 +236,14 @@ qx.Class.define("osparc.dashboard.CardBase", {
addHintFromGids: function(icon, gids) {
const groupsStore = osparc.store.Groups.getInstance();
const everyoneGroups = groupsStore.getEveryoneGroups();
const supportGroup = groupsStore.getSupportGroup();
const organizations = groupsStore.getOrganizations();
const myGroupId = groupsStore.getMyGroupId();

const groups = everyoneGroups.slice();
if (supportGroup) {
groups.push(supportGroup);
}
groups.push(...Object.values(organizations));
const sharedGrps = [];
groups.forEach(group => {
Expand Down Expand Up @@ -267,10 +280,14 @@ qx.Class.define("osparc.dashboard.CardBase", {
sharedGrpLabels.push("...");
break;
}
let sharedGrpLabel = sharedGrps[i].getLabel();
if (everyoneGroups.includes(sharedGrps[i])) {
const sharedGroup = sharedGrps[i];
let sharedGrpLabel = sharedGroup.getLabel();
if (everyoneGroups.includes(sharedGroup)) {
sharedGrpLabel = "Public";
}
if (supportGroup && supportGroup.getGroupId() === sharedGroup.getGroupId()) {
sharedGrpLabel = supportGroup.getLabel();
}
if (!sharedGrpLabels.includes(sharedGrpLabel)) {
sharedGrpLabels.push(sharedGrpLabel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,11 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
let icon = "";
if (group.getThumbnail()) {
icon = group.getThumbnail();
} else if (group["collabType"] === 0) {
} else if (group["collabType"] === osparc.store.Groups.COLLAB_TYPE.EVERYONE) {
icon = "@FontAwesome5Solid/globe/24";
} else if (group["collabType"] === 1) {
} else if (group["collabType"] === osparc.store.Groups.COLLAB_TYPE.ORGANIZATION) {
icon = "@FontAwesome5Solid/users/24";
} else if (group["collabType"] === 2) {
} else if (group["collabType"] === osparc.store.Groups.COLLAB_TYPE.USER) {
icon = "@FontAwesome5Solid/user/24";
}
groupContainer.set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ qx.Class.define("osparc.data.model.Group", {
},

groupType: {
check: ["me", "organization", "productEveryone", "everyone"],
check: ["me", "organization", "support", "productEveryone", "everyone"],
nullable: false,
init: null,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ qx.Class.define("osparc.data.model.User", {
} else if (userData["lastName"]) {
lastName = userData["lastName"];
}
let description = [firstName, lastName].join(" ").trim(); // the null values will be replaced by empty strings
if (email) {
if (description) {
description += " - "
}
description += email;
}
const description = osparc.data.model.User.userDataToDescription(firstName, lastName, email);

this.set({
userId,
Expand Down Expand Up @@ -142,6 +136,19 @@ qx.Class.define("osparc.data.model.User", {
},
},

statics: {
userDataToDescription: function(firstName, lastName, email) {
let description = [(firstName || ""), (lastName || "")].join(" ").trim(); // the null values will be replaced by empty strings
if (email) {
if (description) {
description += " - "
}
description += email;
}
return description;
}
},

members: {
createThumbnail: function(size) {
return osparc.utils.Avatar.emailToThumbnail(this.getEmail(), this.getUsername(), size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,23 @@ qx.Class.define("osparc.filter.CollaboratorToggleButton", {
let label = null;
let toolTipText = "";
switch (collaborator["collabType"]) {
case 0:
iconPath = "@FontAwesome5Solid/globe/14";
case osparc.store.Groups.COLLAB_TYPE.EVERYONE:
iconPath = osparc.dashboard.CardBase.SHARED_ALL;
label = this.tr("Public");
toolTipText = this.tr("Public to all users");
break;
case 1:
iconPath = "@FontAwesome5Solid/users/14";
case osparc.store.Groups.COLLAB_TYPE.SUPPORT:
iconPath = osparc.dashboard.CardBase.SHARED_SUPPORT;
label = collaborator.getLabel();
toolTipText = collaborator.getDescription();
break;
case 2: {
iconPath = "@FontAwesome5Solid/user/14";
case osparc.store.Groups.COLLAB_TYPE.ORGANIZATION:
iconPath = osparc.dashboard.CardBase.SHARED_ORGS;
label = collaborator.getLabel();
toolTipText = collaborator.getDescription();
break;
case osparc.store.Groups.COLLAB_TYPE.USER: {
iconPath = osparc.dashboard.CardBase.SHARED_USER;
label = collaborator.getLabel();
if (collaborator.getEmail()) {
toolTipText += collaborator.getEmail() + "<br>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,21 @@ qx.Class.define("osparc.filter.OrganizationsAndMembers", {

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

// define the priority order
const collabTypeOrder = [
osparc.store.Groups.COLLAB_TYPE.EVERYONE,
osparc.store.Groups.COLLAB_TYPE.SUPPORT,
osparc.store.Groups.COLLAB_TYPE.ORGANIZATION,
osparc.store.Groups.COLLAB_TYPE.USER
];
// sort them first
visibleCollaborators.sort((a, b) => {
if (a["collabType"] > b["collabType"]) {
return 1;
}
if (a["collabType"] < b["collabType"]) {
return -1;
}
if (a.getLabel() > b.getLabel()) {
return 1;
}
return -1;
const typeDiff = collabTypeOrder.indexOf(a["collabType"]) - collabTypeOrder.indexOf(b["collabType"]);
if (typeDiff !== 0) {
return typeDiff;
}
// fallback: sort alphabetically by label
return a.getLabel().localeCompare(b.getLabel());
});

visibleCollaborators.forEach(visibleCollaborator => {
Expand All @@ -85,14 +88,14 @@ qx.Class.define("osparc.filter.OrganizationsAndMembers", {
const btn = this.addOption(visibleCollaborator);
let iconPath = null;
switch (visibleCollaborator["collabType"]) {
case 0:
iconPath = "@FontAwesome5Solid/globe/14";
case osparc.store.Groups.COLLAB_TYPE.EVERYONE:
iconPath = osparc.dashboard.CardBase.SHARED_ALL;
break;
case 1:
iconPath = "@FontAwesome5Solid/users/14";
case osparc.store.Groups.COLLAB_TYPE.ORGANIZATION:
iconPath = osparc.dashboard.CardBase.SHARED_ORGS;
break;
case 2:
iconPath = "@FontAwesome5Solid/user/14";
case osparc.store.Groups.COLLAB_TYPE.USER:
iconPath = osparc.dashboard.CardBase.SHARED_USER;
break;
}
btn.setIcon(iconPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,5 @@ qx.Class.define("osparc.product.Utils", {
groupServices: function() {
return Boolean(osparc.store.Products.getInstance().getGroupedServicesUiConfig());
},

isSupportEnabled: function() {
return Boolean(osparc.store.Products.getInstance().getSupportGroupId());
},
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ qx.Class.define("osparc.share.Collaborators", {
const usersStore = osparc.store.Users.getInstance();
const groupsStore = osparc.store.Groups.getInstance();
const everyoneGroupIds = groupsStore.getEveryoneGroupIds();
const supportGroup = groupsStore.getSupportGroup();
const allGroups = groupsStore.getAllGroups();
const showOptions = this.__canIChangePermissions();
const accessRights = this._serializedDataCopy["accessRights"];
Expand All @@ -461,6 +462,8 @@ qx.Class.define("osparc.share.Collaborators", {
// organization
if (everyoneGroupIds.includes(parseInt(gid))) {
collaborator["thumbnail"] = "@FontAwesome5Solid/globe/32";
} else if (supportGroup && supportGroup.getGroupId() === parseInt(gid)) {
collaborator["thumbnail"] = supportGroup.getThumbnail();
} else if (!collaborator["thumbnail"]) {
collaborator["thumbnail"] = "@FontAwesome5Solid/users/26";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
const text = this.getChildControl("text-filter").getChildControl("textfield").getValue();
osparc.store.Users.getInstance().searchUsers(text)
.then(users => {
users.forEach(user => user["collabType"] = 2);
users.forEach(user => user["collabType"] = osparc.store.Groups.COLLAB_TYPE.USER);
this.__addPotentialCollaborators(users);
})
.catch(err => osparc.FlashMessenger.logError(err))
Expand Down Expand Up @@ -338,18 +338,21 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
const potentialCollaborators = Object.values(this.__potentialCollaborators).concat(foundCollaborators);
const potentialCollaboratorList = this.getChildControl("potential-collaborators-list");

// define the priority order
const collabTypeOrder = [
osparc.store.Groups.COLLAB_TYPE.EVERYONE,
osparc.store.Groups.COLLAB_TYPE.SUPPORT,
osparc.store.Groups.COLLAB_TYPE.ORGANIZATION,
osparc.store.Groups.COLLAB_TYPE.USER
];
// sort them first
potentialCollaborators.sort((a, b) => {
if (a["collabType"] > b["collabType"]) {
return 1;
const typeDiff = collabTypeOrder.indexOf(a["collabType"]) - collabTypeOrder.indexOf(b["collabType"]);
if (typeDiff !== 0) {
return typeDiff;
}
if (a["collabType"] < b["collabType"]) {
return -1;
}
if (a.getLabel() > b.getLabel()) {
return 1;
}
return -1;
// fallback: sort alphabetically by label
return a.getLabel().localeCompare(b.getLabel());
});

let existingCollabs = [];
Expand Down Expand Up @@ -383,7 +386,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
return;
}
// maybe, do not list the organizations
if (this.__showOrganizations === false && potentialCollaborator["collabType"] !== 2) {
if (this.__showOrganizations === false && potentialCollaborator["collabType"] !== osparc.store.Groups.COLLAB_TYPE.USER) {
return;
}
potentialCollaboratorList.add(this.__collaboratorButton(potentialCollaborator));
Expand Down
Loading
Loading