mirror of
https://github.com/open-webui/open-webui
synced 2024-12-24 12:52:12 +00:00
refac
This commit is contained in:
parent
ec17bbc867
commit
e1baa9cc3f
@ -90,6 +90,25 @@
|
|||||||
sortOrder = 'asc';
|
sortOrder = 'asc';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let filteredUsers;
|
||||||
|
|
||||||
|
$: filteredUsers = users
|
||||||
|
.filter((user) => {
|
||||||
|
if (search === '') {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
let name = user.name.toLowerCase();
|
||||||
|
const query = search.toLowerCase();
|
||||||
|
return name.includes(query);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.sort((a, b) => {
|
||||||
|
if (a[sortKey] < b[sortKey]) return sortOrder === 'asc' ? -1 : 1;
|
||||||
|
if (a[sortKey] > b[sortKey]) return sortOrder === 'asc' ? 1 : -1;
|
||||||
|
return 0;
|
||||||
|
})
|
||||||
|
.slice((page - 1) * 20, page * 20);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ConfirmDialog
|
<ConfirmDialog
|
||||||
@ -255,22 +274,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="">
|
<tbody class="">
|
||||||
{#each users
|
{#each filteredUsers as user, userIdx}
|
||||||
.filter((user) => {
|
|
||||||
if (search === '') {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
let name = user.name.toLowerCase();
|
|
||||||
const query = search.toLowerCase();
|
|
||||||
return name.includes(query);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.sort((a, b) => {
|
|
||||||
if (a[sortKey] < b[sortKey]) return sortOrder === 'asc' ? -1 : 1;
|
|
||||||
if (a[sortKey] > b[sortKey]) return sortOrder === 'asc' ? 1 : -1;
|
|
||||||
return 0;
|
|
||||||
})
|
|
||||||
.slice((page - 1) * 20, page * 20) as user, userIdx}
|
|
||||||
<tr class="bg-white dark:bg-gray-900 dark:border-gray-850 text-xs">
|
<tr class="bg-white dark:bg-gray-900 dark:border-gray-850 text-xs">
|
||||||
<td class="px-3 py-1 min-w-[7rem] w-28">
|
<td class="px-3 py-1 min-w-[7rem] w-28">
|
||||||
<button
|
<button
|
||||||
|
Loading…
Reference in New Issue
Block a user