From 72be35f9b81da33c34a2c82c37ff69f9d998a3e0 Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Thu, 16 Apr 2026 11:01:30 -0700 Subject: [PATCH 1/2] chore(ui): migrate router_settings page from Tremor to antd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace @tremor/react components with antd equivalents: - Button → antd Button - TextInput → antd Input - Switch → antd Switch --- .../router_settings/LatencyBasedConfiguration.tsx | 4 ++-- .../router_settings/ReliabilityRetriesSection.tsx | 4 ++-- .../src/components/router_settings/TagFilteringToggle.tsx | 2 +- .../src/components/router_settings/index.tsx | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/litellm-dashboard/src/components/router_settings/LatencyBasedConfiguration.tsx b/ui/litellm-dashboard/src/components/router_settings/LatencyBasedConfiguration.tsx index 9c776c94a0..1c2d52cf0c 100644 --- a/ui/litellm-dashboard/src/components/router_settings/LatencyBasedConfiguration.tsx +++ b/ui/litellm-dashboard/src/components/router_settings/LatencyBasedConfiguration.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { TextInput } from "@tremor/react"; +import { Input } from "antd"; interface routingStrategyArgs { ttl?: number; @@ -42,7 +42,7 @@ const LatencyBasedConfiguration: React.FC = ({

{paramExplanation[param] || ""}

- = ({

{routerFieldsMetadata[param]?.field_description || ""}

- = ({ accessToken, userRole, {/* Actions - Sticky at bottom */}
- -
From 260679679f7881d96cbbf53bbf23b4ffaf7091dc Mon Sep 17 00:00:00 2001 From: Ryan Crabbe Date: Thu, 16 Apr 2026 14:04:33 -0700 Subject: [PATCH 2/2] fix(ui): repair router_settings tests broken by full antd mock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The antd mocks in RouterSettingsForm.test.tsx and index.test.tsx replaced the entire antd module with only Select, so the Switch and Button used by nested components failed to render. Use importOriginal to preserve the rest of antd and override only Select. Also fix the TagFilteringToggle click assertion — antd's Switch fires onChange with (checked, event), so toHaveBeenCalledWith(true) was always going to miss. Assert the checked arg directly instead of coupling to antd's call signature. --- .../RouterSettingsForm.test.tsx | 41 +++++++++++-------- .../TagFilteringToggle.test.tsx | 3 +- .../components/router_settings/index.test.tsx | 38 +++++++++-------- 3 files changed, 46 insertions(+), 36 deletions(-) diff --git a/ui/litellm-dashboard/src/components/router_settings/RouterSettingsForm.test.tsx b/ui/litellm-dashboard/src/components/router_settings/RouterSettingsForm.test.tsx index 3988f01281..a8ff485cf9 100644 --- a/ui/litellm-dashboard/src/components/router_settings/RouterSettingsForm.test.tsx +++ b/ui/litellm-dashboard/src/components/router_settings/RouterSettingsForm.test.tsx @@ -4,25 +4,30 @@ import userEvent from "@testing-library/user-event"; import RouterSettingsForm from "./RouterSettingsForm"; import type { RouterSettingsFormValue } from "./RouterSettingsForm"; -// Use the same antd mock as RoutingStrategySelector to keep things consistent -vi.mock("antd", () => ({ - Select: Object.assign( - ({ value, onChange, children }: any) => ( - - ), - { - Option: ({ value, children }: any) => ( - +// Override antd Select (complex to drive in JSDOM) while preserving the rest +// of antd (Switch, Button, etc.) so nested components render normally. +vi.mock("antd", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + Select: Object.assign( + ({ value, onChange, children }: any) => ( + ), - } - ), -})); + { + Option: ({ value, children }: any) => ( + + ), + } + ), + }; +}); const defaultValue: RouterSettingsFormValue = { routerSettings: {}, diff --git a/ui/litellm-dashboard/src/components/router_settings/TagFilteringToggle.test.tsx b/ui/litellm-dashboard/src/components/router_settings/TagFilteringToggle.test.tsx index b469751ac2..cc071117b8 100644 --- a/ui/litellm-dashboard/src/components/router_settings/TagFilteringToggle.test.tsx +++ b/ui/litellm-dashboard/src/components/router_settings/TagFilteringToggle.test.tsx @@ -90,6 +90,7 @@ describe("TagFilteringToggle", () => { await user.click(screen.getByRole("switch")); - expect(onToggle).toHaveBeenCalledWith(true); + expect(onToggle).toHaveBeenCalledTimes(1); + expect(onToggle.mock.calls[0][0]).toBe(true); }); }); diff --git a/ui/litellm-dashboard/src/components/router_settings/index.test.tsx b/ui/litellm-dashboard/src/components/router_settings/index.test.tsx index eea2717298..80f0ed98c8 100644 --- a/ui/litellm-dashboard/src/components/router_settings/index.test.tsx +++ b/ui/litellm-dashboard/src/components/router_settings/index.test.tsx @@ -3,24 +3,28 @@ import { renderWithProviders, screen, waitFor } from "../../../tests/test-utils" import userEvent from "@testing-library/user-event"; import RouterSettings from "./index"; -vi.mock("antd", () => ({ - Select: Object.assign( - ({ value, onChange, children }: any) => ( - - ), - { - Option: ({ value, children }: any) => ( - +vi.mock("antd", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + Select: Object.assign( + ({ value, onChange, children }: any) => ( + ), - } - ), -})); + { + Option: ({ value, children }: any) => ( + + ), + } + ), + }; +}); vi.mock("@/components/networking", () => ({ getCallbacksCall: vi.fn(),