From 5e8b9f7a4f769198d5dbd5876d5f7f96c15fdeaa Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 14:59:28 +0000 Subject: [PATCH] feat(ui): common_components/user_search_modal to shadcn Dialog - antd Modal/Button/Tooltip + @ant-design UserAddOutlined \u2192 shadcn Dialog/Button/Tooltip + lucide UserPlus. - antd Form/Select with onSearch/onSelect preserved (debounced server fetch inside the Form.Item container). Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- .../common_components/user_search_modal.tsx | 162 +++++++++++------- 1 file changed, 101 insertions(+), 61 deletions(-) diff --git a/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx b/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx index 866d7cbec7f..fc15a4ca2a0 100644 --- a/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx +++ b/ui/litellm-dashboard/src/components/common_components/user_search_modal.tsx @@ -1,6 +1,19 @@ import { useState, useCallback } from "react"; -import { Modal, Form, Button, Select, Tooltip } from "antd"; -import { UserAddOutlined } from "@ant-design/icons"; +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Form, Select } from "antd"; +import { UserPlus } from "lucide-react"; import debounce from "lodash/debounce"; import { userFilterUICall } from "@/components/networking"; interface User { @@ -94,7 +107,12 @@ const UserSearchModal: React.FC = ({ }; const debouncedSearch = useCallback( - debounce((text: string, fieldName: "user_email" | "user_id") => fetchUsers(text, fieldName), 300), + debounce( + (text: string, fieldName: "user_email" | "user_id") => + fetchUsers(text, fieldName), + 300, + ), + // eslint-disable-next-line react-hooks/exhaustive-deps [], ); @@ -128,68 +146,90 @@ const UserSearchModal: React.FC = ({ }; return ( - - - form={form} - onFinish={handleSubmit} - labelCol={{ span: 8 }} - wrapperCol={{ span: 16 }} - labelAlign="left" - initialValues={{ - role: defaultRole, - }} - > - - handleSearch(value, "user_email")} + onSelect={(value, option) => + handleSelect(value, option as UserOption) + } + options={selectedField === "user_email" ? userOptions : []} + loading={loading} + allowClear + data-testid="member-email-search" + /> + -
OR
+
OR
- - handleSearch(value, "user_id")} + onSelect={(value, option) => + handleSelect(value, option as UserOption) + } + options={selectedField === "user_id" ? userOptions : []} + loading={loading} + allowClear + /> + - - - + + + -
- -
- -
+
+ +
+ + + ); };