Skip to content

Commit 28b4786

Browse files
committed
__addActionsLayout
1 parent 5616461 commit 28b4786

File tree

1 file changed

+57
-11
lines changed

1 file changed

+57
-11
lines changed

services/static-webserver/client/source/class/osparc/ui/message/NodeLockedPage.js

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,26 @@
3030
qx.Class.define("osparc.ui.message.NodeLockedPage", {
3131
extend: osparc.ui.message.Loading,
3232

33+
34+
construct: function() {
35+
this.base(arguments);
36+
37+
this.__addActionsLayout();
38+
},
39+
3340
properties: {
3441
node: {
3542
check: "osparc.data.model.Node",
3643
init: null,
3744
nullable: false,
3845
event: "changeNode",
39-
apply: "__applyNode"
46+
apply: "__applyNode",
4047
},
4148
},
4249

4350
members: {
51+
__avatarGroup: null,
52+
4453
__applyNode: function(node) {
4554
const thumbnail = node.getMetadata()["thumbnail"];
4655
if (thumbnail) {
@@ -49,17 +58,54 @@ qx.Class.define("osparc.ui.message.NodeLockedPage", {
4958

5059
const lockState = node.getStatus().getLockState();
5160

52-
const updateTitle = () => {
53-
if (lockState.isLocked()) {
54-
this._setHeaderIcon("@FontAwesome5Solid/lock/20");
55-
this._setHeaderTitle(this.tr("The application is being used"));
56-
} else {
57-
this._setHeaderIcon("@FontAwesome5Solid/lock-open/20");
58-
this._setHeaderTitle(this.tr("The application is not being used"));
61+
lockState.addListener("changeLocked", this.__lockedChanged, this);
62+
this.__lockedChanged();
63+
64+
lockState.addListener("currentUserGroupIds", this.__currentUserGroupIdsChanged, this);
65+
this.__currentUserGroupIdsChanged();
66+
},
67+
68+
__addActionsLayout: function() {
69+
const actionsLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({
70+
alignX: "center"
71+
}));
72+
73+
const conversationButton = new qx.ui.form.Button().set({
74+
appearance: "form-button-outlined",
75+
toolTipText: this.tr("Conversations"),
76+
icon: "@FontAwesome5Solid/comments/16",
77+
});
78+
conversationButton.addListener("execute", () => {
79+
if (this.getNode()) {
80+
const study = this.getNode().getStudy();
81+
osparc.study.Conversations.popUpInWindow(study.serialize());
5982
}
60-
};
61-
updateTitle();
62-
lockState.addListener("changeLocked", updateTitle);
83+
});
84+
actionsLayout.add(conversationButton);
85+
86+
const avatarGroup = this.__avatarGroup = new osparc.ui.basic.AvatarGroup(26, "left", 50).set({
87+
hideMyself: true,
88+
alignX: "center",
89+
});
90+
actionsLayout.add(avatarGroup);
91+
this.addWidgetToMessages(actionsLayout);
92+
},
93+
94+
__lockedChanged: function() {
95+
const lockState = this.getNode().getStatus().getLockState();
96+
if (lockState.isLocked()) {
97+
this._setHeaderIcon("@FontAwesome5Solid/lock/20");
98+
this._setHeaderTitle(this.tr("The application is being used"));
99+
} else {
100+
this._setHeaderIcon("@FontAwesome5Solid/lock-open/20");
101+
this._setHeaderTitle(this.tr("The application is not being used"));
102+
}
103+
},
104+
105+
__currentUserGroupIdsChanged: function() {
106+
const lockState = this.getNode().getStatus().getLockState();
107+
const currentUserGroupIds = lockState.getCurrentUserGroupIds();
108+
this.__avatarGroup.setUserGroupIds(currentUserGroupIds);
63109
},
64110
}
65111
});

0 commit comments

Comments
 (0)