From b5889a60ad45ab8a9d08ed1964063439bd1c5df9 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Tue, 4 Aug 2026 13:58:45 -0700 Subject: [PATCH 1/2] refactor(ui): drop unreferenced locals from shared dashboard components Second slice of the same sweep, covering src/components. Same rule as the first: every removal is an unused import, an unused interface or type alias, or a local const whose only mention was its own declaration. The modelGroupOptions computation in add_auto_router_tab goes whole rather than losing only its binding, since a Set and two arrays allocated per render and then discarded is no better than the dead const was. ToolDetail is deliberately left alone. Its unread teamsData traces back to a useQuery that still issues a /team/list request, so removing it drops a network call; that is a behavior change and belongs in a slice that gets QA'd, not this one. Stacked on litellm_dead_locals_1_app_routes; review that one first. Part of LIT-5162. --- .../add_model/RouterConfigBuilder.tsx | 7 - .../add_model/add_auto_router_tab.tsx | 7 - .../src/components/add_pass_through.tsx | 6 - .../components/bulk_create_users_button.tsx | 18 --- .../src/components/chat_ui/CodeSnippets.tsx | 3 - .../components/chat_ui/MCPEventsDisplay.tsx | 3 +- .../src/components/model_filters.tsx | 7 - .../src/components/networking.tsx | 1 - .../src/components/pass_through_info.tsx | 2 +- .../src/components/settings.tsx | 124 +----------------- .../components/templates/key_edit_view.tsx | 16 --- .../src/components/user_agent_activity.tsx | 6 +- .../GuardrailViewer/GuardrailViewer.tsx | 16 --- .../src/components/view_user_spend.tsx | 5 - 14 files changed, 4 insertions(+), 217 deletions(-) diff --git a/ui/litellm-dashboard/src/components/add_model/RouterConfigBuilder.tsx b/ui/litellm-dashboard/src/components/add_model/RouterConfigBuilder.tsx index 08acf993e2c..b28d402f116 100644 --- a/ui/litellm-dashboard/src/components/add_model/RouterConfigBuilder.tsx +++ b/ui/litellm-dashboard/src/components/add_model/RouterConfigBuilder.tsx @@ -126,13 +126,6 @@ const RouterConfigBuilder: React.FC = ({ modelInfo, va }; // Handle utterances change (convert textarea string to array) - const handleUtterancesChange = (routeId: string, utterancesText: string) => { - const utterancesArray = utterancesText - .split("\n") - .map((line) => line.trim()) // Only trims leading/trailing whitespace, preserves internal spaces - .filter((line) => line.length > 0); - updateRoute(routeId, "utterances", utterancesArray); - }; // Prepare model options for dropdowns const modelOptions = modelInfo.map((model) => ({ diff --git a/ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx b/ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx index ae90d42ba8a..894d1819901 100644 --- a/ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx +++ b/ui/litellm-dashboard/src/components/add_model/add_auto_router_tab.tsx @@ -38,8 +38,6 @@ interface AddAutoRouterTabProps { createScope?: ModelWriteScope; } -const { Title } = Typography; - const AddAutoRouterTab: React.FC = ({ handleOk, accessToken, @@ -91,11 +89,6 @@ const AddAutoRouterTab: React.FC = ({ const isAdmin = all_admin_roles.includes(userRole); - const modelGroupOptions = Array.from(new Set(modelInfo.map((option) => option.model_group))).map((model_group) => ({ - value: model_group, - label: model_group, - })); - // Why the submit is unavailable, or null when it is available. The button reads this to disable // itself and to say what is missing, so the two can never give different answers. const submitBlockedReason = diff --git a/ui/litellm-dashboard/src/components/add_pass_through.tsx b/ui/litellm-dashboard/src/components/add_pass_through.tsx index c0343e268a1..0c9fbfb0347 100644 --- a/ui/litellm-dashboard/src/components/add_pass_through.tsx +++ b/ui/litellm-dashboard/src/components/add_pass_through.tsx @@ -37,7 +37,6 @@ const AddPassThroughEndpoint: React.FC = ({ const [form] = Form.useForm(); const [isModalVisible, setIsModalVisible] = useState(false); const [isLoading, setIsLoading] = useState(false); - const [selectedModel, setSelectedModel] = useState(""); const [pathValue, setPathValue] = useState(""); const [targetValue, setTargetValue] = useState(""); const [includeSubpath, setIncludeSubpath] = useState(true); @@ -107,11 +106,6 @@ const AddPassThroughEndpoint: React.FC = ({ } }; - const copyToClipboard = (text: string) => { - navigator.clipboard.writeText(text); - NotificationsManager.success("Copied to clipboard!"); - }; - return (