From 6e4eb8e648974d178dbe0afca57a5aa4ab4ed6d5 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 18:10:58 +0000 Subject: [PATCH] feat(ui): model_add/reuse_credentials to shadcn Dialog - antd Modal/Button/Tooltip/Typography + @tremor TextInput \u2192 shadcn Dialog/Button/Input + plain styled anchor for Need Help link. - antd Form/Form.Item preserved (parent drives it + rules + initialValue over dynamic credential_values keys). Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- .../model_add/reuse_credentials.tsx | 112 +++++++++++------- 1 file changed, 66 insertions(+), 46 deletions(-) diff --git a/ui/litellm-dashboard/src/components/model_add/reuse_credentials.tsx b/ui/litellm-dashboard/src/components/model_add/reuse_credentials.tsx index e16c0b73ac3..4b5d03b772b 100644 --- a/ui/litellm-dashboard/src/components/model_add/reuse_credentials.tsx +++ b/ui/litellm-dashboard/src/components/model_add/reuse_credentials.tsx @@ -1,12 +1,19 @@ import React from "react"; -import { Form, Button, Tooltip, Typography, Modal } from "antd"; -import { TextInput } from "@tremor/react"; +import { Form } from "antd"; +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { Input } from "@/components/ui/input"; import { CredentialItem } from "../networking"; -const { Title, Link } = Typography; interface ReuseCredentialsModalProps { isVisible: boolean; onCancel: () => void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any onAddCredential: (values: any) => void; existingCredential: CredentialItem | null; setIsCredentialModalOpen: (isVisible: boolean) => void; @@ -21,8 +28,7 @@ const ReuseCredentialsModal: React.FC = ({ }) => { const [form] = Form.useForm(); - console.log(`existingCredential in add credentials tab: ${JSON.stringify(existingCredential)}`); - + // eslint-disable-next-line @typescript-eslint/no-explicit-any const handleSubmit = (values: any) => { onAddCredential(values); form.resetFields(); @@ -30,55 +36,69 @@ const ReuseCredentialsModal: React.FC = ({ }; return ( - { - onCancel(); - form.resetFields(); + onOpenChange={(o) => { + if (!o) { + onCancel(); + form.resetFields(); + } }} - footer={null} - width={600} > -
- {/* Credential Name */} - - - - - {/* Display Credential Values of existingCredential, don't allow user to edit. Credential values is a dictionary */} - {Object.entries(existingCredential?.credential_values || {}).map(([key, value]) => ( - - + + + Reuse Credentials + + + {/* Credential Name */} + + - ))} - {/* Modal Footer */} -
- - Need Help? - + {/* Display Credential Values of existingCredential, don't allow user to edit. */} + {Object.entries(existingCredential?.credential_values || {}).map( + ([key, value]) => ( + + + + ), + )} -
- - + Need Help? + + +
+ + +
-
- -
+ + + ); };