mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Search user in admin panel
This commit is contained in:
parent
9c3a976250
commit
308417852c
3 changed files with 43 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ BlazeComponent.extendComponent({
|
|||
this.error = new ReactiveVar('');
|
||||
this.loading = new ReactiveVar(false);
|
||||
this.people = new ReactiveVar(true);
|
||||
this.findUsersOptions = new ReactiveVar({});
|
||||
|
||||
this.page = new ReactiveVar(1);
|
||||
this.loadNextPageLocked = false;
|
||||
|
|
@ -26,6 +27,25 @@ BlazeComponent.extendComponent({
|
|||
});
|
||||
});
|
||||
},
|
||||
events() {
|
||||
return [{
|
||||
'click #searchButton'(event) {
|
||||
const value = $('#searchInput').first().val();
|
||||
if (value === '') {
|
||||
this.findUsersOptions.set({});
|
||||
} else {
|
||||
const regex = new RegExp(value, 'i');
|
||||
this.findUsersOptions.set({
|
||||
$or: [
|
||||
{ username: regex },
|
||||
{ 'profile.fullname': regex },
|
||||
{ 'emails.address': regex },
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
}];
|
||||
},
|
||||
loadNextPage() {
|
||||
if (this.loadNextPageLocked === false) {
|
||||
this.page.set(this.page.get() + 1);
|
||||
|
|
@ -49,7 +69,8 @@ BlazeComponent.extendComponent({
|
|||
this.loading.set(w);
|
||||
},
|
||||
peopleList() {
|
||||
return Users.find({}, {
|
||||
// get users in front to cache them
|
||||
return Users.find(this.findUsersOptions.get(), {
|
||||
fields: {_id: true},
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue