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): move the root-level dashboard components onto shadcn primitives
Yuneng Jiang15a331f6df90
diff --git a/ui/litellm-dashboard/eslint-suppressions.json b/ui/litellm-dashboard/eslint-suppressions.jsonindex 5e322598a10..2e72df1225b 100644--- a/ui/litellm-dashboard/eslint-suppressions.json+++ b/ui/litellm-dashboard/eslint-suppressions.json@@ -1784,11 +1784,6 @@"count": 1}},- "src/components/DebugWarningBanner.tsx": {- "no-restricted-imports": {- "count": 1- }- },"src/components/DeprecationBanner.tsx": {"no-restricted-imports": {"count": 1@@ -1840,11 +1835,6 @@"count": 1}},- "src/components/LicenseExpiryBanner.tsx": {- "no-restricted-imports": {- "count": 1- }- },"src/components/ModelSelect/ModelSelect.tsx": {"no-restricted-imports": {"count": 1@@ -2696,9 +2686,6 @@"src/components/logging_settings_view.tsx": {"local/filename-pascal-case": {"count": 1- },- "no-restricted-imports": {- "count": 1}},"src/components/mcp_server_management/MCPServerSelector.tsx": {@@ -2764,18 +2751,12 @@"src/components/model_filters.tsx": {"local/filename-pascal-case": {"count": 1- },- "no-restricted-imports": {- "count": 1}},"src/components/model_group_alias_settings.tsx": {"local/filename-pascal-case": {"count": 1},- "no-restricted-imports": {- "count": 1- },"react-hooks/set-state-in-effect": {"count": 1}@@ -2837,9 +2818,6 @@"src/components/navbar.tsx": {"local/filename-pascal-case": {"count": 1- },- "no-restricted-imports": {- "count": 1}},"src/components/networking.tsx": {@@ -2865,17 +2843,11 @@"src/components/object_permissions_view.tsx": {"local/filename-pascal-case": {"count": 1- },- "no-restricted-imports": {- "count": 1}},"src/components/onboarding_link.tsx": {"local/filename-pascal-case": {"count": 1- },- "no-restricted-imports": {- "count": 2}},"src/components/organisms/RegenerateKeyModal.tsx": {@@ -3486,9 +3458,6 @@"local/filename-pascal-case": {"count": 1},- "no-restricted-imports": {- "count": 1- },"prefer-const": {"count": 1},diff --git a/ui/litellm-dashboard/src/components/DebugWarningBanner.tsx b/ui/litellm-dashboard/src/components/DebugWarningBanner.tsxindex 94474e78b14..9591fe4bb1f 100644--- a/ui/litellm-dashboard/src/components/DebugWarningBanner.tsx+++ b/ui/litellm-dashboard/src/components/DebugWarningBanner.tsx@@ -1,7 +1,8 @@"use client";import React from "react";-import { Alert } from "antd";+import { TriangleAlert } from "lucide-react";+import { Alert, AlertDescription, AlertTitle } from "@/components/shared/Alert";import { useHealthReadinessDetails } from "@/app/(dashboard)/hooks/healthReadiness/useHealthReadinessDetails";interface DebugWarningBannerProps {@@ -17,19 +18,14 @@ export const DebugWarningBanner: React.FC<DebugWarningBannerProps> = ({ accessTo}return (- <Alert- message="Performance Warning: Detailed Debug Mode Active"- description={- <>- Detailed debug logging (<code>LITELLM_LOG=DEBUG</code>) is currently enabled. This mode logs extensive- diagnostic information and will significantly degrade performance. It should only be used for troubleshooting- and disabled in production environments.- </>- }- type="warning"- showIcon- banner- style={{ marginBottom: 0, borderRadius: 0 }}- />+ <Alert variant="warning" className="rounded-none border-x-0 border-t-0">+ <TriangleAlert className="size-4" aria-hidden />+ <AlertTitle>Performance Warning: Detailed Debug Mode Active</AlertTitle>+ <AlertDescription>+ Detailed debug logging (<code>LITELLM_LOG=DEBUG</code>) is currently enabled. This mode logs extensive+ diagnostic information and will significantly degrade performance. It should only be used for troubleshooting+ and disabled in production environments.+ </AlertDescription>+ </Alert>);};diff --git a/ui/litellm-dashboard/src/components/LicenseExpiryBanner.test.tsx b/ui/litellm-dashboard/src/components/LicenseExpiryBanner.test.tsxindex d6b419ace7c..627d108e65f 100644--- a/ui/litellm-dashboard/src/components/LicenseExpiryBanner.test.tsx+++ b/ui/litellm-dashboard/src/components/LicenseExpiryBanner.test.tsx@@ -42,18 +42,22 @@ describe("LicenseExpiryBannerView", () => {expect(container).toBeEmptyDOMElement();});- it("shows a dismissible amber warning within 30 days", () => {+ it("shows a dismissible warning within 30 days", () => {const { container } = render(<LicenseExpiryBannerView licenseInfo={licenseWith(daysFromNow(20))} />);+ expect(screen.getByRole("alert")).toBeInTheDocument();+ expect(container.querySelector(".lucide-triangle-alert")).toBeInTheDocument();expect(screen.getByText(/expires in 20 days/)).toBeInTheDocument();- expect(container.querySelector(".ant-alert-warning")).toBeInTheDocument();- expect(screen.queryByRole("button")).toBeInTheDocument();+ expect(screen.getByText(/Renew before it lapses to keep enterprise features/)).toBeInTheDocument();+ expect(screen.getByRole("button", { name: /close/i })).toBeInTheDocument();expect(screen.getByRole("link", { name: "[email protected]" })).toHaveAttribute("href", "mailto:[email protected]");});- it("shows a non-dismissible red critical alert within 7 days", () => {+ it("shows a non-dismissible critical alert within 7 days", () => {const { container } = render(<LicenseExpiryBannerView licenseInfo={licenseWith(daysFromNow(5))} />);+ expect(screen.getByRole("alert")).toBeInTheDocument();+ expect(container.querySelector(".lucide-circle-alert")).toBeInTheDocument();expect(screen.getByText(/expires in 5 days/)).toBeInTheDocument();- expect(container.querySelector(".ant-alert-error")).toBeInTheDocument();+ expect(screen.getByText(/Renew now to avoid losing enterprise features/)).toBeInTheDocument();expect(screen.queryByRole("button")).not.toBeInTheDocument();});@@ -62,18 +66,19 @@ describe("LicenseExpiryBannerView", () => {expect(screen.getByText(/expires today/)).toBeInTheDocument();});- it("shows a non-dismissible red expired alert stating features are disabled", () => {+ it("shows a non-dismissible expired alert stating features are disabled", () => {const { container } = render(<LicenseExpiryBannerView licenseInfo={licenseWith(daysFromNow(-3))} />);+ expect(screen.getByRole("alert")).toBeInTheDocument();+ expect(container.querySelector(".lucide-circle-alert")).toBeInTheDocument();expect(screen.getByText(/expired on/)).toBeInTheDocument();expect(screen.getByText(/features are now disabled/i)).toBeInTheDocument();- expect(container.querySelector(".ant-alert-error")).toBeInTheDocument();expect(screen.queryByRole("button")).not.toBeInTheDocument();});it("hides the warning after dismissal and stays hidden within the session", () => {const expiration = daysFromNow(20);const { unmount } = render(<LicenseExpiryBannerView licenseInfo={licenseWith(expiration)} />);- fireEvent.click(screen.getByRole("button"));+ fireEvent.click(screen.getByRole("button", { name: /close/i }));expect(screen.queryByText(/expires in 20 days/)).not.toBeInTheDocument();unmount();diff --git a/ui/litellm-dashboard/src/components/LicenseExpiryBanner.tsx b/ui/litellm-dashboard/src/components/LicenseExpiryBanner.tsxindex c3b20b5fac0..5867a45bc31 100644--- a/ui/litellm-dashboard/src/components/LicenseExpiryBanner.tsx+++ b/ui/litellm-dashboard/src/components/LicenseExpiryBanner.tsx@@ -1,7 +1,9 @@"use client";import React, { useState } from "react";-import { Alert } from "antd";+import { CircleAlert, TriangleAlert, X } from "lucide-react";+import { Alert, AlertAction, AlertDescription, AlertTitle } from "@/components/shared/Alert";+import { Button } from "@/components/ui/button";import { LicenseInfo } from "@/components/networking";import { useLicenseInfo } from "@/app/(dashboard)/hooks/license/useLicenseInfo";import { formatExpiryDate, getDaysUntilExpiration, getLicenseExpiryTier } from "@/utils/licenseUtils";@@ -76,16 +78,22 @@ export const LicenseExpiryBannerView: React.FC<LicenseExpiryBannerViewProps> = (};return (- <Alert- message={message}- description={description}- type={tier === "warning" ? "warning" : "error"}- showIcon- banner- closable={isDismissible}- onClose={handleClose}- style={{ marginBottom: 0, borderRadius: 0 }}- />+ <Alert variant={tier === "warning" ? "warning" : "error"} className="rounded-none border-x-0 border-t-0">+ {tier === "warning" ? (+ <TriangleAlert className="size-4" aria-hidden />+ ) : (+ <CircleAlert className="size-4" aria-hidden />+ )}+ <AlertTitle>{message}</AlertTitle>+ <AlertDescription>{description}</AlertDescription>+ {isDismissible && (+ <AlertAction>+ <Button variant="ghost" size="icon-sm" aria-label="Close" onClick={handleClose}>+ <X className="size-4" />+ </Button>+ </AlertAction>+ )}+ </Alert>);};diff --git a/ui/litellm-dashboard/src/components/logging_settings_view.tsx b/ui/litellm-dashboard/src/components/logging_settings_view.tsxindex 97eca9d6247..ac3d688308d 100644--- a/ui/litellm-dashboard/src/components/logging_settings_view.tsx+++ b/ui/litellm-dashboard/src/components/logging_settings_view.tsx@@ -1,5 +1,5 @@import React from "react";-import { Tag } from "antd";+import { Badge } from "@/components/ui/badge";import { CogIcon, BanIcon } from "@heroicons/react/outline";import { callbackInfo, callback_map, reverse_callback_map } from "./callback_info_helpers";import { Logo } from "@/components/molecules/logo/Logo";@@ -29,16 +29,16 @@ export function LoggingSettingsView({return callbackDisplayName || callbackName;};- const getEventTypeColor = (eventType: string): string | undefined => {+ const getEventTypeVariant = (eventType: string): React.ComponentProps<typeof Badge>["variant"] => {switch (eventType) {case "success":- return "green";+ return "default";case "failure":- return "red";+ return "destructive";case "success_and_failure":- return "blue";+ return "secondary";default:- return undefined;+ return "outline";}};@@ -62,7 +62,7 @@ export function LoggingSettingsView({<div className="flex items-center gap-2"><CogIcon className="h-4 w-4 text-blue-600" /><span className="font-semibold text-gray-900">Logging Integrations</span>- <Tag color="blue">{loggingConfigs.length}</Tag>+ <Badge variant="secondary">{loggingConfigs.length}</Badge></div>{loggingConfigs.length > 0 ? (@@ -88,7 +88,9 @@ export function LoggingSettingsView({</span></div></div>- <Tag color={getEventTypeColor(config.callback_type)}>{getEventTypeLabel(config.callback_type)}</Tag>+ <Badge variant={getEventTypeVariant(config.callback_type)}>+ {getEventTypeLabel(config.callback_type)}+ </Badge></div>);})}@@ -106,7 +108,7 @@ export function LoggingSettingsView({<div className="flex items-center gap-2"><BanIcon className="h-4 w-4 text-red-600" /><span className="font-semibold text-gray-900">Disabled Callbacks</span>- <Tag color="red">{disabledCallbacks.length}</Tag>+ <Badge variant="destructive">{disabledCallbacks.length}</Badge></div>{disabledCallbacks.length > 0 ? (@@ -131,7 +133,7 @@ export function LoggingSettingsView({<span className="block text-xs text-red-600">Disabled for this key</span></div></div>- <Tag color="red">Disabled</Tag>+ <Badge variant="destructive">Disabled</Badge></div>);})}diff --git a/ui/litellm-dashboard/src/components/model_filters.tsx b/ui/litellm-dashboard/src/components/model_filters.tsxindex bc9ca6bab44..5db144a6be4 100644--- a/ui/litellm-dashboard/src/components/model_filters.tsx+++ b/ui/litellm-dashboard/src/components/model_filters.tsx@@ -1,5 +1,5 @@import React, { useState, useEffect, useMemo, useRef } from "react";-import { Card, Text } from "@tremor/react";+import { Card } from "@/components/ui/card";interface ModelGroupInfo {model_group: string;@@ -125,7 +125,7 @@ const ModelFilters: React.FC<ModelFiltersProps> = ({const filtersContent = (<div className="flex flex-wrap gap-4 items-center"><div>- <Text className="text-sm font-medium mb-2">Search Models:</Text>+ <p className="text-sm font-medium mb-2">Search Models:</p><inputtype="text"placeholder="Search model names..."@@ -135,7 +135,7 @@ const ModelFilters: React.FC<ModelFiltersProps> = ({/></div><div>- <Text className="text-sm font-medium mb-2">Provider:</Text>+ <p className="text-sm font-medium mb-2">Provider:</p><selectvalue={selectedProvider}onChange={(e) => setSelectedProvider(e.target.value)}@@ -153,7 +153,7 @@ const ModelFilters: React.FC<ModelFiltersProps> = ({</select></div><div>- <Text className="text-sm font-medium mb-2">Mode:</Text>+ <p className="text-sm font-medium mb-2">Mode:</p><selectvalue={selectedMode}onChange={(e) => setSelectedMode(e.target.value)}@@ -171,7 +171,7 @@ const ModelFilters: React.FC<ModelFiltersProps> = ({</select></div><div>- <Text className="text-sm font-medium mb-2">Features:</Text>+ <p className="text-sm font-medium mb-2">Features:</p><selectvalue={selectedFeature}onChange={(e) => setSelectedFeature(e.target.value)}@@ -204,7 +204,7 @@ const ModelFilters: React.FC<ModelFiltersProps> = ({);if (showFiltersCard) {- return <Card className={`mb-6 ${className}`}>{filtersContent}</Card>;+ return <Card className={`mb-6 px-6 ${className}`}>{filtersContent}</Card>;}return <div className={className}>{filtersContent}</div>;diff --git a/ui/litellm-dashboard/src/components/model_group_alias_settings.tsx b/ui/litellm-dashboard/src/components/model_group_alias_settings.tsxindex eeda62638cb..b130c455e71 100644--- a/ui/litellm-dashboard/src/components/model_group_alias_settings.tsx+++ b/ui/litellm-dashboard/src/components/model_group_alias_settings.tsx@@ -1,7 +1,8 @@import React, { useState, useEffect } from "react";import { PlusCircleIcon, PencilIcon, TrashIcon, ChevronDownIcon, ChevronRightIcon } from "@heroicons/react/outline";import { setCallbacksCall } from "./networking";-import { Card, Title, Text, Table, TableHead, TableHeaderCell, TableBody, TableRow, TableCell } from "@tremor/react";+import { Card, CardTitle } from "@/components/ui/card";+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";import NotificationsManager from "./molecules/notifications_manager";type ModelGroupAliasValue = string | { model: string; hidden?: boolean };@@ -148,10 +149,10 @@ const ModelGroupAliasSettings: React.FC<ModelGroupAliasSettingsProps> = ({);return (- <Card className="mb-6">+ <Card className="mb-6 px-6"><div className="flex items-center justify-between cursor-pointer" onClick={() => setIsExpanded(!isExpanded)}><div className="flex flex-col">- <Title className="mb-0">Model Group Alias Settings</Title>+ <CardTitle className="mb-0">Model Group Alias Settings</CardTitle><p className="text-sm text-gray-500">Create aliases for your model groups to simplify API calls. For example, you can create an alias'gpt-4o' that points to 'gpt-4o-mini-openai' model group.@@ -169,7 +170,7 @@ const ModelGroupAliasSettings: React.FC<ModelGroupAliasSettingsProps> = ({{isExpanded && (<div className="mt-4"><div className="mb-6">- <Text className="text-sm font-medium text-gray-700 mb-2">Add New Alias</Text>+ <p className="text-sm font-medium text-gray-700 mb-2">Add New Alias</p><div className="grid grid-cols-3 gap-4"><div><label className="block text-xs text-gray-500 mb-1">Alias Name</label>@@ -214,17 +215,17 @@ const ModelGroupAliasSettings: React.FC<ModelGroupAliasSettingsProps> = ({</div></div>- <Text className="text-sm font-medium text-gray-700 mb-2">Manage Existing Aliases</Text>+ <p className="text-sm font-medium text-gray-700 mb-2">Manage Existing Aliases</p><div className="rounded-lg custom-border relative mb-6"><div className="overflow-x-auto"><Table className="[&_td]:py-0.5 [&_th]:py-1">- <TableHead>+ <TableHeader><TableRow>- <TableHeaderCell className="py-1 h-8">Alias Name</TableHeaderCell>- <TableHeaderCell className="py-1 h-8">Target Model Group</TableHeaderCell>- <TableHeaderCell className="py-1 h-8">Actions</TableHeaderCell>+ <TableHead className="py-1 h-8">Alias Name</TableHead>+ <TableHead className="py-1 h-8">Target Model Group</TableHead>+ <TableHead className="py-1 h-8">Actions</TableHead></TableRow>- </TableHead>+ </TableHeader><TableBody>{aliases.map((alias) => (<TableRow key={alias.id} className="h-8">@@ -275,8 +276,12 @@ const ModelGroupAliasSettings: React.FC<ModelGroupAliasSettingsProps> = ({</>) : (<>- <TableCell className="py-0.5 text-sm text-gray-900">{alias.aliasName}</TableCell>- <TableCell className="py-0.5 text-sm text-gray-500">{alias.targetModelGroup}</TableCell>+ <TableCell className="py-0.5 text-sm whitespace-normal text-gray-900">+ {alias.aliasName}+ </TableCell>+ <TableCell className="py-0.5 text-sm whitespace-normal text-gray-500">+ {alias.targetModelGroup}+ </TableCell><TableCell className="py-0.5 whitespace-nowrap"><div className="flex space-x-2"><button@@ -299,7 +304,7 @@ const ModelGroupAliasSettings: React.FC<ModelGroupAliasSettingsProps> = ({))}{aliases.length === 0 && (<TableRow>- <TableCell colSpan={3} className="py-0.5 text-sm text-gray-500 text-center">+ <TableCell colSpan={3} className="py-0.5 text-sm whitespace-normal text-gray-500 text-center">No aliases added yet. Add a new alias above.</TableCell></TableRow>@@ -310,11 +315,9 @@ const ModelGroupAliasSettings: React.FC<ModelGroupAliasSettingsProps> = ({</div>{/* Configuration Example */}- <Card>- <Title className="mb-4">Configuration Example</Title>- <Text className="text-gray-600 mb-4">- Here's how your current aliases would look in the config.yaml:- </Text>+ <Card className="px-6">+ <CardTitle className="mb-4">Configuration Example</CardTitle>+ <p className="text-gray-600 mb-4">Here's how your current aliases would look in the config.yaml:</p><div className="bg-gray-100 rounded-lg p-4 font-mono text-sm"><div className="text-gray-700">router_settings:diff --git a/ui/litellm-dashboard/src/components/navbar.tsx b/ui/litellm-dashboard/src/components/navbar.tsxindex c999ee8035e..6ce92fb9449 100644--- a/ui/litellm-dashboard/src/components/navbar.tsx+++ b/ui/litellm-dashboard/src/components/navbar.tsx@@ -8,8 +8,8 @@ import { useTheme } from "@/contexts/ThemeContext";import { clearTokenCookies } from "@/utils/cookieUtils";import { clearStoredReturnUrl, getLoginUrl } from "@/utils/returnUrlUtils";import useProxySettings from "@/app/(dashboard)/hooks/proxySettings/useProxySettings";-import { DownOutlined, MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons";-import { Tag } from "antd";+import { Badge } from "@/components/ui/badge";+import { ChevronDown, PanelLeftClose, PanelLeftOpen } from "lucide-react";import Link from "next/link";import React from "react";import { BlogDropdown } from "./Navbar/BlogDropdown/BlogDropdown";@@ -71,7 +71,13 @@ const Navbar: React.FC<NavbarProps> = ({className="mr-2 flex h-9 w-9 items-center justify-center rounded-md text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900"title={sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar"}>- <span className="text-lg">{sidebarCollapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}</span>+ <span className="text-lg">+ {sidebarCollapsed ? (+ <PanelLeftOpen className="size-[18px]" />+ ) : (+ <PanelLeftClose className="size-[18px]" />+ )}+ </span></button>)}@@ -98,7 +104,7 @@ const Navbar: React.FC<NavbarProps> = ({🌑</span>)}- <Tag className="relative z-10 cursor-pointer text-xs font-medium">+ <Badge variant="outline" className="relative z-10 cursor-pointer text-xs font-medium"><ahref="https://docs.litellm.ai/release_notes"target="_blank"@@ -107,7 +113,7 @@ const Navbar: React.FC<NavbarProps> = ({>v{version}</a>- </Tag>+ </Badge></div>)}</div>@@ -138,7 +144,7 @@ const Navbar: React.FC<NavbarProps> = ({>Docs{/* Layout parity with Blog chevron — intentional single-level link */}- <DownOutlined className="pointer-events-none text-[10px] opacity-0" aria-hidden />+ <ChevronDown className="pointer-events-none size-2.5 opacity-0" aria-hidden /></a><BlogDropdown /></nav>diff --git a/ui/litellm-dashboard/src/components/object_permissions_view.tsx b/ui/litellm-dashboard/src/components/object_permissions_view.tsxindex 327e127e8fe..c7baa3d52c2 100644--- a/ui/litellm-dashboard/src/components/object_permissions_view.tsx+++ b/ui/litellm-dashboard/src/components/object_permissions_view.tsx@@ -1,5 +1,4 @@import React from "react";-import { Text } from "@tremor/react";import VectorStorePermissions from "./permissions/VectorStorePermissions";import MCPServerPermissions from "./permissions/MCPServerPermissions";import AgentPermissions from "./permissions/AgentPermissions";@@ -38,14 +37,14 @@ export function ObjectPermissionsView({accessToken={accessToken}/><AgentPermissions agents={agents} agentAccessGroups={agentAccessGroups} accessToken={accessToken} />- <div className="rounded-md border border-gray-100 p-4">- <Text className="text-sm font-medium text-gray-800">Search tools</Text>+ <div className="min-w-0 rounded-md border border-gray-100 p-4">+ <p className="text-sm font-medium text-gray-800">Search tools</p>{searchTools.length === 0 ? (- <Text className="mt-1 block text-xs text-gray-500">+ <p className="mt-1 block text-xs text-gray-500">No restriction — all configured search tools are allowed for this team.- </Text>+ </p>) : (- <Text className="mt-1 block text-xs text-gray-700">{searchTools.join(", ")}</Text>+ <p className="mt-1 block text-xs break-words text-gray-700">{searchTools.join(", ")}</p>)}</div></div>@@ -56,8 +55,8 @@ export function ObjectPermissionsView({<div className={`@container bg-white border border-gray-200 rounded-lg p-6 ${className}`}><div className="flex items-center gap-2 mb-6"><div>- <Text className="font-semibold text-gray-900">Object Permissions</Text>- <Text className="text-xs text-gray-500">Access control for Vector Stores and MCP Servers</Text>+ <p className="font-semibold text-gray-900">Object Permissions</p>+ <p className="text-xs text-gray-500">Access control for Vector Stores and MCP Servers</p></div></div>{content}@@ -67,7 +66,7 @@ export function ObjectPermissionsView({return (<div className={`${className}`}>- <Text className="font-medium text-gray-900 mb-3">Object Permissions</Text>+ <p className="font-medium text-gray-900 mb-3">Object Permissions</p>{content}</div>);diff --git a/ui/litellm-dashboard/src/components/onboarding_link.test.tsx b/ui/litellm-dashboard/src/components/onboarding_link.test.tsxindex 039d5e250da..a7d5a2cd4f6 100644--- a/ui/litellm-dashboard/src/components/onboarding_link.test.tsx+++ b/ui/litellm-dashboard/src/components/onboarding_link.test.tsx@@ -1,5 +1,22 @@-import { describe, it, expect } from "vitest";-import { buildOnboardingUrl } from "./onboarding_link";+import { describe, it, expect, vi } from "vitest";+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import OnboardingModal, { buildOnboardingUrl, InvitationLink } from "./onboarding_link";++vi.mock("./molecules/notifications_manager", () => ({ default: { success: vi.fn() } }));++const invitation: InvitationLink = {+ id: "inv-123",+ user_id: "user-abc",+ is_accepted: false,+ accepted_at: null,+ expires_at: new Date("2026-09-01"),+ created_at: new Date("2026-08-01"),+ created_by: "admin",+ updated_at: new Date("2026-08-01"),+ updated_by: "admin",+ has_user_setup_sso: false,+};describe("buildOnboardingUrl", () => {it("points the invitation link at the dedicated /ui/onboarding route", () => {@@ -68,3 +85,73 @@ describe("buildOnboardingUrl", () => {).toBe("");});});++describe("OnboardingModal", () => {+ it("renders nothing until it is opened", () => {+ render(+ <OnboardingModal+ isInvitationLinkModalVisible={false}+ setIsInvitationLinkModalVisible={vi.fn()}+ baseUrl="http://localhost:4000/"+ invitationLinkData={invitation}+ />,+ );++ expect(screen.queryByText("http://localhost:4000/ui/onboarding?invitation_id=inv-123")).not.toBeInTheDocument();+ });++ it("shows the invitation url, the user id and an invitation-flavoured copy button", async () => {+ render(+ <OnboardingModal+ isInvitationLinkModalVisible+ setIsInvitationLinkModalVisible={vi.fn()}+ baseUrl="http://localhost:4000/"+ invitationLinkData={invitation}+ />,+ );++ expect(await screen.findByText("http://localhost:4000/ui/onboarding?invitation_id=inv-123")).toBeInTheDocument();+ expect(screen.getByText("user-abc")).toBeInTheDocument();+ expect(screen.getAllByText("Invitation Link").length).toBeGreaterThan(0);+ expect(screen.getByRole("button", { name: "Copy invitation link" })).toBeInTheDocument();+ expect(screen.getByText(/Copy and send the generated link to onboard this user/)).toBeInTheDocument();+ });++ it("switches every label and the url to the reset-password flow", async () => {+ render(+ <OnboardingModal+ isInvitationLinkModalVisible+ setIsInvitationLinkModalVisible={vi.fn()}+ baseUrl="http://localhost:4000/"+ invitationLinkData={invitation}+ modalType="resetPassword"+ />,+ );++ expect(+ await screen.findByText("http://localhost:4000/ui/onboarding?invitation_id=inv-123&action=reset_password"),+ ).toBeInTheDocument();+ expect(screen.getAllByText("Reset Password Link").length).toBeGreaterThan(0);+ expect(screen.getByRole("button", { name: "Copy password reset link" })).toBeInTheDocument();+ expect(+ screen.getByText(/Copy and send the generated link to the user to reset their password/),+ ).toBeInTheDocument();+ });++ it("closes through setIsInvitationLinkModalVisible when the close control is used", async () => {+ const user = userEvent.setup();+ const setVisible = vi.fn();+ render(+ <OnboardingModal+ isInvitationLinkModalVisible+ setIsInvitationLinkModalVisible={setVisible}+ baseUrl="http://localhost:4000/"+ invitationLinkData={invitation}+ />,+ );++ await user.click(await screen.findByRole("button", { name: /close/i }));++ expect(setVisible).toHaveBeenCalledWith(false);+ });+});diff --git a/ui/litellm-dashboard/src/components/onboarding_link.tsx b/ui/litellm-dashboard/src/components/onboarding_link.tsxindex b5f3c6d3e17..f24e3709794 100644--- a/ui/litellm-dashboard/src/components/onboarding_link.tsx+++ b/ui/litellm-dashboard/src/components/onboarding_link.tsx@@ -1,7 +1,7 @@import React from "react";-import { Button, Modal, Typography } from "antd";import { CopyToClipboard } from "react-copy-to-clipboard";-import { Text } from "@tremor/react";+import { Button } from "@/components/ui/button";+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";import NotificationsManager from "./molecules/notifications_manager";export interface InvitationLink {@@ -58,10 +58,7 @@ export default function OnboardingModal({invitationLinkData,modalType = "invitation",}: OnboardingProps) {- const { Paragraph } = Typography;- const handleInvitationOk = () => {- setIsInvitationLinkModalVisible(false);- };+ const linkLabel = modalType === "invitation" ? "Invitation Link" : "Reset Password Link";const handleInvitationCancel = () => {setIsInvitationLinkModalVisible(false);@@ -76,36 +73,30 @@ export default function OnboardingModal({});return (- <Modal- title={modalType === "invitation" ? "Invitation Link" : "Reset Password Link"}- open={isInvitationLinkModalVisible}- width={800}- footer={null}- onOk={handleInvitationOk}- onCancel={handleInvitationCancel}- >- <Paragraph>- {modalType === "invitation"- ? "Copy and send the generated link to onboard this user to the proxy."- : "Copy and send the generated link to the user to reset their password."}- </Paragraph>- <div className="flex justify-between pt-5 pb-2">- <Text className="text-base">User ID</Text>- <Text>{invitationLinkData?.user_id}</Text>- </div>- <div className="flex justify-between pt-5 pb-2">- <Text>{modalType === "invitation" ? "Invitation Link" : "Reset Password Link"}</Text>- <Text>- <Text>{getInvitationUrl()}</Text>- </Text>- </div>- <div className="flex justify-end mt-5">- <CopyToClipboard text={getInvitationUrl()} onCopy={() => NotificationsManager.success("Copied!")}>- <Button type="primary">- {modalType === "invitation" ? "Copy invitation link" : "Copy password reset link"}- </Button>- </CopyToClipboard>- </div>- </Modal>+ <Dialog open={isInvitationLinkModalVisible} onOpenChange={(open) => !open && handleInvitationCancel()}>+ <DialogContent className="z-[1100] max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-[800px]">+ <DialogHeader>+ <DialogTitle>{linkLabel}</DialogTitle>+ </DialogHeader>+ <p>+ {modalType === "invitation"+ ? "Copy and send the generated link to onboard this user to the proxy."+ : "Copy and send the generated link to the user to reset their password."}+ </p>+ <div className="flex justify-between pt-5 pb-2">+ <span className="text-base">User ID</span>+ <span className="min-w-0 break-words">{invitationLinkData?.user_id}</span>+ </div>+ <div className="flex justify-between pt-5 pb-2">+ <span>{linkLabel}</span>+ <span className="min-w-0 break-words">{getInvitationUrl()}</span>+ </div>+ <div className="flex justify-end mt-5">+ <CopyToClipboard text={getInvitationUrl()} onCopy={() => NotificationsManager.success("Copied!")}>+ <Button>{modalType === "invitation" ? "Copy invitation link" : "Copy password reset link"}</Button>+ </CopyToClipboard>+ </div>+ </DialogContent>+ </Dialog>);}diff --git a/ui/litellm-dashboard/src/components/user_dashboard.tsx b/ui/litellm-dashboard/src/components/user_dashboard.tsxindex 1de232fadb8..ce5337aa7a7 100644--- a/ui/litellm-dashboard/src/components/user_dashboard.tsx+++ b/ui/litellm-dashboard/src/components/user_dashboard.tsx@@ -1,6 +1,5 @@"use client";import { clearTokenCookies, getCookie } from "@/utils/cookieUtils";-import { Col, Grid } from "@tremor/react";import { jwtDecode } from "jwt-decode";import React, { useEffect, useState } from "react";import { fetchTeams } from "./common_components/fetch_teams";@@ -218,8 +217,8 @@ const UserDashboard: React.FC<UserDashboardProps> = ({return (<div className="mx-4 h-[75vh]">- <Grid numItems={1} className="gap-2 p-8 w-full mt-2">- <Col numColSpan={1} className="flex flex-col gap-2">+ <div className="grid grid-cols-1 gap-2 p-8 w-full mt-2">+ <div className="col-span-1 flex flex-col gap-2"><VirtualKeysTableheaderActions={canCreateKey ? (@@ -235,8 +234,8 @@ const UserDashboard: React.FC<UserDashboardProps> = ({) : undefined}/>- </Col>- </Grid>+ </div>+ </div></div>);};