Add user search support
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
e5f08620d4
commit
2f38f2b707
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewBox="0 0 16 16"><path d="m2.35 7.3 4 4l7.3-7.3" stroke="#00d400" stroke-width="2" fill="none"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewBox="0 0 16 16"><path d="m2.35 7.3 4 4l7.3-7.3" stroke="#46ba61" stroke-width="2" fill="none"/></svg>
|
||||
|
|
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 183 B |
File diff suppressed because one or more lines are too long
|
@ -157,6 +157,7 @@ export default {
|
|||
defaultQuota: defaultQuota,
|
||||
loading: false,
|
||||
scrolled: false,
|
||||
searchQuery: '',
|
||||
newUser: {
|
||||
id:'',
|
||||
displayName:'',
|
||||
|
@ -186,6 +187,13 @@ export default {
|
|||
* the watch won't be triggered. We need to initialize it.
|
||||
*/
|
||||
this.setNewUserDefaultGroup(this.$route.params.selectedGroup);
|
||||
|
||||
/**
|
||||
* Enable search
|
||||
*/
|
||||
document.getElementById('searchbox').style.display = 'block';
|
||||
document.getElementById('searchbox').addEventListener('input', this.search);
|
||||
document.querySelector('.searchbox .icon-close-white').addEventListener('click', this.resetSearch);
|
||||
},
|
||||
computed: {
|
||||
settings() {
|
||||
|
@ -294,11 +302,24 @@ export default {
|
|||
this.$store.dispatch('getUsers', {
|
||||
offset: this.usersOffset,
|
||||
limit: this.usersLimit,
|
||||
group: this.selectedGroup !== 'disabled' ? this.selectedGroup : ''
|
||||
group: this.selectedGroup !== 'disabled' ? this.selectedGroup : '',
|
||||
search: this.searchQuery
|
||||
})
|
||||
.then((response) => { response ? $state.loaded() : $state.complete() });
|
||||
},
|
||||
|
||||
/* SEARCH */
|
||||
search() {
|
||||
this.searchQuery = document.getElementById('searchbox').value;
|
||||
this.$store.commit('resetUsers');
|
||||
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
|
||||
},
|
||||
resetSearch() {
|
||||
this.searchQuery = '';
|
||||
document.getElementById('searchbox').value = '';
|
||||
this.search();
|
||||
},
|
||||
|
||||
resetForm() {
|
||||
// revert form to original state
|
||||
Object.assign(this.newUser, this.$options.data.call(this).newUser);
|
||||
|
|
Loading…
Reference in New Issue