[admin] filter users

This commit is contained in:
Avris 2020-12-22 11:05:33 +01:00
parent 519a54dcb8
commit b0a715536c
1 changed files with 8 additions and 1 deletions

View File

@ -14,7 +14,8 @@
({{stats.users.overall}}, {{stats.users.admins}} admins) ({{stats.users.overall}}, {{stats.users.admins}} admins)
</summary> </summary>
<div class="border-top"> <div class="border-top">
<Table :data="Object.values(users)" :columns="4"> <input class="form-control mt-4" v-model="userFilter" :placeholder="$t('crud.filterLong')"/>
<Table :data="visibleUsers" :columns="4">
<template v-slot:header> <template v-slot:header>
<th class="text-nowrap"> <th class="text-nowrap">
<T>admin.user.user</T> <T>admin.user.user</T>
@ -123,6 +124,7 @@
data() { data() {
return { return {
socialProviders, socialProviders,
userFilter: '',
} }
}, },
async asyncData({ app, store }) { async asyncData({ app, store }) {
@ -148,6 +150,11 @@
this.users[userId].roles = role; this.users[userId].roles = role;
} }
}, },
computed: {
visibleUsers() {
return Object.values(this.users).filter(u => u.username.toLowerCase().includes(this.userFilter.toLowerCase()));
},
},
head() { head() {
return head({ return head({
title: this.$t('admin.header'), title: this.$t('admin.header'),