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
[UI] Add team deletion check for teams with keys (#12953)
Jugal D. Bhattb318f55faad4
diff --git a/ui/litellm-dashboard/src/components/teams.tsx b/ui/litellm-dashboard/src/components/teams.tsxindex 5d142521e59..09fc5cd4e4d 100644--- a/ui/litellm-dashboard/src/components/teams.tsx+++ b/ui/litellm-dashboard/src/components/teams.tsx@@ -72,6 +72,7 @@ import VectorStoreSelector from "./vector_store_management/VectorStoreSelector";import PremiumLoggingSettings from "./common_components/PremiumLoggingSettings";import type { KeyResponse, Team } from "./key_team_helpers/key_list";import { formatNumberWithCommas } from "../utils/dataUtils";+import { AlertTriangleIcon, XIcon } from 'lucide-react';import MCPServerSelector from "./mcp_server_management/MCPServerSelector";interface TeamProps {@@ -203,6 +204,7 @@ const Teams: React.FC<TeamProps> = ({const [loggingSettings, setLoggingSettings] = useState<any[]>([]);const [mcpAccessGroups, setMcpAccessGroups] = useState<string[]>([]);const [mcpAccessGroupsLoaded, setMcpAccessGroupsLoaded] = useState(false);+ const [deleteConfirmInput, setDeleteConfirmInput] = useState("");useEffect(() => {console.log(`currentOrgForCreateTeam: ${currentOrgForCreateTeam}`);@@ -1077,55 +1079,79 @@ const Teams: React.FC<TeamProps> = ({: null}</TableBody></Table>- {isDeleteModalOpen && (- <div className="fixed z-10 inset-0 overflow-y-auto">- <div className="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">- <div- className="fixed inset-0 transition-opacity"- aria-hidden="true"- >- <div className="absolute inset-0 bg-gray-500 opacity-75"></div>- </div>-- {/* Modal Panel */}- <span- className="hidden sm:inline-block sm:align-middle sm:h-screen"- aria-hidden="true"- >- ​- </span>-- {/* Confirmation Modal Content */}- <div className="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">- <div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">- <div className="sm:flex sm:items-start">- <div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">- <h3 className="text-lg leading-6 font-medium text-gray-900">- Delete Team- </h3>- <div className="mt-2">- <p className="text-sm text-gray-500">- Are you sure you want to delete this- team ?- </p>- </div>- </div>- </div>- </div>- <div className="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">- <Button- onClick={confirmDelete}- color="red"- className="ml-2"- >- Delete- </Button>- <Button onClick={cancelDelete}>Cancel</Button>- </div>- </div>- </div>- </div>- )}+ {isDeleteModalOpen && (() => {+ const team = teams?.find((t) => t.team_id === teamToDelete);+ const teamName = team?.team_alias || "";+ const keyCount = team?.keys?.length || 0;+ const isValid = deleteConfirmInput === teamName;+ return (+ <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">+ <div className="bg-white rounded-lg shadow-xl w-full max-w-2xl min-h-[380px] py-6 overflow-hidden transform transition-all flex flex-col justify-between">+ <div>+ <div className="flex items-center justify-between px-6 py-4 border-b border-gray-200">+ <h3 className="text-lg font-semibold text-gray-900">Delete Team</h3>+ <button+ onClick={() => { cancelDelete(); setDeleteConfirmInput(""); }}+ className="text-gray-400 hover:text-gray-500 focus:outline-none"+ >+ <XIcon size={20} />+ </button>+ </div>+ <div className="px-6 py-4">+ {keyCount > 0 && (+ <div className="flex items-start gap-3 p-4 bg-red-50 border border-red-100 rounded-md mb-5">+ <div className="text-red-500 mt-0.5">+ <AlertTriangleIcon size={20} />+ </div>+ <div>+ <p className="text-base font-medium text-red-600">+ Warning: This team has {keyCount} associated key{keyCount > 1 ? 's' : ''}.+ </p>+ <p className="text-base text-red-600 mt-2">+ Deleting the team will also delete all associated keys. This action is irreversible.+ </p>+ </div>+ </div>+ )}+ <p className="text-base text-gray-600 mb-5">+ Are you sure you want to force delete this team and all its keys?+ </p>+ <div className="mb-5">+ <label className="block text-base font-medium text-gray-700 mb-2">+ {`Type `}+ <span className="underline">{teamName}</span>+ {` to confirm deletion:`}+ </label>+ <input+ type="text"+ value={deleteConfirmInput}+ onChange={(e) => setDeleteConfirmInput(e.target.value)}+ placeholder="Enter team name exactly"+ className="w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-base"+ autoFocus+ />+ </div>+ </div>+ </div>+ <div className="px-6 py-4 bg-gray-50 flex justify-end gap-4">+ <button+ onClick={() => { cancelDelete(); setDeleteConfirmInput(""); }}+ className="px-5 py-3 bg-white border border-gray-300 rounded-md text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"+ >+ Cancel+ </button>+ <button+ onClick={confirmDelete}+ disabled={!isValid}+ className={`px-5 py-3 rounded-md text-base font-medium text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 ${isValid ? 'bg-red-600 hover:bg-red-700' : 'bg-red-300 cursor-not-allowed'}`}+ >+ Force Delete+ </button>+ </div>+ </div>+ </div>+ );+})()}</Card></Col></Grid>