Skip to content

Commit 215f8c7

Browse files
committed
[skip ci] search users
1 parent bb01332 commit 215f8c7

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,18 @@ qx.Class.define("osparc.data.Resources", {
878878
}
879879
}
880880
},
881+
/*
882+
* USERS
883+
*/
884+
"users": {
885+
useCache: false, // osparc.store.Groups handles the cache
886+
endpoints: {
887+
search: {
888+
method: "POST",
889+
url: statics.API + "/users:search"
890+
}
891+
}
892+
},
881893
/*
882894
* WALLETS
883895
*/

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

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
1111
construct: function(resourceData, showOrganizations = true) {
1212
this.base(arguments, "collaboratorsManager", this.tr("Share with"));
1313
this.set({
14-
layout: new qx.ui.layout.VBox(),
14+
layout: new qx.ui.layout.VBox(5),
1515
allowMinimize: false,
1616
allowMaximize: false,
1717
showMinimize: false,
@@ -65,12 +65,23 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
6565
});
6666
this.add(introLabel);
6767

68+
const toolbar = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({
69+
alignY: "middle",
70+
}));
6871
const filter = this.__textFilter = new osparc.filter.TextFilter("name", "collaboratorsManager").set({
69-
allowStretchX: true,
70-
margin: [0, 10, 5, 10]
72+
allowGrowX: true,
73+
margin: 0,
7174
});
7275
this.addListener("appear", () => filter.getChildControl("textfield").focus());
73-
this.add(filter);
76+
toolbar.add(filter, {
77+
flex: 1
78+
});
79+
const searchButton = new osparc.ui.form.FetchButton(this.tr("Search"), "@FontAwesome5Solid/search/12").set({
80+
maxHeight: 30,
81+
});
82+
searchButton.addListener("exectue", () => this.__searchUsers(), this);
83+
toolbar.add(searchButton);
84+
this.add(toolbar);
7485

7586
const collabButtonsContainer = this.__collabButtonsContainer = new qx.ui.container.Composite(new qx.ui.layout.VBox());
7687
const scrollContainer = new qx.ui.container.Scroll();
@@ -98,6 +109,22 @@ qx.Class.define("osparc.share.NewCollaboratorsManager", {
98109
this.add(buttons);
99110
},
100111

112+
__searchUsers: function() {
113+
const text = this.__textFilter.getValue();
114+
console.log("search", text);
115+
const params = {
116+
data: {
117+
match: text
118+
}
119+
};
120+
osparc.data.Resources.fetch("users", "search", params)
121+
.then(data => console.log(data))
122+
.catch(err => {
123+
console.error(err);
124+
osparc.FlashMessenger.getInstance().logAs(err.message, "ERROR");
125+
})
126+
},
127+
101128
__reloadCollaborators: function() {
102129
let includeProductEveryone = false;
103130
if (this.__showOrganizations === false) {

0 commit comments

Comments
 (0)