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
Fixed inconsistent button sizes and variants (#16600)
yuneng-jiang01065a128401
diff --git a/ui/litellm-dashboard/src/components/model_info_view.tsx b/ui/litellm-dashboard/src/components/model_info_view.tsxindex 9095937d82f..e90cc361a60 100644--- a/ui/litellm-dashboard/src/components/model_info_view.tsx+++ b/ui/litellm-dashboard/src/components/model_info_view.tsx@@ -493,22 +493,14 @@ export default function ModelInfoView({<Title>Model Settings</Title><div className="flex gap-2">{isAutoRouter && canEditModel && !isEditing && (- <TremorButton- variant="primary"- onClick={() => setIsAutoRouterModalOpen(true)}- className="flex items-center"- >+ <TremorButton onClick={() => setIsAutoRouterModalOpen(true)} className="flex items-center">Edit Auto Router</TremorButton>)}{canEditModel ? (!isEditing && (- <TremorButton- variant="secondary"- onClick={() => setIsEditing(true)}- className="flex items-center"- >- Edit Model+ <TremorButton onClick={() => setIsEditing(true)} className="flex items-center">+ Edit Settings</TremorButton>)) : (diff --git a/ui/litellm-dashboard/src/components/organization/organization_view.test.tsx b/ui/litellm-dashboard/src/components/organization/organization_view.test.tsxnew file mode 100644index 00000000000..0be03169e89--- /dev/null+++ b/ui/litellm-dashboard/src/components/organization/organization_view.test.tsx@@ -0,0 +1,84 @@+import React from "react";+import { render, waitFor } from "@testing-library/react";+import { vi, test, expect } from "vitest";+import OrganizationInfoView from "./organization_view";++// Mock networking calls used by the component+vi.mock("../networking", () => {+ return {+ __esModule: true,+ organizationInfoCall: vi.fn(),+ organizationMemberAddCall: vi.fn(),+ organizationMemberUpdateCall: vi.fn(),+ organizationMemberDeleteCall: vi.fn(),+ organizationUpdateCall: vi.fn(),+ };+});++// Mock noisy/heavy child components to keep this test focused on render+vi.mock("../object_permissions_view", () => ({+ __esModule: true,+ default: () => <div data-testid="object-permissions-view" />,+}));+vi.mock("../molecules/notifications_manager", () => ({+ __esModule: true,+ default: { success: vi.fn(), fromBackend: vi.fn() },+}));+vi.mock("../team/edit_membership", () => ({+ __esModule: true,+ default: () => null,+}));+vi.mock("../common_components/user_search_modal", () => ({+ __esModule: true,+ default: () => null,+}));+vi.mock("../vector_store_management/VectorStoreSelector", () => ({+ __esModule: true,+ default: () => null,+}));+vi.mock("../mcp_server_management/MCPServerSelector", () => ({+ __esModule: true,+ default: () => null,+}));++const mockOrg = {+ organization_alias: "Acme Corp",+ organization_id: "org_123",+ created_at: new Date().toISOString(),+ updated_at: new Date().toISOString(),+ created_by: "[email protected]",+ spend: 0,+ models: ["gpt-4o-mini"],+ litellm_budget_table: {+ tpm_limit: null,+ rpm_limit: null,+ max_budget: 1000,+ budget_duration: "30d",+ max_parallel_requests: null,+ },+ object_permission: {},+ members: [],+ teams: [],+ metadata: null,+};++test("renders organization view after loading data", async () => {+ const { organizationInfoCall } = await import("../networking");+ (organizationInfoCall as unknown as ReturnType<typeof vi.fn>).mockResolvedValueOnce(mockOrg);++ const { findAllByText } = render(+ <OrganizationInfoView+ organizationId="org_123"+ onClose={() => {}}+ accessToken="test-token"+ is_org_admin={false}+ is_proxy_admin={false}+ userModels={[]}+ editOrg={false}+ />,+ );++ await waitFor(() => {+ expect(findAllByText("Acme Corp")).toBeTruthy();+ });+});diff --git a/ui/litellm-dashboard/src/components/organization/organization_view.tsx b/ui/litellm-dashboard/src/components/organization/organization_view.tsxindex 17e21baedf6..b284519ce13 100644--- a/ui/litellm-dashboard/src/components/organization/organization_view.tsx+++ b/ui/litellm-dashboard/src/components/organization/organization_view.tsx@@ -1,46 +1,46 @@-import React, { useState, useEffect } from "react";+import { formatNumberWithCommas, copyToClipboard as utilCopyToClipboard } from "@/utils/dataUtils";+import { ArrowLeftIcon, PencilAltIcon, TrashIcon } from "@heroicons/react/outline";import {+ Badge,Card,- Title,- Text,- TextInput,+ Grid,+ Icon,Tab,- TabList,TabGroup,- TabPanel,- TabPanels,- Grid,- Badge,Table,- TableHead,- TableRow,- TableHeaderCell,TableBody,TableCell,+ TableHead,+ TableHeaderCell,+ TableRow,+ TabList,+ TabPanel,+ TabPanels,+ Text,+ TextInput,+ Title,Button as TremorButton,- Icon,} from "@tremor/react";-import NumericalInput from "../shared/numerical_input";import { Button, Form, Input, Select } from "antd";-import { ArrowLeftIcon, PencilAltIcon, TrashIcon } from "@heroicons/react/outline";+import { CheckIcon, CopyIcon } from "lucide-react";+import React, { useEffect, useState } from "react";+import UserSearchModal from "../common_components/user_search_modal";import { getModelDisplayName } from "../key_team_helpers/fetch_available_models_team_key";+import MCPServerSelector from "../mcp_server_management/MCPServerSelector";+import NotificationsManager from "../molecules/notifications_manager";import {Member,Organization,organizationInfoCall,organizationMemberAddCall,- organizationMemberUpdateCall,organizationMemberDeleteCall,+ organizationMemberUpdateCall,organizationUpdateCall,} from "../networking";-import UserSearchModal from "../common_components/user_search_modal";-import MemberModal from "../team/edit_membership";import ObjectPermissionsView from "../object_permissions_view";+import NumericalInput from "../shared/numerical_input";+import MemberModal from "../team/edit_membership";import VectorStoreSelector from "../vector_store_management/VectorStoreSelector";-import MCPServerSelector from "../mcp_server_management/MCPServerSelector";-import { copyToClipboard as utilCopyToClipboard, formatNumberWithCommas } from "@/utils/dataUtils";-import { CheckIcon, CopyIcon } from "lucide-react";-import NotificationsManager from "../molecules/notifications_manager";interface OrganizationInfoProps {organizationId: string;@@ -492,7 +492,9 @@ const OrganizationInfoView: React.FC<OrganizationInfoProps> = ({<div className="sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]"><div className="flex justify-end items-center gap-2">- <Button onClick={() => setIsEditing(false)}>Cancel</Button>+ <TremorButton variant="secondary" onClick={() => setIsEditing(false)}>+ Cancel+ </TremorButton><TremorButton type="submit">Save Changes</TremorButton></div></div>diff --git a/ui/litellm-dashboard/src/components/public_model_hub.tsx b/ui/litellm-dashboard/src/components/public_model_hub.tsxindex b1a0cc9021c..c32c7462a54 100644--- a/ui/litellm-dashboard/src/components/public_model_hub.tsx+++ b/ui/litellm-dashboard/src/components/public_model_hub.tsx@@ -14,7 +14,6 @@ import { getProviderLogoAndName } from "./provider_info_helpers";import Navbar from "./navbar";import { ThemeProvider } from "@/contexts/ThemeContext";import NotificationsManager from "./molecules/notifications_manager";-// Simple approach without react-markdown dependencyinterface ModelGroupInfo {model_group: string;diff --git a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsxindex d90b9e32f7f..caa9729d4e8 100644--- a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx+++ b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx@@ -1,6 +1,6 @@import GuardrailSelector from "@/components/guardrails/GuardrailSelector";import { TextInput, Button as TremorButton } from "@tremor/react";-import { Button as AntdButton, Form, Input, Select, Tooltip } from "antd";+import { Form, Input, Select, Tooltip } from "antd";import { useEffect, useState } from "react";import { mapInternalToDisplayNames } from "../callback_info_helpers";import KeyLifecycleSettings from "../common_components/KeyLifecycleSettings";@@ -548,7 +548,9 @@ export function KeyEditView({<div className="sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]"><div className="flex justify-end items-center gap-2">- <AntdButton onClick={onCancel}>Cancel</AntdButton>+ <TremorButton variant="secondary" onClick={onCancel}>+ Cancel+ </TremorButton><TremorButton type="submit">Save Changes</TremorButton></div></div>diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.tsxindex 411d73a90c1..58b8363e30f 100644--- a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx+++ b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx@@ -545,9 +545,7 @@ export default function KeyInfoView({<div className="flex justify-between items-center mb-4"><Title>Key Settings</Title>{!isEditing && userRole && rolesWithWriteAccess.includes(userRole) && (- <Button variant="light" onClick={() => setIsEditing(true)}>- Edit Settings- </Button>+ <Button onClick={() => setIsEditing(true)}>Edit Settings</Button>)}</div>diff --git a/ui/litellm-dashboard/src/components/view_users/user_info_view.test.tsx b/ui/litellm-dashboard/src/components/view_users/user_info_view.test.tsxnew file mode 100644index 00000000000..7334dd72fc8--- /dev/null+++ b/ui/litellm-dashboard/src/components/view_users/user_info_view.test.tsx@@ -0,0 +1,51 @@+import { render } from "@testing-library/react";+import { describe, expect, it, vi } from "vitest";+import UserInfoView from "./user_info_view";++vi.mock("../networking", () => {+ const MOCK_USER_DATA = {+ user_id: "user-123",+ user_info: {+ user_email: "[email protected]",+ user_role: "admin",+ teams: [],+ models: [],+ max_budget: 100,+ budget_duration: "30d",+ spend: 0,+ metadata: {},+ created_at: "2025-01-01T00:00:00.000Z",+ updated_at: "2025-01-02T00:00:00.000Z",+ },+ keys: [],+ teams: [],+ };++ return {+ userInfoCall: vi.fn().mockResolvedValue(MOCK_USER_DATA),+ userDeleteCall: vi.fn(),+ userUpdateUserCall: vi.fn(),+ modelAvailableCall: vi.fn().mockResolvedValue({ data: [] }),+ invitationCreateCall: vi.fn(),+ getProxyBaseUrl: () => "https://litellm.test",+ };+});++describe("UserInfoView", () => {+ const defaultProps = {+ userId: "user-123",+ onClose: vi.fn(),+ accessToken: "test-token",+ userRole: null,+ possibleUIRoles: null,+ };++ it("renders loading state and then the user email", async () => {+ const { getByText, findAllByText } = render(<UserInfoView {...defaultProps} />);++ expect(getByText("Loading user data...")).toBeInTheDocument();++ const emails = await findAllByText("[email protected]");+ expect(emails.length).toBeGreaterThan(0);+ });+});diff --git a/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx b/ui/litellm-dashboard/src/components/view_users/user_info_view.tsxindex ab2c177707c..65aa7c9d4c0 100644--- a/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx+++ b/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx@@ -343,9 +343,7 @@ export default function UserInfoView({<div className="flex justify-between items-center mb-4"><Title>User Settings</Title>{!isEditing && userRole && rolesWithWriteAccess.includes(userRole) && (- <Button variant="light" onClick={() => setIsEditing(true)}>- Edit Settings- </Button>+ <Button onClick={() => setIsEditing(true)}>Edit Settings</Button>)}</div>