From a67d91f2e0608166520208949e4e5c7403ab86f6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 18:57:32 +0000 Subject: [PATCH] feat(ui): AIHub/MakeAgentPublicForm to shadcn - antd Modal/Button/Checkbox + @tremor Text/Title/Badge \u2192 shadcn Dialog/Button/Checkbox/Badge + native headings/paragraphs. - antd Steps/Step preserved (2-step wizard). - Categorical blue (version badge + info callout) / purple (skill badge) / amber (warning callout) palette; file added to .eslintrc overrides. Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- ui/litellm-dashboard/.eslintrc.json | 1 + .../AIHub/forms/MakeAgentPublicForm.tsx | 208 +++++++++++------- 2 files changed, 133 insertions(+), 76 deletions(-) diff --git a/ui/litellm-dashboard/.eslintrc.json b/ui/litellm-dashboard/.eslintrc.json index e891c33ee1e..ecebf685b32 100644 --- a/ui/litellm-dashboard/.eslintrc.json +++ b/ui/litellm-dashboard/.eslintrc.json @@ -82,6 +82,7 @@ "src/components/common_components/MemberTable.tsx", "src/components/SearchTools/SearchToolColumn.tsx", "src/components/team/available_teams.tsx", + "src/components/AIHub/forms/MakeAgentPublicForm.tsx", "src/components/permissions/VectorStorePermissions.tsx", "src/components/permissions/AgentPermissions.tsx", "src/components/permissions/MCPServerPermissions.tsx", diff --git a/ui/litellm-dashboard/src/components/AIHub/forms/MakeAgentPublicForm.tsx b/ui/litellm-dashboard/src/components/AIHub/forms/MakeAgentPublicForm.tsx index a38950b8fb7..8cdc1c95218 100644 --- a/ui/litellm-dashboard/src/components/AIHub/forms/MakeAgentPublicForm.tsx +++ b/ui/litellm-dashboard/src/components/AIHub/forms/MakeAgentPublicForm.tsx @@ -1,6 +1,15 @@ import React, { useState, useEffect } from "react"; -import { Modal, Form, Steps, Button, Checkbox } from "antd"; -import { Text, Title, Badge } from "@tremor/react"; +import { Form, Steps } from "antd"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { Checkbox } from "@/components/ui/checkbox"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { cn } from "@/lib/utils"; import { makeAgentsPublicCall } from "../../networking"; import NotificationsManager from "../../molecules/notifications_manager"; import { AgentHubData } from "@/components/AIHub/AgentHubTableColumns"; @@ -37,7 +46,9 @@ const MakeAgentPublicForm: React.FC = ({ const handleNext = () => { if (currentStep === 0) { if (selectedAgents.size === 0) { - NotificationsManager.fromBackend("Please select at least one agent to make public"); + NotificationsManager.fromBackend( + "Please select at least one agent to make public", + ); return; } setCurrentStep(1); @@ -62,17 +73,17 @@ const MakeAgentPublicForm: React.FC = ({ const handleSelectAll = (checked: boolean) => { if (checked) { - const allAgentIds = agentHubData.map((agent) => agent.agent_id || agent.name); + const allAgentIds = agentHubData.map( + (agent) => agent.agent_id || agent.name, + ); setSelectedAgents(new Set(allAgentIds)); } else { setSelectedAgents(new Set()); } }; - // Initialize and preselect already public agents when modal opens useEffect(() => { if (visible && agentHubData.length > 0) { - // Preselect agents that are already public const alreadyPublicAgents = agentHubData .filter((agent) => agent.is_public === true) .map((agent) => agent.agent_id || agent.name); @@ -83,23 +94,27 @@ const MakeAgentPublicForm: React.FC = ({ const handleSubmit = async () => { if (selectedAgents.size === 0) { - NotificationsManager.fromBackend("Please select at least one agent to make public"); + NotificationsManager.fromBackend( + "Please select at least one agent to make public", + ); return; } setLoading(true); try { const agentIdsToMakePublic = Array.from(selectedAgents); - - // Make batch API call for all agents await makeAgentsPublicCall(accessToken, agentIdsToMakePublic); - NotificationsManager.success(`Successfully made ${agentIdsToMakePublic.length} agent(s) public!`); + NotificationsManager.success( + `Successfully made ${agentIdsToMakePublic.length} agent(s) public!`, + ); handleClose(); onSuccess(); } catch (error) { console.error("Error making agents public:", error); - NotificationsManager.fromBackend("Failed to make agents public. Please try again."); + NotificationsManager.fromBackend( + "Failed to make agents public. Please try again.", + ); } finally { setLoading(false); } @@ -107,67 +122,91 @@ const MakeAgentPublicForm: React.FC = ({ const renderStep1Content = () => { const allAgentsSelected = - agentHubData.length > 0 && agentHubData.every((agent) => selectedAgents.has(agent.agent_id || agent.name)); + agentHubData.length > 0 && + agentHubData.every((agent) => + selectedAgents.has(agent.agent_id || agent.name), + ); const isIndeterminate = selectedAgents.size > 0 && !allAgentsSelected; return (
- Select Agents to Make Public -
+

Select Agents to Make Public

+
+ /> + + Select All{" "} + {agentHubData.length > 0 && `(${agentHubData.length})`} + +
- - Select the agents you want to be visible on the public model hub. Users will still require a valid Virtual Key - to use these agents. - +

+ Select the agents you want to be visible on the public model hub. + Users will still require a valid Virtual Key to use these agents. +

-
+
{agentHubData.length === 0 ? ( -
- No agents available. +
+

No agents available.

) : ( agentHubData.map((agent) => { const agentId = agent.agent_id || agent.name; return ( -
+
+ ); }) )} @@ -175,10 +214,11 @@ const MakeAgentPublicForm: React.FC = ({
{selectedAgents.size > 0 && ( -
- - {selectedAgents.size} agent{selectedAgents.size !== 1 ? "s" : ""} selected - +
+

+ {selectedAgents.size} agent + {selectedAgents.size !== 1 ? "s" : ""} selected +

)}
@@ -188,33 +228,45 @@ const MakeAgentPublicForm: React.FC = ({ const renderStep2Content = () => { return (
- Confirm Making Agents Public +

Confirm Making Agents Public

-
- - Warning: Once you make these agents public, anyone who can go to the{" "} - /ui/model_hub_table will be able to know they exist on the proxy. - +
+

+ Warning: Once you make these agents public, anyone + who can go to the /ui/model_hub_table will be able to + know they exist on the proxy. +

- Agents to be made public: -
+

Agents to be made public:

+
{Array.from(selectedAgents).map((agentId) => { - const agent = agentHubData.find((a) => (a.agent_id || a.name) === agentId); + const agent = agentHubData.find( + (a) => (a.agent_id || a.name) === agentId, + ); return ( -
+
- {agent?.name || agentId} + + {agent?.name || agentId} + {agent && ( - + v{agent.version} )}
- {agent?.description && {agent.description}} + {agent?.description && ( +

+ {agent.description} +

+ )}
); @@ -223,11 +275,11 @@ const MakeAgentPublicForm: React.FC = ({
-
- - Total: {selectedAgents.size} agent{selectedAgents.size !== 1 ? "s" : ""} will be made - public - +
+

+ Total: {selectedAgents.size} agent + {selectedAgents.size !== 1 ? "s" : ""} will be made public +

); @@ -247,7 +299,10 @@ const MakeAgentPublicForm: React.FC = ({ const renderStepButtons = () => { return (
- @@ -259,8 +314,8 @@ const MakeAgentPublicForm: React.FC = ({ )} {currentStep === 1 && ( - )}
@@ -269,24 +324,25 @@ const MakeAgentPublicForm: React.FC = ({ }; return ( - (!o ? handleClose() : undefined)} > -
- - - - + + + Make Agents Public + + + + + + - {renderStepContent()} - {renderStepButtons()} - -
+ {renderStepContent()} + {renderStepButtons()} + + + ); };