diff --git a/ui/litellm-dashboard/.eslintrc.json b/ui/litellm-dashboard/.eslintrc.json index a12b1aa7a88..d388b772045 100644 --- a/ui/litellm-dashboard/.eslintrc.json +++ b/ui/litellm-dashboard/.eslintrc.json @@ -78,6 +78,7 @@ "src/components/AIHub/UsefulLinksManagement.tsx", "src/components/vector_store_management/VectorStoreTable.tsx", "src/components/vector_store_management/vector_store_info.tsx", + "src/components/vector_store_management/DocumentsTable.tsx", "src/components/permissions/VectorStorePermissions.tsx", "src/components/permissions/AgentPermissions.tsx", "src/components/permissions/MCPServerPermissions.tsx", diff --git a/ui/litellm-dashboard/src/components/vector_store_management/DocumentsTable.tsx b/ui/litellm-dashboard/src/components/vector_store_management/DocumentsTable.tsx index c1ce57ad335..03b9838d74a 100644 --- a/ui/litellm-dashboard/src/components/vector_store_management/DocumentsTable.tsx +++ b/ui/litellm-dashboard/src/components/vector_store_management/DocumentsTable.tsx @@ -1,7 +1,15 @@ import React from "react"; -import { Table, Badge, Tooltip } from "antd"; +import { Table } from "antd"; +import { Badge } from "@/components/ui/badge"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { cn } from "@/lib/utils"; import MessageManager from "@/components/molecules/message_manager"; -import { EyeOutlined, CopyOutlined, DeleteOutlined } from "@ant-design/icons"; +import { Copy, Eye, Trash2 } from "lucide-react"; import { DocumentUpload } from "./types"; interface DocumentsTableProps { @@ -9,22 +17,43 @@ interface DocumentsTableProps { onRemove: (uid: string) => void; } -const DocumentsTable: React.FC = ({ documents, onRemove }) => { +const DocumentsTable: React.FC = ({ + documents, + onRemove, +}) => { const handleCopyId = (uid: string) => { navigator.clipboard.writeText(uid); MessageManager.success("Document ID copied to clipboard"); }; const getStatusBadge = (status: DocumentUpload["status"]) => { - const statusConfig = { - uploading: { color: "blue", text: "Uploading" }, - done: { color: "green", text: "Ready" }, - error: { color: "red", text: "Error" }, - removed: { color: "default", text: "Removed" }, + const statusConfig: Record< + DocumentUpload["status"], + { className: string; text: string } + > = { + uploading: { + className: + "bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300", + text: "Uploading", + }, + done: { + className: + "bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300", + text: "Ready", + }, + error: { + className: + "bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-300", + text: "Error", + }, + removed: { + className: "bg-muted text-muted-foreground", + text: "Removed", + }, }; const config = statusConfig[status]; - return ; + return {config.text}; }; const formatFileSize = (bytes?: number) => { @@ -42,7 +71,11 @@ const DocumentsTable: React.FC = ({ documents, onRemove }) render: (name: string, record: DocumentUpload) => (
{name} - {record.size && ({formatFileSize(record.size)})} + {record.size && ( + + ({formatFileSize(record.size)}) + + )}
), }, @@ -57,26 +90,53 @@ const DocumentsTable: React.FC = ({ documents, onRemove }) title: "Actions", key: "actions", width: 120, - render: (_: any, record: DocumentUpload) => ( + render: (_: unknown, record: DocumentUpload) => (
- - console.log("View", record)} - /> - - - handleCopyId(record.uid)} - /> - - - onRemove(record.uid)} - /> - + + + + + + View details + + + + + + + + Copy ID + + + + + + + + Remove + +
), }, @@ -89,7 +149,8 @@ const DocumentsTable: React.FC = ({ documents, onRemove }) rowKey="uid" pagination={false} locale={{ - emptyText: "No documents uploaded yet. Upload documents above to get started.", + emptyText: + "No documents uploaded yet. Upload documents above to get started.", }} size="small" />