Skip to content

Commit bd8e677

Browse files
committed
avatar group in list item
1 parent 46350a7 commit bd8e677

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ qx.Class.define("osparc.dashboard.ListButtonBase", {
5050
TITLE: 2,
5151
SPACER: 3,
5252
PROGRESS: 4,
53-
TAGS: 5,
54-
ICONS_LAYOUT: 6,
55-
OWNER: 7,
56-
SHARED: 8,
57-
LAST_CHANGE: 9,
58-
TSR: 10,
59-
HITS: 11,
60-
OPTIONS: 12
53+
AVATAR_GROUP: 5,
54+
TAGS: 6,
55+
ICONS_LAYOUT: 7,
56+
OWNER: 8,
57+
SHARED: 9,
58+
LAST_CHANGE: 10,
59+
TSR: 11,
60+
HITS: 12,
61+
OPTIONS: 13,
6162
}
6263
},
6364

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
4545
column: osparc.dashboard.ListButtonBase.POS.LOCK_STATUS
4646
});
4747
break;
48+
case "avatar-group":
49+
control = new osparc.ui.basic.AvatarGroup(24, "left", 100);
50+
this._add(control, {
51+
row: 0,
52+
column: osparc.dashboard.ListButtonBase.POS.AVATAR_GROUP
53+
});
54+
break;
4855
case "tags":
4956
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(3).set({
5057
alignY: "middle"
@@ -236,8 +243,27 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
236243
const label = this.getChildControl("owner");
237244
const user = this.__createOwner(value);
238245
label.setValue(user);
246+
247+
// remove this, testing purposes
248+
if (osparc.utils.DisabledPlugins.isSimultaneousAccessEnabled() && this.getResourceType() === "study") {
249+
const avatarGroup = this.getChildControl("avatar-group");
250+
const allUsers = [
251+
{ name: "Alice", avatar: "https://i.pravatar.cc/150?img=1" },
252+
{ name: "Bob", avatar: "https://i.pravatar.cc/150?img=2" },
253+
{ name: "Charlie", avatar: "https://i.pravatar.cc/150?img=3" },
254+
{ name: "Dana", avatar: "https://i.pravatar.cc/150?img=4" },
255+
{ name: "Eve", avatar: "https://i.pravatar.cc/150?img=5" },
256+
{ name: "Frank", avatar: "https://i.pravatar.cc/150?img=6" },
257+
];
258+
// Random number of users between 1 and 6
259+
const randomCount = Math.floor(Math.random() * 6) + 1;
260+
// Shuffle the array and take the first randomCount users
261+
const shuffled = allUsers.sort(() => 0.5 - Math.random());
262+
const randomUsers = shuffled.slice(0, randomCount);
263+
avatarGroup.setUsers(randomUsers);
264+
}
265+
239266
this.__makeItemResponsive(label);
240-
return;
241267
},
242268

243269
_applyAccessRights: function(value) {

0 commit comments

Comments
 (0)