Skip to content

Commit ed6534a

Browse files
committed
searchByGroupId
1 parent c7e8afb commit ed6534a

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,9 +1131,9 @@ qx.Class.define("osparc.data.Resources", {
11311131
method: "GET",
11321132
url: statics.API + "/admin/user-accounts:search?email={email}"
11331133
},
1134-
searchByGid: {
1134+
searchByGroupId: {
11351135
method: "GET",
1136-
url: statics.API + "/admin/user-accounts:search?gid={gid}"
1136+
url: statics.API + "/admin/user-accounts:search?primary_group_id={gId}"
11371137
},
11381138
getPendingUsers: {
11391139
method: "GET",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ qx.Class.define("osparc.data.model.Conversation", {
304304
const extraContext = this.getExtraContext() || {};
305305
extraContext["appointment"] = appointment ? appointment.toISOString() : null;
306306
// OM: Supporters are not allowed to patch the conversation metadata yet
307-
const backendAllowsPatch = osparc.store.Products.getInstance().amIASupportUser() ? false : true;
307+
const backendAllowsPatch = osparc.store.Groups.getInstance().amIASupportUser() ? false : true;
308308
if (backendAllowsPatch) {
309309
return osparc.store.ConversationsSupport.getInstance().patchExtraContext(this.getConversationId(), extraContext)
310310
.then(() => {

services/static-webserver/client/source/class/osparc/ui/basic/UserThumbnail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ qx.Class.define("osparc.ui.basic.UserThumbnail", {
2323

2424
this.set(osparc.utils.Utils.getThumbnailProps(size));
2525

26-
if (osparc.data.Permissions.getInstance().isProductOwner()) {
26+
if (osparc.store.Groups.getInstance().amIASupportUser()) {
2727
this.setCursor("pointer");
2828
this.addListener("tap", this.__openUserDetails, this);
2929
}
@@ -49,7 +49,7 @@ qx.Class.define("osparc.ui.basic.UserThumbnail", {
4949

5050
__openUserDetails: function() {
5151
if (this.getUser()) {
52-
const userDetails = new osparc.user.UserDetails(this.getUser());
52+
const userDetails = new osparc.user.UserDetails(this.getUser().getGroupId());
5353
userDetails.center();
5454
userDetails.open();
5555
}

services/static-webserver/client/source/class/osparc/user/UserDetails.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
qx.Class.define("osparc.user.UserDetails", {
1919
extend: osparc.ui.window.Window,
2020

21-
construct: function(user) {
21+
construct: function(userGroupId) {
2222
this.base(arguments);
2323

2424
this.set({
@@ -29,7 +29,7 @@ qx.Class.define("osparc.user.UserDetails", {
2929
clickAwayClose: true,
3030
});
3131

32-
this.setUser(user);
32+
this.setUserGroupId(userGroupId);
3333
},
3434

3535
statics: {
@@ -46,6 +46,13 @@ qx.Class.define("osparc.user.UserDetails", {
4646
},
4747

4848
properties: {
49+
userGroupId: {
50+
check: "Number",
51+
init: null,
52+
nullable: false,
53+
apply: "__applyUserGroupId",
54+
},
55+
4956
user: {
5057
check: "osparc.data.model.User",
5158
init: null,
@@ -150,6 +157,24 @@ qx.Class.define("osparc.user.UserDetails", {
150157
return control || this.base(arguments, id);
151158
},
152159

160+
__applyUserGroupId: function(userGroupId) {
161+
const params = {
162+
url: {
163+
gId: userGroupId
164+
}
165+
};
166+
osparc.data.Resources.fetch("poUsers", "searchByGroupId", params)
167+
.then(userData => {
168+
if (userData.length === 1) {
169+
console.log(userData[0]);
170+
}
171+
})
172+
.catch(err => {
173+
console.error(err);
174+
this.close();
175+
});
176+
},
177+
153178
__applyUser: function(user) {
154179
this.setCaption(user.getUsername());
155180

0 commit comments

Comments
 (0)