The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
refactor(ui): migrate guardrails-monitor, projects, logs to shadcn (#34606)
yuneng-jiangfd00b98f6444
diff --git a/ui/litellm-dashboard/eslint-suppressions.json b/ui/litellm-dashboard/eslint-suppressions.jsonindex 25778401efa..18dd7c949ec 100644--- a/ui/litellm-dashboard/eslint-suppressions.json+++ b/ui/litellm-dashboard/eslint-suppressions.json@@ -299,9 +299,6 @@}},"src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsx": {- "no-restricted-imports": {- "count": 1- },"react-hooks/set-state-in-effect": {"count": 1}@@ -314,9 +311,6 @@"src/app/(dashboard)/guardrails-monitor/_components/GuardrailDetail.tsx": {"no-nested-ternary": {"count": 3- },- "no-restricted-imports": {- "count": 1}},"src/app/(dashboard)/guardrails-monitor/_components/GuardrailsMonitorView.tsx": {@@ -1447,16 +1441,10 @@},"src/app/(dashboard)/projects/_components/ProjectDetailsPage.tsx": {"no-nested-ternary": {- "count": 3- },- "no-restricted-imports": {- "count": 1+ "count": 2}},"src/app/(dashboard)/projects/_components/ProjectKeysSection.tsx": {- "no-restricted-imports": {- "count": 1- },"react-hooks/set-state-in-effect": {"count": 1}@@ -1487,11 +1475,6 @@"count": 2}},- "src/app/(dashboard)/projects/_components/ProjectsPage.tsx": {- "no-restricted-imports": {- "count": 1- }- },"src/app/(dashboard)/prompts/_components/add_prompt_form.tsx": {"local/filename-pascal-case": {"count": 1@@ -1994,16 +1977,6 @@"count": 1}},- "src/components/DeletedKeysPage/DeletedKeysPage.tsx": {- "no-restricted-imports": {- "count": 1- }- },- "src/components/DeletedTeamsPage/DeletedTeamsPage.tsx": {- "no-restricted-imports": {- "count": 1- }- },"src/components/DeprecationBanner.tsx": {"no-restricted-imports": {"count": 1@@ -3586,11 +3559,6 @@"count": 1}},- "src/components/ui/AntDLoadingSpinner.tsx": {- "no-restricted-imports": {- "count": 1- }- },"src/components/ui/alert-dialog.tsx": {"local/filename-pascal-case": {"count": 1@@ -3799,11 +3767,6 @@"count": 1}},- "src/components/view_logs/AuditLogDrawer/AuditLogDrawer.tsx": {- "no-restricted-imports": {- "count": 1- }- },"src/components/view_logs/CostBreakdownViewer.tsx": {"no-restricted-imports": {"count": 1@@ -3961,9 +3924,6 @@"src/components/view_logs/index.tsx": {"local/filename-pascal-case": {"count": 1- },- "no-restricted-imports": {- "count": 1}},"src/components/view_logs/log_filter_logic.tsx": {diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.test.tsxnew file mode 100644index 00000000000..41aa1087782--- /dev/null+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.test.tsx@@ -0,0 +1,121 @@+import { describe, it, expect, vi, beforeEach } from "vitest";+import userEvent from "@testing-library/user-event";+import { render, screen, waitFor } from "@testing-library/react";+import { EvaluationSettingsModal } from "./EvaluationSettingsModal";++const mockFetchAvailableModels = vi.fn();+vi.mock("@/components/llm_calls/fetch_models", () => ({+ fetchAvailableModels: (...args: unknown[]) => mockFetchAvailableModels(...args),+}));++const modelGroups = [{ model_group: "gpt-5.2" }, { model_group: "claude-sonnet-5" }];++const defaultProps = {+ open: true,+ onClose: vi.fn(),+ guardrailName: "pii-detector",+ accessToken: "test-token",+ onRunEvaluation: vi.fn(),+};++async function selectModel(user: ReturnType<typeof userEvent.setup>, label: string) {+ await user.click(screen.getByRole("combobox"));+ const options = await screen.findAllByText(label);+ await user.click(options[options.length - 1]);+}++describe("EvaluationSettingsModal", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ mockFetchAvailableModels.mockResolvedValue(modelGroups);+ });++ it("should render nothing while closed", () => {+ render(<EvaluationSettingsModal {...defaultProps} open={false} />);+ expect(screen.queryByText("Evaluation Settings")).not.toBeInTheDocument();+ });++ it("should show the title and the guardrail-specific description when open", () => {+ render(<EvaluationSettingsModal {...defaultProps} />);+ expect(screen.getByText("Evaluation Settings")).toBeInTheDocument();+ expect(screen.getByText("Configure AI evaluation for pii-detector")).toBeInTheDocument();+ });++ it("should fall back to a generic description when no guardrail name is given", () => {+ render(<EvaluationSettingsModal {...defaultProps} guardrailName={undefined} />);+ expect(screen.getByText("Configure AI evaluation for re-running on logs")).toBeInTheDocument();+ });++ it("should prefill the prompt and the response schema with their defaults", () => {+ render(<EvaluationSettingsModal {...defaultProps} />);+ expect(screen.getByDisplayValue(/Evaluate whether this guardrail's decision was correct/)).toBeInTheDocument();+ expect(+ screen.getByDisplayValue(/"verdict": "correct" \| "false_positive" \| "false_negative"/),+ ).toBeInTheDocument();+ });++ it("should restore the default prompt when 'Reset to default' is clicked", async () => {+ const user = userEvent.setup();+ render(<EvaluationSettingsModal {...defaultProps} />);++ const promptBox = screen.getByDisplayValue(/Evaluate whether this guardrail's decision was correct/);+ await user.clear(promptBox);+ await user.type(promptBox, "custom prompt");+ expect(screen.getByDisplayValue("custom prompt")).toBeInTheDocument();++ await user.click(screen.getByText("Reset to default"));+ expect(screen.getByDisplayValue(/Evaluate whether this guardrail's decision was correct/)).toBeInTheDocument();+ });++ it("should load the available models with the access token when opened", async () => {+ render(<EvaluationSettingsModal {...defaultProps} />);+ await waitFor(() => expect(mockFetchAvailableModels).toHaveBeenCalledWith("test-token"));+ });++ it("should not load models when there is no access token", () => {+ render(<EvaluationSettingsModal {...defaultProps} accessToken={null} />);+ expect(mockFetchAvailableModels).not.toHaveBeenCalled();+ });++ it("should not run an evaluation while no model is selected", async () => {+ const user = userEvent.setup();+ const onRunEvaluation = vi.fn();+ const onClose = vi.fn();+ render(<EvaluationSettingsModal {...defaultProps} onRunEvaluation={onRunEvaluation} onClose={onClose} />);++ await user.click(screen.getByRole("button", { name: /run evaluation/i }));++ expect(onRunEvaluation).not.toHaveBeenCalled();+ expect(onClose).not.toHaveBeenCalled();+ });++ it("should run the evaluation with the selected model and the current prompt and schema", async () => {+ const user = userEvent.setup();+ const onRunEvaluation = vi.fn();+ const onClose = vi.fn();+ render(<EvaluationSettingsModal {...defaultProps} onRunEvaluation={onRunEvaluation} onClose={onClose} />);++ await waitFor(() => expect(mockFetchAvailableModels).toHaveBeenCalled());+ await selectModel(user, "claude-sonnet-5");+ await user.click(screen.getByRole("button", { name: /run evaluation/i }));++ expect(onRunEvaluation).toHaveBeenCalledWith({+ model: "claude-sonnet-5",+ prompt: expect.stringContaining("Evaluate whether this guardrail's decision was correct"),+ schema: expect.stringContaining('"verdict"'),+ });+ expect(onClose).toHaveBeenCalled();+ });++ it("should close without running when 'Cancel' is clicked", async () => {+ const user = userEvent.setup();+ const onRunEvaluation = vi.fn();+ const onClose = vi.fn();+ render(<EvaluationSettingsModal {...defaultProps} onRunEvaluation={onRunEvaluation} onClose={onClose} />);++ await user.click(screen.getByRole("button", { name: /cancel/i }));++ expect(onClose).toHaveBeenCalled();+ expect(onRunEvaluation).not.toHaveBeenCalled();+ });+});diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsxindex 0edfa65dfe8..900a04e480d 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/EvaluationSettingsModal.tsx@@ -1,7 +1,17 @@-import { CloseOutlined, PlayCircleOutlined } from "@ant-design/icons";-import { Button, Modal, Select, Input } from "antd";-import React, { useEffect, useState } from "react";+import { Play } from "lucide-react";+import React, { useEffect, useMemo, useState } from "react";import { fetchAvailableModels, type ModelGroup } from "@/components/llm_calls/fetch_models";+import { SearchSelect } from "@/components/shared/SearchSelect";+import { Button } from "@/components/ui/button";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+} from "@/components/ui/dialog";+import { Textarea } from "@/components/ui/textarea";const DEFAULT_PROMPT = `Evaluate whether this guardrail's decision was correct.Analyze the user input, the guardrail action taken, and determine if it was appropriate.@@ -73,79 +83,81 @@ export function EvaluationSettingsModal({}};- const modelSelectOptions = modelOptions.map((m) => ({- value: m.model_group,- label: m.model_group,- }));+ const modelSelectOptions = useMemo(+ () => modelOptions.map((m) => ({ value: m.model_group, label: m.model_group })),+ [modelOptions],+ );return (- <Modal- title="Evaluation Settings"- open={open}- onCancel={onClose}- width={640}- footer={null}- closeIcon={<CloseOutlined />}- destroyOnClose- >- <p className="text-sm text-gray-500 mb-4">- {guardrailName- ? `Configure AI evaluation for ${guardrailName}`- : "Configure AI evaluation for re-running on logs"}- </p>+ <Dialog open={open} onOpenChange={(nextOpen) => !nextOpen && onClose()}>+ <DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[640px]">+ <DialogHeader>+ <DialogTitle>Evaluation Settings</DialogTitle>+ <DialogDescription>+ {guardrailName+ ? `Configure AI evaluation for ${guardrailName}`+ : "Configure AI evaluation for re-running on logs"}+ </DialogDescription>+ </DialogHeader>- <div className="space-y-4">- <div>- <div className="flex items-center justify-between mb-1.5">- <label className="text-sm font-medium text-gray-700">Evaluation Prompt</label>- <button type="button" onClick={handleResetPrompt} className="text-xs text-indigo-600 hover:text-indigo-700">- Reset to default- </button>+ <div className="space-y-4">+ <div>+ <div className="mb-1.5 flex items-center justify-between">+ <label htmlFor="evaluation-prompt" className="text-sm font-medium text-foreground">+ Evaluation Prompt+ </label>+ <Button variant="link" size="xs" onClick={handleResetPrompt}>+ Reset to default+ </Button>+ </div>+ <Textarea+ id="evaluation-prompt"+ value={prompt}+ onChange={(e) => setPrompt(e.target.value)}+ rows={6}+ className="field-sizing-fixed font-mono text-sm"+ />+ <p className="mt-1 text-xs text-muted-foreground">+ System prompt sent to the evaluation model. Output is structured via response_format.+ </p></div>- <Input.TextArea- value={prompt}- onChange={(e) => setPrompt(e.target.value)}- rows={6}- className="font-mono text-sm"- />- <p className="text-xs text-gray-400 mt-1">- System prompt sent to the evaluation model. Output is structured via response_format.- </p>- </div>- <div>- <label className="block text-sm font-medium text-gray-700 mb-1.5">Response Schema</label>- <p className="text-xs text-gray-400 mb-1">response_format: json_schema</p>- <Input.TextArea- value={schema}- onChange={(e) => setSchema(e.target.value)}- rows={6}- className="font-mono text-sm"- />- </div>+ <div>+ <label htmlFor="evaluation-schema" className="mb-1.5 block text-sm font-medium text-foreground">+ Response Schema+ </label>+ <p className="mb-1 text-xs text-muted-foreground">response_format: json_schema</p>+ <Textarea+ id="evaluation-schema"+ value={schema}+ onChange={(e) => setSchema(e.target.value)}+ rows={6}+ className="field-sizing-fixed font-mono text-sm"+ />+ </div>- <div>- <label className="block text-sm font-medium text-gray-700 mb-1.5">Model</label>- <Select- placeholder={loadingModels ? "Loading models…" : "Select a model"}- value={model ?? undefined}- onChange={setModel}- options={modelSelectOptions}- style={{ width: "100%" }}- showSearch- optionFilterProp="label"- loading={loadingModels}- notFoundContent={!accessToken ? "Sign in to see models" : "No models available"}- />+ <div>+ <p className="mb-1.5 text-sm font-medium text-foreground">Model</p>+ <SearchSelect+ options={modelSelectOptions}+ value={model ?? undefined}+ onValueChange={(value) => setModel(value || null)}+ placeholder={loadingModels ? "Loading models…" : "Select a model"}+ emptyText={!accessToken ? "Sign in to see models" : "No models available"}+ />+ </div></div>- </div>- <div className="flex items-center justify-end gap-2 mt-6 pt-4 border-t border-gray-100">- <Button onClick={onClose}>Cancel</Button>- <Button type="primary" icon={<PlayCircleOutlined />} onClick={handleRun} disabled={!model}>- Run Evaluation- </Button>- </div>- </Modal>+ <DialogFooter className="border-t border-border pt-4">+ <Button variant="outline" onClick={onClose}>+ Cancel+ </Button>+ <Button onClick={handleRun} disabled={!model}>+ <Play className="size-4" />+ Run Evaluation+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>);}diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailDetail.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailDetail.test.tsxnew file mode 100644index 00000000000..c7567aa80bb--- /dev/null+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailDetail.test.tsx@@ -0,0 +1,145 @@+import { describe, it, expect, vi, beforeEach } from "vitest";+import userEvent from "@testing-library/user-event";+import { render, screen, waitFor } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { GuardrailDetail } from "./GuardrailDetail";++const mockGetGuardrailsUsageDetail = vi.fn();+const mockGetGuardrailsUsageLogs = vi.fn();+vi.mock("@/components/networking", () => ({+ getGuardrailsUsageDetail: (...args: unknown[]) => mockGetGuardrailsUsageDetail(...args),+ getGuardrailsUsageLogs: (...args: unknown[]) => mockGetGuardrailsUsageLogs(...args),+}));++vi.mock("@/components/GuardrailsMonitor/LogViewer", () => ({+ LogViewer: ({ guardrailName }: { guardrailName: string }) => <div data-testid="log-viewer">{guardrailName}</div>,+}));++vi.mock("./EvaluationSettingsModal", () => ({+ EvaluationSettingsModal: ({ open }: { open: boolean }) => (open ? <div data-testid="evaluation-modal" /> : null),+}));++const detail = {+ guardrail_name: "pii-detector",+ description: "Blocks personally identifiable information",+ status: "warning",+ provider: "presidio",+ type: "pii",+ requestsEvaluated: 12345,+ failRate: 20,+ avgScore: 0.4,+ avgLatency: 180,+};++const defaultProps = {+ guardrailId: "pii-detector",+ onBack: vi.fn(),+ accessToken: "test-token",+ startDate: "2026-07-01",+ endDate: "2026-07-24",+};++function renderDetail(props: Partial<typeof defaultProps> = {}) {+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });+ return render(<GuardrailDetail {...defaultProps} {...props} />, {+ wrapper: ({ children }) => <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>,+ });+}++describe("GuardrailDetail", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ mockGetGuardrailsUsageDetail.mockResolvedValue(detail);+ mockGetGuardrailsUsageLogs.mockResolvedValue({ logs: [], total: 0 });+ });++ it("should show a busy indicator while the detail request is in flight", () => {+ mockGetGuardrailsUsageDetail.mockReturnValue(new Promise(() => {}));+ renderDetail();+ expect(document.querySelector('[aria-busy="true"]')).toBeInTheDocument();+ expect(screen.queryByText("pii-detector")).not.toBeInTheDocument();+ });++ it("should show an error message and a way back when the detail request fails", async () => {+ mockGetGuardrailsUsageDetail.mockRejectedValue(new Error("boom"));+ renderDetail();+ expect(await screen.findByText("Failed to load guardrail details.")).toBeInTheDocument();+ expect(screen.getByRole("button", { name: /back to overview/i })).toBeInTheDocument();+ });++ it("should request the detail and the logs for the guardrail and date range", async () => {+ renderDetail();+ await waitFor(() =>+ expect(mockGetGuardrailsUsageDetail).toHaveBeenCalledWith(+ "test-token",+ "pii-detector",+ "2026-07-01",+ "2026-07-24",+ ),+ );+ expect(mockGetGuardrailsUsageLogs).toHaveBeenCalledWith(+ "test-token",+ expect.objectContaining({ guardrailId: "pii-detector", startDate: "2026-07-01", endDate: "2026-07-24" }),+ );+ });++ it("should show the guardrail name, description, provider and capitalised status", async () => {+ renderDetail();+ expect(await screen.findByRole("heading", { name: "pii-detector" })).toBeInTheDocument();+ expect(screen.getByText("Blocks personally identifiable information")).toBeInTheDocument();+ expect(screen.getByText("presidio")).toBeInTheDocument();+ expect(screen.getByText("Warning")).toBeInTheDocument();+ });++ it("should show the usage metrics with the blocked count derived from the fail rate", async () => {+ renderDetail();+ expect(await screen.findByText("12,345")).toBeInTheDocument();+ expect(screen.getByText("20%")).toBeInTheDocument();+ expect(screen.getByText("2,469 blocked")).toBeInTheDocument();+ expect(screen.getByText("180ms")).toBeInTheDocument();+ });++ it("should show a placeholder when no latency has been recorded", async () => {+ mockGetGuardrailsUsageDetail.mockResolvedValue({ ...detail, avgLatency: null });+ renderDetail();+ expect(await screen.findByText("No data")).toBeInTheDocument();+ });++ it("should call onBack when 'Back to Overview' is clicked", async () => {+ const user = userEvent.setup();+ const onBack = vi.fn();+ renderDetail({ onBack });+ await user.click(await screen.findByRole("button", { name: /back to overview/i }));+ expect(onBack).toHaveBeenCalledOnce();+ });++ it("should offer an Overview tab and a Logs tab, with Overview selected first", async () => {+ renderDetail();+ expect(await screen.findByRole("tab", { name: "Overview" })).toHaveAttribute("aria-selected", "true");+ expect(screen.getByRole("tab", { name: "Logs" })).toHaveAttribute("aria-selected", "false");+ });++ it("should select the Logs tab when it is clicked", async () => {+ const user = userEvent.setup();+ renderDetail();+ await user.click(await screen.findByRole("tab", { name: "Logs" }));+ await waitFor(() => expect(screen.getByRole("tab", { name: "Logs" })).toHaveAttribute("aria-selected", "true"));+ expect(screen.getByTestId("log-viewer")).toHaveTextContent("pii-detector");+ });++ it("should keep the evaluation settings modal closed until its button is clicked", async () => {+ const user = userEvent.setup();+ renderDetail();+ await screen.findByRole("heading", { name: "pii-detector" });+ expect(screen.queryByTestId("evaluation-modal")).not.toBeInTheDocument();++ await user.click(screen.getByTitle("Evaluation settings"));+ expect(screen.getByTestId("evaluation-modal")).toBeInTheDocument();+ });++ it("should not request anything without an access token", () => {+ renderDetail({ accessToken: null });+ expect(mockGetGuardrailsUsageDetail).not.toHaveBeenCalled();+ expect(mockGetGuardrailsUsageLogs).not.toHaveBeenCalled();+ });+});diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailDetail.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailDetail.tsxindex 2e007c06744..cd980146d41 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailDetail.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails-monitor/_components/GuardrailDetail.tsx@@ -1,8 +1,12 @@-import { ArrowLeftOutlined, SafetyOutlined, SettingOutlined, WarningOutlined } from "@ant-design/icons";import { useQuery } from "@tanstack/react-query";-import { Button, Col, Row, Spin, Tabs } from "antd";+import { ArrowLeft, Settings, Shield, TriangleAlert } from "lucide-react";import React, { useMemo, useState } from "react";import { getGuardrailsUsageDetail, getGuardrailsUsageLogs } from "@/components/networking";+import { StatusBadge, type StatusTone } from "@/components/shared/table_cells/status_badge";+import { Badge } from "@/components/ui/badge";+import { Button } from "@/components/ui/button";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";+import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";import { EvaluationSettingsModal } from "./EvaluationSettingsModal";import { LogViewer } from "@/components/GuardrailsMonitor/LogViewer";import { MetricCard } from "@/components/GuardrailsMonitor/MetricCard";@@ -16,10 +20,10 @@ interface GuardrailDetailProps {endDate: string;}-const statusColors: Record<string, { bg: string; text: string; dot: string }> = {- healthy: { bg: "bg-green-50", text: "text-green-700", dot: "bg-green-500" },- warning: { bg: "bg-amber-50", text: "text-amber-700", dot: "bg-amber-500" },- critical: { bg: "bg-red-50", text: "text-red-700", dot: "bg-red-500" },+const STATUS_TONE: Record<string, StatusTone> = {+ healthy: "success",+ warning: "warning",+ critical: "error",};export function GuardrailDetail({ guardrailId, onBack, accessToken = null, startDate, endDate }: GuardrailDetailProps) {@@ -87,131 +91,116 @@ export function GuardrailDetail({ guardrailId, onBack, accessToken = null, startavgScore: undefined as number | undefined,avgLatency: undefined as number | undefined,};- const statusStyle = statusColors[data.status] ?? statusColors.healthy;if (detailLoading && !detailData) {return (- <div className="flex items-center justify-center py-12">- <Spin size="large" />+ <div role="status" aria-busy="true" aria-label="Loading" className="flex items-center justify-center py-12">+ <UiLoadingSpinner className="size-8 text-primary" /></div>);}if (detailError && !detailData) {return (<div>- <Button type="link" icon={<ArrowLeftOutlined />} onClick={onBack} className="pl-0 mb-4">+ <Button variant="link" onClick={onBack} className="mb-4 pl-0">+ <ArrowLeft className="size-4" />Back to Overview</Button>- <p className="text-red-600">Failed to load guardrail details.</p>+ <p className="text-destructive">Failed to load guardrail details.</p></div>);}+ const logViewer = (filterAction?: "all") => (+ <LogViewer+ guardrailName={data.name}+ filterAction={filterAction}+ logs={logs}+ logsLoading={logsLoading}+ totalLogs={logsData?.total ?? 0}+ accessToken={accessToken}+ startDate={startDate}+ endDate={endDate}+ />+ );+return (<div><div className="mb-6">- <Button type="link" icon={<ArrowLeftOutlined />} onClick={onBack} className="pl-0 mb-4">+ <Button variant="link" onClick={onBack} className="mb-4 pl-0">+ <ArrowLeft className="size-4" />Back to Overview</Button><div className="flex items-start justify-between"><div>- <div className="flex items-center gap-3 mb-1">- <SafetyOutlined className="text-xl text-gray-400" />- <h1 className="text-xl font-semibold text-gray-900">{data.name}</h1>- <span- className={`inline-flex items-center gap-1.5 px-2.5 py-0.5 text-xs font-medium rounded-full ${statusStyle.bg} ${statusStyle.text}`}- >- <span className={`w-1.5 h-1.5 rounded-full ${statusStyle.dot}`} />- {data.status.charAt(0).toUpperCase() + data.status.slice(1)}- </span>+ <div className="mb-1 flex items-center gap-3">+ <Shield className="size-5 text-muted-foreground" />+ <h1 className="text-xl font-semibold text-foreground">{data.name}</h1>+ <StatusBadge+ tone={STATUS_TONE[data.status] ?? "success"}+ label={data.status.charAt(0).toUpperCase() + data.status.slice(1)}+ /></div>- <p className="text-sm text-gray-500 ml-8">{data.description}</p>+ <p className="ml-8 text-sm text-muted-foreground">{data.description}</p></div><div className="flex items-center gap-2">- <span className="inline-flex items-center px-2.5 py-1 text-xs font-medium rounded-md bg-indigo-50 text-indigo-700 border border-indigo-200">- {data.provider}- </span>+ <Badge variant="outline">{data.provider}</Badge><Button- type="default"- icon={<SettingOutlined />}+ variant="outline"+ size="icon"onClick={() => setEvaluationModalOpen(true)}title="Evaluation settings"- />+ >+ <Settings className="size-4" />+ </Button></div></div></div>- <Tabs- activeKey={activeTab}- onChange={setActiveTab}- items={[- { key: "overview", label: "Overview" },- { key: "logs", label: "Logs" },- ]}- />+ <Tabs value={activeTab} onValueChange={(value) => setActiveTab(value as string)}>+ <TabsList variant="line">+ <TabsTrigger value="overview" className="flex-none">+ Overview+ </TabsTrigger>+ <TabsTrigger value="logs" className="flex-none">+ Logs+ </TabsTrigger>+ </TabsList>- {activeTab === "overview" && (- <div className="space-y-6 mt-4">- <Row gutter={[16, 16]}>- <Col xs={12} md={8}>- <MetricCard label="Requests Evaluated" value={data.requestsEvaluated.toLocaleString()} />- </Col>- <Col xs={12} md={8}>- <MetricCard- label="Fail Rate"- value={`${data.failRate}%`}- valueColor={- data.failRate > 15 ? "text-red-600" : data.failRate > 5 ? "text-amber-600" : "text-green-600"- }- subtitle={`${Math.round((data.requestsEvaluated * data.failRate) / 100).toLocaleString()} blocked`}- icon={data.failRate > 15 ? <WarningOutlined className="text-red-400" /> : undefined}- />- </Col>- <Col xs={12} md={8}>- <MetricCard- label="Avg. latency added"- value={data.avgLatency != null ? `${Math.round(data.avgLatency)}ms` : "—"}- valueColor={- data.avgLatency != null- ? data.avgLatency > 150- ? "text-red-600"- : data.avgLatency > 50- ? "text-amber-600"- : "text-green-600"- : "text-gray-500"- }- subtitle={data.avgLatency != null ? "Per request (avg)" : "No data"}- />- </Col>- </Row>+ <TabsContent value="overview" className="mt-4 space-y-6">+ <div className="grid grid-cols-2 gap-4 md:grid-cols-3">+ <MetricCard label="Requests Evaluated" value={data.requestsEvaluated.toLocaleString()} />+ <MetricCard+ label="Fail Rate"+ value={`${data.failRate}%`}+ valueColor={data.failRate > 15 ? "text-red-600" : data.failRate > 5 ? "text-amber-600" : "text-green-600"}+ subtitle={`${Math.round((data.requestsEvaluated * data.failRate) / 100).toLocaleString()} blocked`}+ icon={data.failRate > 15 ? <TriangleAlert className="size-4 text-red-400" /> : undefined}+ />+ <MetricCard+ label="Avg. latency added"+ value={data.avgLatency != null ? `${Math.round(data.avgLatency)}ms` : "—"}+ valueColor={+ data.avgLatency != null+ ? data.avgLatency > 150+ ? "text-red-600"+ : data.avgLatency > 50+ ? "text-amber-600"+ : "text-green-600"+ : "text-muted-foreground"+ }+ subtitle={data.avgLatency != null ? "Per request (avg)" : "No data"}+ />+ </div>- <LogViewer- guardrailName={data.name}- filterAction="all"- logs={logs}- logsLoading={logsLoading}- totalLogs={logsData?.total ?? 0}- accessToken={accessToken}- startDate={startDate}- endDate={endDate}- />- </div>- )}+ {logViewer("all")}+ </TabsContent>- {activeTab === "logs" && (- <div className="mt-4">- <LogViewer- guardrailName={data.name}- logs={logs}- logsLoading={logsLoading}- totalLogs={logsData?.total ?? 0}- accessToken={accessToken}- startDate={startDate}- endDate={endDate}- />- </div>- )}+ <TabsContent value="logs" className="mt-4">+ {logViewer()}+ </TabsContent>+ </Tabs><EvaluationSettingsModalopen={evaluationModalOpen}diff --git a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectDetailsPage.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectDetailsPage.test.tsxindex 61d42f2aac6..cf6576ce6e9 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectDetailsPage.test.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectDetailsPage.test.tsx@@ -66,10 +66,12 @@ describe("ProjectDetail", () => {});describe("when loading", () => {- it("should show a loading spinner", () => {+ it("should show a busy indicator and neither the project nor the not-found state", () => {mockUseProjectDetails.mockReturnValue({ data: undefined, isLoading: true });renderWithProviders(<ProjectDetail projectId="proj-1" onBack={onBack} />);- expect(screen.getByRole("img", { hidden: true })).toBeInTheDocument();+ expect(document.querySelector('[aria-busy="true"]')).toBeInTheDocument();+ expect(screen.queryByText("Project not found")).not.toBeInTheDocument();+ expect(screen.queryByRole("heading")).not.toBeInTheDocument();});});@@ -126,7 +128,7 @@ describe("ProjectDetail", () => {it("should call onBack when the back button is clicked", async () => {const user = userEvent.setup();renderWithProviders(<ProjectDetail projectId="proj-1" onBack={onBack} />);- await user.click(screen.getByRole("button", { name: "" }));+ await user.click(screen.getAllByRole("button")[0]);expect(onBack).toHaveBeenCalledOnce();});diff --git a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectDetailsPage.tsx b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectDetailsPage.tsxindex fd043031b26..d7a4fce4beb 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectDetailsPage.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectDetailsPage.tsx@@ -1,31 +1,19 @@import { useProjectDetails } from "@/app/(dashboard)/hooks/projects/useProjectDetails";import { useTeam } from "@/app/(dashboard)/hooks/teams/useTeams";-import {- Button,- Card,- Col,- Descriptions,- Empty,- Flex,- Layout,- Progress,- Row,- Spin,- Tag,- theme,- Typography,-} from "antd";-import { LoadingOutlined } from "@ant-design/icons";import { BarChart } from "@/components/shared/charts";import { ArrowLeftIcon, DollarSignIcon, EditIcon, UsersIcon } from "lucide-react";import { useMemo, useState } from "react";import DefaultProxyAdminTag from "@/components/common_components/DefaultProxyAdminTag";+import CopyButton from "@/components/shared/CopyButton";+import { StatusBadge } from "@/components/shared/table_cells/status_badge";+import { Badge } from "@/components/ui/badge";+import { Button } from "@/components/ui/button";+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";+import { Meter, MeterIndicator, MeterTrack } from "@/components/ui/meter";+import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";import { EditProjectModal } from "./ProjectModals/EditProjectModal";import { ProjectKeysSection } from "./ProjectKeysSection";-const { Title, Text } = Typography;-const { Content } = Layout;-interface TeamInfoShape {team_id: string;team_alias?: string;@@ -41,20 +29,20 @@ interface ProjectDetailProps {onBack: () => void;}+const utilisationTone = (percent: number) => (percent >= 90 ? "over" : percent >= 70 ? "warning" : "default");+export function ProjectDetail({ projectId, onBack }: ProjectDetailProps) {const { data: project, isLoading } = useProjectDetails(projectId);const { data: teamData } = useTeam(project?.team_id ?? undefined);// teamInfoCall returns { team_id, team_info: {...}, keys, team_memberships }const teamInfo: TeamInfoShape | undefined = ((teamData as unknown as { team_info?: TeamInfoShape })?.team_info ??teamData) as TeamInfoShape | undefined;- const { token } = theme.useToken();const [isEditModalVisible, setIsEditModalVisible] = useState(false);const spend = project?.spend ?? 0;const maxBudget = project?.litellm_budget_table?.max_budget ?? null;const hasLimit = maxBudget != null && maxBudget > 0;const spendPercent = hasLimit ? Math.min((spend / maxBudget) * 100, 100) : 0;- const spendColor = spendPercent >= 90 ? "#f5222d" : spendPercent >= 70 ? "#faad14" : "#52c41a";const modelSpendData = useMemo(() => {const raw = (project?.model_spend ?? {}) as Record<string, number>;@@ -65,123 +53,126 @@ export function ProjectDetail({ projectId, onBack }: ProjectDetailProps) {if (isLoading) {return (- <Content- style={{- padding: token.paddingLG,- paddingInline: token.paddingLG * 2,- }}- >- <Flex justify="center" align="center" style={{ minHeight: 300 }}>- <Spin indicator={<LoadingOutlined spin />} size="large" />- </Flex>- </Content>+ <div className="p-6 px-12">+ <div+ role="status"+ aria-busy="true"+ aria-label="Loading"+ className="flex min-h-[300px] items-center justify-center"+ >+ <UiLoadingSpinner className="size-8 text-primary" />+ </div>+ </div>);}if (!project) {return (- <Content- style={{- padding: token.paddingLG,- paddingInline: token.paddingLG * 2,- }}- >- <Button icon={<ArrowLeftIcon size={16} />} onClick={onBack} type="text" style={{ marginBottom: 16 }} />- <Empty description="Project not found" />- </Content>+ <div className="p-6 px-12">+ <Button variant="ghost" size="icon" aria-label="Back" onClick={onBack} className="mb-4">+ <ArrowLeftIcon className="size-4" />+ </Button>+ <p className="py-8 text-center text-sm text-muted-foreground">Project not found</p>+ </div>);}return (- <Content style={{ padding: token.paddingLG, paddingInline: token.paddingLG * 2 }}>- {/* Header */}- <div- style={{- display: "flex",- justifyContent: "space-between",- alignItems: "center",- marginBottom: 24,- }}- >- <div style={{ display: "flex", alignItems: "center", gap: 16 }}>- <Button icon={<ArrowLeftIcon size={16} />} onClick={onBack} type="text" />+ <div className="p-6 px-12">+ <div className="mb-6 flex items-center justify-between">+ <div className="flex items-center gap-4">+ <Button variant="ghost" size="icon" aria-label="Back" onClick={onBack}>+ <ArrowLeftIcon className="size-4" />+ </Button><div>- <Flex align="center" gap={8}>- <Title level={2} style={{ margin: 0 }}>+ <div className="flex items-center gap-2">+ <h1 className="text-xl font-semibold tracking-tight text-foreground">{project.project_alias ?? project.project_id}- </Title>- <Tag color={project.blocked ? "red" : "green"}>{project.blocked ? "Blocked" : "Active"}</Tag>- </Flex>- <Text type="secondary">- ID: <Text copyable>{project.project_id}</Text>- </Text>+ </h1>+ <StatusBadge+ tone={project.blocked ? "error" : "success"}+ label={project.blocked ? "Blocked" : "Active"}+ />+ </div>+ <div className="flex items-center gap-1 text-sm text-muted-foreground">+ <span>ID: {project.project_id}</span>+ <CopyButton value={project.project_id} label="Copy project ID" />+ </div></div></div>- <Button type="primary" icon={<EditIcon size={16} />} onClick={() => setIsEditModalVisible(true)}>+ <Button onClick={() => setIsEditModalVisible(true)}>+ <EditIcon className="size-4" />Edit Project</Button></div>- {/* Project Details */}- <Row style={{ marginBottom: 24 }}>- <Card>- <Descriptions title="Project Details" column={1}>- <Descriptions.Item label="Description">{project.description || "\u2014"}</Descriptions.Item>- <Descriptions.Item label="Created">+ <Card className="mb-6">+ <CardHeader>+ <CardTitle>Project Details</CardTitle>+ </CardHeader>+ <CardContent>+ <dl className="grid grid-cols-[max-content_1fr] gap-x-4 gap-y-2 text-sm">+ <dt className="text-muted-foreground">Description</dt>+ <dd className="text-foreground">{project.description || "—"}</dd>+ <dt className="text-muted-foreground">Created</dt>+ <dd className="flex items-center gap-1 text-foreground">{new Date(project.created_at).toLocaleString()}{project.created_by && (- <Text>- {"by"} + <>+ <span>by</span><DefaultProxyAdminTag userId={project.created_by} />- </Text>+ </>)}- </Descriptions.Item>- <Descriptions.Item label="Last Updated">+ </dd>+ <dt className="text-muted-foreground">Last Updated</dt>+ <dd className="flex items-center gap-1 text-foreground">{new Date(project.updated_at).toLocaleString()}{project.updated_by && (- <Text>- {"by"} + <>+ <span>by</span><DefaultProxyAdminTag userId={project.updated_by} />- </Text>+ </>)}- </Descriptions.Item>- </Descriptions>- </Card>- </Row>+ </dd>+ </dl>+ </CardContent>+ </Card>- {/* Spend / Budget */}- <Row gutter={[16, 16]} style={{ marginBottom: 24 }}>- <Col xs={24} lg={8}>- <Card- title={- <Flex align="center" gap={8}>- <DollarSignIcon size={16} />- Budget- </Flex>- }- style={{ height: "100%" }}- >- <Flex vertical gap={16}>+ <div className="mb-6 grid grid-cols-1 gap-4 lg:grid-cols-3">+ <Card className="h-full">+ <CardHeader>+ <CardTitle className="flex items-center gap-2">+ <DollarSignIcon className="size-4" />+ Budget+ </CardTitle>+ </CardHeader>+ <CardContent className="flex flex-col gap-4">+ <div>+ <p className="text-[28px] leading-none font-medium text-foreground">${spend.toFixed(2)}</p>+ <p className="mt-1 text-sm text-muted-foreground">+ {hasLimit ? `of $${maxBudget.toFixed(2)} budget` : "No budget limit"}+ </p>+ </div>+ {hasLimit && (<div>- <Text strong style={{ fontSize: 28, lineHeight: 1 }}>- ${spend.toFixed(2)}- </Text>- <br />- <Text type="secondary">{hasLimit ? `of $${maxBudget.toFixed(2)} budget` : "No budget limit"}</Text>+ <Meter value={Math.round(spendPercent * 10) / 10}>+ <MeterTrack>+ <MeterIndicator tone={utilisationTone(spendPercent)} />+ </MeterTrack>+ </Meter>+ <p className="mt-1 text-xs text-muted-foreground">+ {(Math.round(spendPercent * 10) / 10).toFixed(1)}% utilized+ </p></div>- {hasLimit && (- <div>- <Progress percent={Math.round(spendPercent * 10) / 10} strokeColor={spendColor} showInfo={false} />- <Text type="secondary" style={{ fontSize: 12 }}>- {(Math.round(spendPercent * 10) / 10).toFixed(1)}% utilized- </Text>- </div>- )}- </Flex>- </Card>- </Col>- <Col xs={24} lg={16}>- <Card title="Spend by Model" style={{ height: "100%" }}>+ )}+ </CardContent>+ </Card>++ <Card className="h-full lg:col-span-2">+ <CardHeader>+ <CardTitle>Spend by Model</CardTitle>+ </CardHeader>+ <CardContent>{modelSpendData.length > 0 ? (<BarChartdata={modelSpendData}@@ -195,123 +186,98 @@ export function ProjectDetail({ projectId, onBack }: ProjectDetailProps) {style={{ height: Math.max(modelSpendData.length * 40, 120) }}/>) : (- <Empty description="No model spend recorded yet" image={Empty.PRESENTED_IMAGE_SIMPLE} />+ <p className="py-8 text-center text-sm text-muted-foreground">No model spend recorded yet</p>)}- </Card>- </Col>- </Row>+ </CardContent>+ </Card>+ </div>++ <div className="mb-6 grid grid-cols-1 gap-4 lg:grid-cols-2">+ <ProjectKeysSection projectId={projectId} />- {/* Keys & Team */}- <Row gutter={[16, 16]} style={{ marginBottom: 24 }}>- <Col xs={24} lg={12}>- <ProjectKeysSection projectId={projectId} />- </Col>- <Col xs={24} lg={12}>- <Card- title={- <Flex align="center" gap={8}>- <UsersIcon size={16} />- Team- </Flex>- }- style={{ height: "100%" }}- >+ <Card className="h-full">+ <CardHeader>+ <CardTitle className="flex items-center gap-2">+ <UsersIcon className="size-4" />+ Team+ </CardTitle>+ </CardHeader>+ <CardContent>{teamInfo ? ((() => {const teamBudget = teamInfo.max_budget ?? null;const teamSpend = teamInfo.spend ?? 0;const teamHasLimit = teamBudget != null && teamBudget > 0;const teamPercent = teamHasLimit ? Math.min((teamSpend / teamBudget) * 100, 100) : 0;- const teamColor = teamPercent >= 90 ? "#f5222d" : teamPercent >= 70 ? "#faad14" : "#52c41a";return (- <Flex vertical gap={12}>- {/* Team name + ID */}+ <div className="flex flex-col gap-3"><div>- <Text strong style={{ fontSize: 16 }}>- {teamInfo.team_alias || teamInfo.team_id}- </Text>- <br />- <Text type="secondary" style={{ fontSize: 12 }}>- ID:{" "}- <Text copyable style={{ fontSize: 12 }}>- {teamInfo.team_id}- </Text>- </Text>+ <p className="text-base font-medium text-foreground">{teamInfo.team_alias || teamInfo.team_id}</p>+ <div className="flex items-center gap-1 text-xs text-muted-foreground">+ <span>ID: {teamInfo.team_id}</span>+ <CopyButton value={teamInfo.team_id} label="Copy team ID" />+ </div></div>- {/* Models */}<div>- <Text type="secondary" style={{ fontSize: 12, display: "block", marginBottom: 4 }}>- Models- </Text>+ <p className="mb-1 text-xs text-muted-foreground">Models</p>{(teamInfo.models?.length ?? 0) > 0 ? (- <Flex wrap="wrap" gap={4} style={{ maxHeight: 60, overflow: "hidden" }}>+ <div className="flex max-h-[60px] flex-wrap gap-1 overflow-hidden">{teamInfo.models?.map((m: string) => (- <Tag key={m} style={{ margin: 0 }}>+ <Badge key={m} variant="outline">{m}- </Tag>+ </Badge>))}- </Flex>+ </div>) : (- <Text type="secondary">All models</Text>+ <p className="text-sm text-muted-foreground">All models</p>)}</div>- {/* Budget + Spend compact */}<div>- <Flex justify="space-between" align="center" style={{ marginBottom: 2 }}>- <Text type="secondary" style={{ fontSize: 12 }}>- Spend- </Text>- <Text style={{ fontSize: 12 }}>+ <div className="mb-0.5 flex items-center justify-between">+ <span className="text-xs text-muted-foreground">Spend</span>+ <span className="text-xs text-foreground">${teamSpend.toFixed(2)}- {teamHasLimit ? (- <Text type="secondary" style={{ fontSize: 12 }}>- {" "}- / ${teamBudget.toFixed(2)}- </Text>- ) : (- <Text type="secondary" style={{ fontSize: 12 }}>- {" "}- (Unlimited)- </Text>- )}- </Text>- </Flex>+ <span className="text-muted-foreground">+ {teamHasLimit ? ` / $${teamBudget.toFixed(2)}` : " (Unlimited)"}+ </span>+ </span>+ </div>{teamHasLimit && (- <Progress- percent={Math.round(teamPercent * 10) / 10}- strokeColor={teamColor}- size="small"- showInfo={false}- />+ <Meter value={Math.round(teamPercent * 10) / 10}>+ <MeterTrack>+ <MeterIndicator tone={utilisationTone(teamPercent)} />+ </MeterTrack>+ </Meter>)}</div>- {/* Members */}- <Flex justify="space-between">- <Text type="secondary" style={{ fontSize: 12 }}>- Members- </Text>- <Text style={{ fontSize: 12 }}>{teamInfo.members_with_roles?.length ?? 0}</Text>- </Flex>- </Flex>+ <div className="flex items-center justify-between">+ <span className="text-xs text-muted-foreground">Members</span>+ <span className="text-xs text-foreground">{teamInfo.members_with_roles?.length ?? 0}</span>+ </div>+ </div>);})()) : project.team_id ? (- <Flex justify="center" align="center" style={{ padding: 16 }}>- <Spin indicator={<LoadingOutlined spin />} size="small" />- </Flex>+ <div+ role="status"+ aria-busy="true"+ aria-label="Loading team"+ className="flex items-center justify-center p-4"+ >+ <UiLoadingSpinner className="size-5 text-muted-foreground" />+ </div>) : (- <Empty description="No team assigned" image={Empty.PRESENTED_IMAGE_SIMPLE} />+ <p className="py-8 text-center text-sm text-muted-foreground">No team assigned</p>)}- </Card>- </Col>- </Row>+ </CardContent>+ </Card>+ </div>- {/* Edit Modal */}<EditProjectModal isOpen={isEditModalVisible} project={project} onClose={() => setIsEditModalVisible(false)} />- </Content>+ </div>);}diff --git a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectKeysSection.tsx b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectKeysSection.tsxindex 4266b238e21..c618dd6b105 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectKeysSection.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectKeysSection.tsx@@ -1,8 +1,9 @@import { useKeys } from "@/app/(dashboard)/hooks/keys/useKeys";import { PaginationState } from "@tanstack/react-table";-import { Card, Flex, Input } from "antd";-import { KeyIcon, SearchIcon } from "lucide-react";+import { KeyIcon, SearchIcon, X } from "lucide-react";import { useEffect, useState } from "react";+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";+import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group";import { ProjectKeysTable } from "./ProjectKeysTable";interface ProjectKeysSectionProps {@@ -28,33 +29,41 @@ export function ProjectKeysSection({ projectId }: ProjectKeysSectionProps) {const totalCount = data?.total_count ?? 0;return (- <Card- title={- <Flex align="center" gap={8}>- <KeyIcon size={16} />+ <Card className="h-full">+ <CardHeader>+ <CardTitle className="flex items-center gap-2">+ <KeyIcon className="size-4" />Keys- </Flex>- }- style={{ height: "100%" }}- >- <Flex justify="flex-start" align="center" style={{ marginBottom: 12 }}>- <Input- prefix={<SearchIcon size={14} />}- placeholder="Filter by key name..."- style={{ maxWidth: 220 }}- value={keyAlias}- onChange={(e) => setKeyAlias(e.target.value)}- allowClear- size="small"+ </CardTitle>+ </CardHeader>+ <CardContent>+ <div className="mb-3 flex items-center">+ <InputGroup className="max-w-[220px]">+ <InputGroupAddon>+ <SearchIcon className="size-3.5 text-muted-foreground" />+ </InputGroupAddon>+ <InputGroupInput+ placeholder="Filter by key name..."+ value={keyAlias}+ onChange={(e) => setKeyAlias(e.target.value)}+ />+ {keyAlias && (+ <InputGroupAddon align="inline-end">+ <InputGroupButton size="icon-xs" aria-label="Clear key filter" onClick={() => setKeyAlias("")}>+ <X />+ </InputGroupButton>+ </InputGroupAddon>+ )}+ </InputGroup>+ </div>+ <ProjectKeysTable+ keys={keys}+ totalCount={totalCount}+ isLoading={isLoading}+ pagination={pagination}+ onPaginationChange={setPagination}/>- </Flex>- <ProjectKeysTable- keys={keys}- totalCount={totalCount}- isLoading={isLoading}- pagination={pagination}- onPaginationChange={setPagination}- />+ </CardContent></Card>);}diff --git a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectsPage.tsx b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectsPage.tsxindex a7e2f70198f..91ad9f847f5 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectsPage.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/projects/_components/ProjectsPage.tsx@@ -1,19 +1,16 @@import { useProjects } from "@/app/(dashboard)/hooks/projects/useProjects";import { useTeams } from "@/app/(dashboard)/hooks/teams/useTeams";-import { PlusOutlined } from "@ant-design/icons";-import { Button, Flex, Input, Layout, Space, theme, Typography } from "antd";-import { SearchIcon } from "lucide-react";+import { Plus, SearchIcon, X } from "lucide-react";import { parseAsString, useQueryState } from "nuqs";import { useMemo, useState } from "react";+import { PageHeader } from "@/components/shared/PageHeader";+import { Button } from "@/components/ui/button";+import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group";import { CreateProjectModal } from "./ProjectModals/CreateProjectModal";import { ProjectDetail } from "./ProjectDetailsPage";import { ProjectsTable } from "./ProjectsTable";-const { Title, Text } = Typography;-const { Content } = Layout;-export function ProjectsPage() {- const { token } = theme.useToken();const { data: projects, isLoading } = useProjects();const { data: teams, isLoading: isTeamsLoading } = useTeams();@@ -57,29 +54,39 @@ export function ProjectsPage() {}return (- <Content style={{ padding: token.paddingLG, paddingInline: token.paddingLG * 2 }}>- <Flex justify="space-between" align="center" style={{ marginBottom: 16 }}>- <Space direction="vertical" size={0}>- <Title level={2} style={{ margin: 0 }}>- Projects- </Title>- <Text type="secondary">Manage projects within your teams</Text>- </Space>- <Button type="primary" icon={<PlusOutlined />} onClick={() => setIsCreateModalVisible(true)}>- Create Project- </Button>- </Flex>-- <Flex align="center" style={{ marginBottom: 12 }}>- <Input- prefix={<SearchIcon size={16} />}- placeholder="Search projects by name, ID, description, or team..."- style={{ maxWidth: 400 }}- value={searchText}- onChange={(e) => setSearchText(e.target.value)}- allowClear+ <div className="p-6 px-12">+ <div className="mb-4">+ <PageHeader+ title="Projects"+ subtitle="Manage projects within your teams"+ actions={+ <Button onClick={() => setIsCreateModalVisible(true)}>+ <Plus className="size-4" />+ Create Project+ </Button>+ }/>- </Flex>+ </div>++ <div className="mb-3 flex items-center">+ <InputGroup className="max-w-[400px]">+ <InputGroupAddon>+ <SearchIcon className="size-4 text-muted-foreground" />+ </InputGroupAddon>+ <InputGroupInput+ placeholder="Search projects by name, ID, description, or team..."+ value={searchText}+ onChange={(e) => setSearchText(e.target.value)}+ />+ {searchText && (+ <InputGroupAddon align="inline-end">+ <InputGroupButton size="icon-xs" aria-label="Clear search" onClick={() => setSearchText("")}>+ <X />+ </InputGroupButton>+ </InputGroupAddon>+ )}+ </InputGroup>+ </div><ProjectsTableprojects={filteredProjects}@@ -91,6 +98,6 @@ export function ProjectsPage() {/><CreateProjectModal isOpen={isCreateModalVisible} onClose={() => setIsCreateModalVisible(false)} />- </Content>+ </div>);}diff --git a/ui/litellm-dashboard/src/components/DeletedKeysPage/DeletedKeysPage.test.tsx b/ui/litellm-dashboard/src/components/DeletedKeysPage/DeletedKeysPage.test.tsxindex 05361f1c858..ee2f42ad85b 100644--- a/ui/litellm-dashboard/src/components/DeletedKeysPage/DeletedKeysPage.test.tsx+++ b/ui/litellm-dashboard/src/components/DeletedKeysPage/DeletedKeysPage.test.tsx@@ -92,6 +92,15 @@ it("should render DeletedKeysPage component", () => {expect(screen.getByText("Test Key Alias")).toBeInTheDocument();});+it("should show the enterprise notice for a non-premium user", () => {+ renderWithProviders(<DeletedKeysPage />);++ expect(screen.getByText("Coming soon to Enterprise")).toBeInTheDocument();+ expect(+ screen.getByText("Deleted key auditing is graduating from beta into our Enterprise audit & compliance suite."),+ ).toBeInTheDocument();+});+it("should show skeleton rows while the initial load is pending", () => {mockUseDeletedKeys.mockReturnValue({data: undefined,diff --git a/ui/litellm-dashboard/src/components/DeletedKeysPage/DeletedKeysPage.tsx b/ui/litellm-dashboard/src/components/DeletedKeysPage/DeletedKeysPage.tsxindex 78d500f5e64..0af668b5e9c 100644--- a/ui/litellm-dashboard/src/components/DeletedKeysPage/DeletedKeysPage.tsx+++ b/ui/litellm-dashboard/src/components/DeletedKeysPage/DeletedKeysPage.tsx@@ -1,7 +1,8 @@"use client";import { useState } from "react";import { PaginationState } from "@tanstack/react-table";-import { Alert } from "antd";+import { Info } from "lucide-react";+import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";import { useDeletedKeys } from "@/app/(dashboard)/hooks/keys/useKeys";import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";import { DeletedKeysTable } from "./DeletedKeysTable/DeletedKeysTable";@@ -15,13 +16,13 @@ export default function DeletedKeysPage() {return (<div className="flex flex-col gap-4">{!premiumUser && (- <Alert- type="info"- banner- showIcon- message="Coming soon to Enterprise"- description="Deleted key auditing is graduating from beta into our Enterprise audit & compliance suite."- />+ <Alert>+ <Info />+ <AlertTitle>Coming soon to Enterprise</AlertTitle>+ <AlertDescription>+ Deleted key auditing is graduating from beta into our Enterprise audit & compliance suite.+ </AlertDescription>+ </Alert>)}<DeletedKeysTablekeys={keysData?.keys || []}diff --git a/ui/litellm-dashboard/src/components/DeletedTeamsPage/DeletedTeamsPage.test.tsx b/ui/litellm-dashboard/src/components/DeletedTeamsPage/DeletedTeamsPage.test.tsxindex a3eceb4b458..6bf5d1caf61 100644--- a/ui/litellm-dashboard/src/components/DeletedTeamsPage/DeletedTeamsPage.test.tsx+++ b/ui/litellm-dashboard/src/components/DeletedTeamsPage/DeletedTeamsPage.test.tsx@@ -42,6 +42,15 @@ it("should render DeletedTeamsPage component", () => {expect(screen.getByText("Test Team")).toBeInTheDocument();});+it("should show the enterprise notice for a non-premium user", () => {+ renderWithProviders(<DeletedTeamsPage />);++ expect(screen.getByText("Coming soon to Enterprise")).toBeInTheDocument();+ expect(+ screen.getByText("Deleted team auditing is graduating from beta into our Enterprise audit & compliance suite."),+ ).toBeInTheDocument();+});+it("should show skeleton rows while the initial load is pending", () => {mockUseDeletedTeams.mockReturnValue({data: undefined,diff --git a/ui/litellm-dashboard/src/components/DeletedTeamsPage/DeletedTeamsPage.tsx b/ui/litellm-dashboard/src/components/DeletedTeamsPage/DeletedTeamsPage.tsxindex 0265a3b623e..eab150d6ab5 100644--- a/ui/litellm-dashboard/src/components/DeletedTeamsPage/DeletedTeamsPage.tsx+++ b/ui/litellm-dashboard/src/components/DeletedTeamsPage/DeletedTeamsPage.tsx@@ -1,5 +1,6 @@"use client";-import { Alert } from "antd";+import { Info } from "lucide-react";+import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";import { useDeletedTeams } from "@/app/(dashboard)/hooks/teams/useTeams";import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";import { DeletedTeamsTable } from "./DeletedTeamsTable/DeletedTeamsTable";@@ -11,13 +12,13 @@ export default function DeletedTeamsPage() {return (<div className="flex flex-col gap-4">{!premiumUser && (- <Alert- type="info"- banner- showIcon- message="Coming soon to Enterprise"- description="Deleted team auditing is graduating from beta into our Enterprise audit & compliance suite."- />+ <Alert>+ <Info />+ <AlertTitle>Coming soon to Enterprise</AlertTitle>+ <AlertDescription>+ Deleted team auditing is graduating from beta into our Enterprise audit & compliance suite.+ </AlertDescription>+ </Alert>)}<DeletedTeamsTable teams={teamsData || []} isLoading={isLoading} /></div>diff --git a/ui/litellm-dashboard/src/components/ui/AntDLoadingSpinner.test.tsx b/ui/litellm-dashboard/src/components/ui/AntDLoadingSpinner.test.tsxdeleted file mode 100644index 8148537aeb1..00000000000--- a/ui/litellm-dashboard/src/components/ui/AntDLoadingSpinner.test.tsx+++ /dev/null@@ -1,56 +0,0 @@-import { render, screen } from "@testing-library/react";-import { describe, expect, it, vi } from "vitest";--// Mock antd Spin component-vi.mock("antd", () => ({- Spin: ({ indicator, size, ...props }: any) => (- <div data-testid="spin" data-size={size} {...props}>- {indicator}- </div>- ),-}));--// Mock the icon-vi.mock("@ant-design/icons", () => ({- LoadingOutlined: ({ style, spin, ...props }: any) => (- <span data-testid="loading-icon" data-spin={spin} style={style} {...props} />- ),-}));--import { AntDLoadingSpinner } from "./AntDLoadingSpinner";--describe("AntDLoadingSpinner", () => {- it("renders without props", () => {- render(<AntDLoadingSpinner />);- expect(screen.getByTestId("spin")).toBeInTheDocument();- expect(screen.getByTestId("loading-icon")).toBeInTheDocument();- });-- it("passes size prop to Spin", () => {- render(<AntDLoadingSpinner size="large" />);- expect(screen.getByTestId("spin")).toHaveAttribute("data-size", "large");- });-- it("passes small size to Spin", () => {- render(<AntDLoadingSpinner size="small" />);- expect(screen.getByTestId("spin")).toHaveAttribute("data-size", "small");- });-- it("applies custom fontSize to the icon", () => {- render(<AntDLoadingSpinner fontSize={32} />);- const icon = screen.getByTestId("loading-icon");- expect(icon).toHaveStyle({ fontSize: "32px" });- });-- it("does not set style when fontSize is not provided", () => {- render(<AntDLoadingSpinner />);- const icon = screen.getByTestId("loading-icon");- expect(icon.style.fontSize).toBe("");- });-- it("sets spin attribute on icon", () => {- render(<AntDLoadingSpinner />);- const icon = screen.getByTestId("loading-icon");- expect(icon).toHaveAttribute("data-spin", "true");- });-});diff --git a/ui/litellm-dashboard/src/components/ui/AntDLoadingSpinner.tsx b/ui/litellm-dashboard/src/components/ui/AntDLoadingSpinner.tsxdeleted file mode 100644index 9e90f77584a..00000000000--- a/ui/litellm-dashboard/src/components/ui/AntDLoadingSpinner.tsx+++ /dev/null@@ -1,12 +0,0 @@-import { Spin } from "antd";-import { LoadingOutlined } from "@ant-design/icons";--interface AntDLoadingSpinnerProps {- size?: "small" | "default" | "large";- fontSize?: number;-}--export function AntDLoadingSpinner({ size, fontSize }: AntDLoadingSpinnerProps) {- const indicator = <LoadingOutlined style={fontSize ? { fontSize } : undefined} spin />;- return <Spin indicator={indicator} size={size} />;-}diff --git a/ui/litellm-dashboard/src/components/view_logs/AuditLogDrawer/AuditLogDrawer.test.tsx b/ui/litellm-dashboard/src/components/view_logs/AuditLogDrawer/AuditLogDrawer.test.tsxnew file mode 100644index 00000000000..8d9a292c13c--- /dev/null+++ b/ui/litellm-dashboard/src/components/view_logs/AuditLogDrawer/AuditLogDrawer.test.tsx@@ -0,0 +1,134 @@+import { describe, it, expect, vi, beforeEach } from "vitest";+import userEvent from "@testing-library/user-event";+import { render, screen, waitFor, within } from "@testing-library/react";+import moment from "moment";+import { AuditLogDrawer } from "./AuditLogDrawer";+import { AuditLogEntry } from "../AuditLogsTableColumns";++vi.mock("../../common_components/DefaultProxyAdminTag", () => ({+ default: ({ userId }: { userId: string }) => <span>{userId}</span>,+}));++const baseLog: AuditLogEntry = {+ id: "audit-1",+ updated_at: "2026-07-20T10:30:00Z",+ changed_by: "user-1",+ changed_by_api_key: "hashed-key-abc",+ action: "updated",+ table_name: "LiteLLM_TeamTable",+ object_id: "team-42",+ before_value: { max_budget: 10, tpm_limit: 100 },+ updated_values: { max_budget: 25, tpm_limit: 100 },+};++const defaultProps = { open: true, onClose: vi.fn(), log: baseLog };++function blockNamed(label: string) {+ const heading = screen.getByText(label);+ const block = heading.closest("div")?.parentElement;+ if (!block) throw new Error(`no block for ${label}`);+ return block as HTMLElement;+}++describe("AuditLogDrawer", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ });++ it("should render nothing when there is no log", () => {+ const { container } = render(<AuditLogDrawer {...defaultProps} log={null} />);+ expect(container).toBeEmptyDOMElement();+ expect(screen.queryByText("Details")).not.toBeInTheDocument();+ });++ it("should show the action and the local timestamp in the header", () => {+ render(<AuditLogDrawer {...defaultProps} />);+ expect(screen.getByText("updated")).toBeInTheDocument();+ expect(screen.getByText(moment.utc(baseLog.updated_at).local().format("MMM D, YYYY HH:mm:ss"))).toBeInTheDocument();+ });++ it("should show the friendly table name for a known table", () => {+ render(<AuditLogDrawer {...defaultProps} />);+ expect(screen.getByText("Table")).toBeInTheDocument();+ expect(screen.getByText("Teams")).toBeInTheDocument();+ });++ it("should fall back to the raw table name when it is not mapped", () => {+ render(<AuditLogDrawer {...defaultProps} log={{ ...baseLog, table_name: "LiteLLM_SomethingElse" }} />);+ expect(screen.getByText("LiteLLM_SomethingElse")).toBeInTheDocument();+ });++ it("should show the object id, the actor and the api key hash", () => {+ render(<AuditLogDrawer {...defaultProps} />);+ expect(screen.getByText("team-42")).toBeInTheDocument();+ expect(screen.getByText("user-1")).toBeInTheDocument();+ expect(screen.getByText("hashed-key-abc")).toBeInTheDocument();+ });++ it("should show a placeholder when the log has no api key hash", () => {+ render(<AuditLogDrawer {...defaultProps} log={{ ...baseLog, changed_by_api_key: "" }} />);+ expect(screen.getByText("API Key (Hash)")).toBeInTheDocument();+ expect(screen.queryByText("hashed-key-abc")).not.toBeInTheDocument();+ });++ it("should call onClose when the close control is used", async () => {+ const user = userEvent.setup();+ const onClose = vi.fn();+ render(<AuditLogDrawer {...defaultProps} onClose={onClose} />);+ await user.click(screen.getByRole("button", { name: /close/i }));+ expect(onClose).toHaveBeenCalledOnce();+ });++ it("should show only the fields that changed in the before and after blocks", () => {+ render(<AuditLogDrawer {...defaultProps} />);++ expect(within(blockNamed("Before")).getByText(/"max_budget": 10/)).toBeInTheDocument();+ expect(within(blockNamed("After")).getByText(/"max_budget": 25/)).toBeInTheDocument();+ expect(screen.queryByText(/tpm_limit/)).not.toBeInTheDocument();+ });++ it("should note when an update has no differing fields", () => {+ render(<AuditLogDrawer {...defaultProps} log={{ ...baseLog, before_value: { a: 1 }, updated_values: { a: 1 } }} />);+ expect(screen.getAllByText(/No differing fields detected/).length).toBeGreaterThan(0);+ });++ it("should show N/A for a side with no values on a create", () => {+ render(+ <AuditLogDrawer+ {...defaultProps}+ log={{ ...baseLog, action: "created", before_value: {}, updated_values: { team_alias: "new team" } }}+ />,+ );+ expect(within(blockNamed("Before")).getByText("N/A")).toBeInTheDocument();+ expect(within(blockNamed("After")).getByText(/"team_alias": "new team"/)).toBeInTheDocument();+ });++ it("should render key-table updates as labelled plain text rather than json", () => {+ render(+ <AuditLogDrawer+ {...defaultProps}+ log={{+ ...baseLog,+ table_name: "LiteLLM_VerificationToken",+ before_value: { spend: 1, max_budget: 10 },+ updated_values: { spend: 2, max_budget: 10 },+ }}+ />,+ );+ expect(within(blockNamed("Before")).getByText("$1.000000")).toBeInTheDocument();+ expect(within(blockNamed("After")).getByText("$2.000000")).toBeInTheDocument();+ expect(screen.queryByText(/"spend"/)).not.toBeInTheDocument();+ });++ it("should copy the json of a block to the clipboard", async () => {+ const user = userEvent.setup();+ const writeText = vi.fn().mockResolvedValue(undefined);+ Object.defineProperty(navigator, "clipboard", { value: { writeText }, configurable: true });+ Object.defineProperty(window, "isSecureContext", { value: true, configurable: true });++ render(<AuditLogDrawer {...defaultProps} />);+ await user.click(within(blockNamed("Before")).getByTitle("Copy JSON"));++ await waitFor(() => expect(writeText).toHaveBeenCalledWith(JSON.stringify({ max_budget: 10 }, null, 2)));+ });+});diff --git a/ui/litellm-dashboard/src/components/view_logs/AuditLogDrawer/AuditLogDrawer.tsx b/ui/litellm-dashboard/src/components/view_logs/AuditLogDrawer/AuditLogDrawer.tsxindex 81759c80ab6..ca73fa1b85c 100644--- a/ui/litellm-dashboard/src/components/view_logs/AuditLogDrawer/AuditLogDrawer.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/AuditLogDrawer/AuditLogDrawer.tsx@@ -1,11 +1,12 @@-import { Drawer, Tag, Typography } from "antd";-import { CloseOutlined, CopyOutlined, CheckOutlined } from "@ant-design/icons";+import { Check, Copy } from "lucide-react";import { useState, useCallback } from "react";import moment from "moment";-import { AuditLogEntry } from "../AuditLogsTableColumns";+import { AuditLogEntry, AUDIT_TABLE_NAME_DISPLAY } from "../AuditLogsTableColumns";import DefaultProxyAdminTag from "../../common_components/DefaultProxyAdminTag";--const { Text } = Typography;+import CopyButton from "@/components/shared/CopyButton";+import { StatusBadge, type StatusTone } from "@/components/shared/table_cells/status_badge";+import { Button } from "@/components/ui/button";+import { Sheet, SheetContent, SheetTitle } from "@/components/ui/sheet";interface AuditLogDrawerProps {open: boolean;@@ -13,19 +14,11 @@ interface AuditLogDrawerProps {log: AuditLogEntry | null;}-const TABLE_NAME_DISPLAY: Record<string, string> = {- LiteLLM_VerificationToken: "Keys",- LiteLLM_TeamTable: "Teams",- LiteLLM_UserTable: "Users",- LiteLLM_OrganizationTable: "Organizations",- LiteLLM_ProxyModelTable: "Models",-};--const ACTION_COLOR: Record<string, string> = {- created: "green",- updated: "blue",- deleted: "red",- rotated: "orange",+const ACTION_TONE: Record<string, StatusTone> = {+ created: "success",+ updated: "info",+ deleted: "error",+ rotated: "warning",};function CopyableJsonBlock({ label, value }: { label: string; value: Record<string, any> }) {@@ -55,18 +48,14 @@ function CopyableJsonBlock({ label, value }: { label: string; value: Record<stri}, [value]);return (- <div className="bg-white rounded-sm border overflow-hidden">- <div className="flex justify-between items-center px-3 py-2 border-b bg-gray-50">- <span className="text-xs font-semibold text-gray-600">{label}</span>- <button- onClick={handleCopy}- className="p-1 hover:bg-gray-200 rounded-sm text-gray-500 hover:text-gray-700 transition-colors"- title="Copy JSON"- >- {copied ? <CheckOutlined className="text-green-600" /> : <CopyOutlined />}- </button>+ <div className="overflow-hidden rounded-sm border border-border bg-card">+ <div className="flex items-center justify-between border-b border-border bg-muted px-3 py-2">+ <span className="text-xs font-semibold text-muted-foreground">{label}</span>+ <Button variant="ghost" size="icon-xs" onClick={handleCopy} title="Copy JSON" aria-label="Copy JSON">+ {copied ? <Check className="text-green-600" /> : <Copy />}+ </Button></div>- <pre className="p-3 bg-white text-xs font-mono overflow-auto max-h-96 whitespace-pre-wrap break-all m-0">+ <pre className="m-0 max-h-96 overflow-auto bg-card p-3 font-mono text-xs break-all whitespace-pre-wrap">{JSON.stringify(value, null, 2)}</pre></div>@@ -76,8 +65,8 @@ function CopyableJsonBlock({ label, value }: { label: string; value: Record<strifunction MetadataRow({ label, value }: { label: string; value: React.ReactNode }) {return (<div className="flex items-start gap-2 py-1.5">- <span className="text-xs text-gray-500 w-36 shrink-0">{label}</span>- <span className="text-xs text-gray-900 break-all">{value}</span>+ <span className="w-36 shrink-0 text-xs text-muted-foreground">{label}</span>+ <span className="text-xs break-all text-foreground">{value}</span></div>);}@@ -127,11 +116,11 @@ function DiffSection({ log }: { log: AuditLogEntry }) {const renderValue = (label: string, value: Record<string, any> | null | undefined) => {if (!value || Object.keys(value).length === 0) {return (- <div className="bg-white rounded-sm border overflow-hidden">- <div className="flex items-center px-3 py-2 border-b bg-gray-50">- <span className="text-xs font-semibold text-gray-600">{label}</span>+ <div className="overflow-hidden rounded-sm border border-border bg-card">+ <div className="flex items-center border-b border-border bg-muted px-3 py-2">+ <span className="text-xs font-semibold text-muted-foreground">{label}</span></div>- <p className="px-3 py-3 text-xs text-gray-400 italic m-0">N/A</p>+ <p className="m-0 px-3 py-3 text-xs text-muted-foreground italic">N/A</p></div>);}@@ -142,24 +131,24 @@ function DiffSection({ log }: { log: AuditLogEntry }) {const hasOnlyKnown = Object.keys(value).every((k) => knownKeyFields.includes(k));if (hasOnlyKnown && !("note" in value)) {return (- <div className="bg-white rounded-sm border overflow-hidden">- <div className="flex items-center px-3 py-2 border-b bg-gray-50">- <span className="text-xs font-semibold text-gray-600">{label}</span>+ <div className="overflow-hidden rounded-sm border border-border bg-card">+ <div className="flex items-center border-b border-border bg-muted px-3 py-2">+ <span className="text-xs font-semibold text-muted-foreground">{label}</span></div>- <div className="px-3 py-3 space-y-1 text-xs">+ <div className="space-y-1 px-3 py-3 text-xs">{value.token !== undefined && (<p>- <span className="text-gray-500">Token:</span> {value.token ?? "N/A"}+ <span className="text-muted-foreground">Token:</span> {value.token ?? "N/A"}</p>)}{value.spend !== undefined && (<p>- <span className="text-gray-500">Spend:</span> ${Number(value.spend).toFixed(6)}+ <span className="text-muted-foreground">Spend:</span> ${Number(value.spend).toFixed(6)}</p>)}{value.max_budget !== undefined && (<p>- <span className="text-gray-500">Max Budget:</span> ${Number(value.max_budget).toFixed(6)}+ <span className="text-muted-foreground">Max Budget:</span> ${Number(value.max_budget).toFixed(6)}</p>)}</div>@@ -172,7 +161,7 @@ function DiffSection({ log }: { log: AuditLogEntry }) {};return (- <div className="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">+ <div className="mt-4 grid grid-cols-1 gap-4 md:grid-cols-2">{renderValue("Before", displayBefore)}{renderValue("After", displayAfter)}</div>@@ -182,71 +171,52 @@ function DiffSection({ log }: { log: AuditLogEntry }) {export function AuditLogDrawer({ open, onClose, log }: AuditLogDrawerProps) {if (!log) return null;- const tableDisplay = TABLE_NAME_DISPLAY[log.table_name] ?? log.table_name;- const actionColor = ACTION_COLOR[log.action] ?? "default";+ const tableDisplay = AUDIT_TABLE_NAME_DISPLAY[log.table_name] ?? log.table_name;return (- <Drawer- placement="right"- width="60%"- open={open}- onClose={onClose}- closable={false}- mask={true}- maskClosable={true}- styles={{ body: { padding: 0, display: "flex", flexDirection: "column" }, header: { display: "none" } }}- >- {/* Header */}- <div className="flex items-center justify-between px-6 py-4 border-b bg-white shrink-0">- <div className="flex items-center gap-3">- <Tag color={actionColor} className="capitalize m-0">- {log.action}- </Tag>- <span className="text-sm text-gray-500">+ <Sheet open={open} onOpenChange={(nextOpen) => !nextOpen && onClose()}>+ <SheetContent side="right" className="w-[60%] gap-0 overflow-y-auto p-0 sm:max-w-none">+ <SheetTitle className="sr-only">Audit log details</SheetTitle>++ <div className="flex shrink-0 items-center gap-3 border-b border-border bg-card px-6 py-4">+ <StatusBadge tone={ACTION_TONE[log.action] ?? "neutral"} label={log.action} />+ <span className="text-sm text-muted-foreground">{moment.utc(log.updated_at).local().format("MMM D, YYYY HH:mm:ss")}</span></div>- <button- onClick={onClose}- className="w-8 h-8 flex items-center justify-center rounded-sm hover:bg-gray-100 text-gray-500"- aria-label="Close"- >- <CloseOutlined />- </button>- </div>- {/* Body */}- <div className="px-6 py-5">- {/* Metadata */}- <div className="bg-gray-50 border rounded-lg p-4 mb-5">- <p className="text-xs font-semibold text-gray-700 mb-2 uppercase tracking-wide">Details</p>- <MetadataRow label="Table" value={tableDisplay} />- <MetadataRow- label="Object ID"- value={- <Text copyable className="font-mono text-xs">- {log.object_id}- </Text>- }- />- <MetadataRow label="Changed By" value={<DefaultProxyAdminTag userId={log.changed_by} />} />- <MetadataRow- label="API Key (Hash)"- value={- log.changed_by_api_key ? (- <Text copyable className="font-mono text-xs break-all">- {log.changed_by_api_key}- </Text>- ) : (- "—"- )- }- />- </div>+ <div className="px-6 py-5">+ <div className="mb-5 rounded-lg border border-border bg-muted p-4">+ <p className="mb-2 text-xs font-semibold tracking-wide text-foreground uppercase">Details</p>+ <MetadataRow label="Table" value={tableDisplay} />+ <MetadataRow+ label="Object ID"+ value={+ <span className="inline-flex items-center gap-1 font-mono text-xs">+ {log.object_id}+ <CopyButton value={log.object_id} label="Copy object ID" />+ </span>+ }+ />+ <MetadataRow label="Changed By" value={<DefaultProxyAdminTag userId={log.changed_by} />} />+ <MetadataRow+ label="API Key (Hash)"+ value={+ log.changed_by_api_key ? (+ <span className="inline-flex items-center gap-1 font-mono text-xs break-all">+ {log.changed_by_api_key}+ <CopyButton value={log.changed_by_api_key} label="Copy API key hash" />+ </span>+ ) : (+ "—"+ )+ }+ />+ </div>- {/* Diff */}- <DiffSection log={log} />- </div>- </Drawer>+ <DiffSection log={log} />+ </div>+ </SheetContent>+ </Sheet>);}diff --git a/ui/litellm-dashboard/src/components/view_logs/index.test.tsx b/ui/litellm-dashboard/src/components/view_logs/index.test.tsxindex ed55d73c62e..70a259ae9eb 100644--- a/ui/litellm-dashboard/src/components/view_logs/index.test.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/index.test.tsx@@ -183,14 +183,14 @@ describe("SpendLogsTable", () => {useAuthorizedMock.mockReturnValue({ userRole: "Admin" });renderWithProviders(<SpendLogsTable {...defaultProps} accessToken={null} />);- expect(document.querySelector(".ant-spin")).toBeInTheDocument();+ expect(document.querySelector('[aria-busy="true"]')).toBeInTheDocument();expect(screen.queryByRole("tab", { name: "Request Logs" })).not.toBeInTheDocument();});it("renders the tabs (no spinner) once all credentials are present", () => {renderAs("Admin");- expect(document.querySelector(".ant-spin")).not.toBeInTheDocument();+ expect(document.querySelector('[aria-busy="true"]')).not.toBeInTheDocument();expect(screen.getByRole("tab", { name: "Request Logs" })).toBeInTheDocument();});});diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsxindex 7269564dcec..f20285dffa0 100644--- a/ui/litellm-dashboard/src/components/view_logs/index.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx@@ -1,11 +1,11 @@import { useState } from "react";-import { Tab, TabGroup, TabList, TabPanel, TabPanels } from "@tremor/react";import useCan from "@/app/(dashboard)/hooks/useCan";import DeletedKeysPage from "../DeletedKeysPage/DeletedKeysPage";import DeletedTeamsPage from "../DeletedTeamsPage/DeletedTeamsPage";import AuditLogsPanel from "./AuditLogsPanel";import RequestLogsPanel from "./RequestLogsPanel";-import { AntDLoadingSpinner } from "../ui/AntDLoadingSpinner";+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";+import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";interface SpendLogsTableProps {accessToken: string | null;@@ -34,8 +34,8 @@ export default function SpendLogsTable({ accessToken, token, userRole, userID, pif (!accessToken || !token || !userRole || !userID) {return (- <div className="flex items-center justify-center h-64">- <AntDLoadingSpinner size="large" />+ <div role="status" aria-busy="true" aria-label="Loading" className="flex h-64 items-center justify-center">+ <UiLoadingSpinner className="size-8 text-primary" /></div>);}@@ -78,19 +78,21 @@ export default function SpendLogsTable({ accessToken, token, userRole, userID, p};return (- <div className="w-full p-6 overflow-x-hidden box-border">- <TabGroup defaultIndex={0} onIndexChange={(index) => setActiveTab(tabs[index].id)}>- <TabList>+ <div className="box-border w-full overflow-x-hidden p-6">+ <Tabs value={activeTab} onValueChange={(value) => setActiveTab(value as LogsTabId)}>+ <TabsList variant="line">{tabs.map((tab) => (- <Tab key={tab.id}>{tab.label}</Tab>+ <TabsTrigger key={tab.id} value={tab.id} className="flex-none">+ {tab.label}+ </TabsTrigger>))}- </TabList>- <TabPanels>- {tabs.map((tab) => (- <TabPanel key={tab.id}>{renderPanel(tab.id)}</TabPanel>- ))}- </TabPanels>- </TabGroup>+ </TabsList>+ {tabs.map((tab) => (+ <TabsContent key={tab.id} value={tab.id} keepMounted>+ {renderPanel(tab.id)}+ </TabsContent>+ ))}+ </Tabs></div>);}