This commit is contained in:
Marcel Pociot
2021-05-21 17:20:48 +02:00
parent 9220e83798
commit 717e8cf05c
25 changed files with 585 additions and 128 deletions

View File

@@ -19,8 +19,9 @@
<div class="mt-1 sm:mt-0 sm:col-span-2">
<div class="max-w-lg flex rounded-md shadow-sm">
<input id="username"
type="text"
v-model="userForm.name"
class="flex-1 form-input block w-full rounded-md transition duration-150 ease-in-out sm:text-sm sm:leading-5"/>
class="flex-1 border-gray-300 block w-full rounded-md transition duration-150 ease-in-out sm:text-sm sm:leading-5"/>
</div>
</div>
</div>
@@ -78,6 +79,15 @@
</div>
</form>
<div class="-my-2 py-2 overflow-x-auto sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8">
<div class="max-w-lg flex rounded-md shadow-sm mb-8">
<input id="search"
type="text"
v-model="search"
autocomplete="off"
placeholder="Search users"
class="flex-1 border-gray-300 block w-full rounded-md transition duration-150 ease-in-out sm:text-sm sm:leading-5"/>
</div>
<div
class="align-middle inline-block min-w-full shadow overflow-hidden sm:rounded-lg border-b border-gray-200">
<table class="min-w-full" v-if="users.length > 0">
@@ -171,6 +181,7 @@
delimiters: ['@{', '}'],
data: {
search: '',
userForm: {
name: '',
can_specify_subdomains: true,
@@ -181,14 +192,26 @@
},
computed: {
total : function() {
return this.paginated.total;
},
users : function() {
return this.paginated.users;
}
},
watch: {
search(val) {
if (val.length < 3) {
return;
}
this.getUsers(1);
}
},
methods: {
getUsers(page) {
fetch('/api/users?page=' + page)
fetch('/api/users?search='+this.search+'&page=' + page)
.then((response) => {
return response.json();
}).then((data) => {