From 9a56e58bd54b2bfe11104e80c602493d720ff6be Mon Sep 17 00:00:00 2001 From: kamtschatka Date: Sat, 19 Oct 2024 23:48:14 +0200 Subject: feature: Allow reseting user password, change their roles and create new users. Fixes #495 (#567) * How do I set the variable "user" or "system" for AI inference #262 changed from system to user * Make Myself an Admin #560 added user management functionality to the admin page * A bunch of UI fixes and simplifications --------- Co-authored-by: Mohamed Bassem --- apps/web/components/dashboard/admin/UserList.tsx | 49 ++++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) (limited to 'apps/web/components/dashboard/admin/UserList.tsx') diff --git a/apps/web/components/dashboard/admin/UserList.tsx b/apps/web/components/dashboard/admin/UserList.tsx index 65bf4068..2937df28 100644 --- a/apps/web/components/dashboard/admin/UserList.tsx +++ b/apps/web/components/dashboard/admin/UserList.tsx @@ -1,6 +1,7 @@ "use client"; -import { ActionButton } from "@/components/ui/action-button"; +import { ActionButtonWithTooltip } from "@/components/ui/action-button"; +import { ButtonWithTooltip } from "@/components/ui/button"; import LoadingSpinner from "@/components/ui/spinner"; import { Table, @@ -12,9 +13,13 @@ import { } from "@/components/ui/table"; import { toast } from "@/components/ui/use-toast"; import { api } from "@/lib/trpc"; -import { Trash } from "lucide-react"; +import { Check, KeyRound, Pencil, Trash, UserPlus, X } from "lucide-react"; import { useSession } from "next-auth/react"; +import AddUserDialog from "./AddUserDialog"; +import ChangeRoleDialog from "./ChangeRoleDialog"; +import ResetPasswordDialog from "./ResetPasswordDialog"; + function toHumanReadableSize(size: number) { const sizes = ["Bytes", "KB", "MB", "GB", "TB"]; if (size === 0) return "0 Bytes"; @@ -49,7 +54,14 @@ export default function UsersSection() { return ( <> -
Users List
+
+ Users List + + + + + +
@@ -58,7 +70,8 @@ export default function UsersSection() { Num Bookmarks Asset Sizes Role - Action + Local User + Actions {users.users.map((u) => ( @@ -72,15 +85,37 @@ export default function UsersSection() { {toHumanReadableSize(userStats[u.id].assetSizes)} {u.role} - - + {u.localUser ? : } + + + deleteUser({ userId: u.id })} loading={isDeletionPending} disabled={session!.user.id == u.id} > - + + + + + + + + + + + ))} -- cgit v1.2.3-70-g09d2