Skip to content

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]

fix(ui): warn that team models are deleted in the delete-team modal (#29990)

yuneng-jiangea17236a1efd
diff --git a/ui/litellm-dashboard/src/components/OldTeams.test.tsx b/ui/litellm-dashboard/src/components/OldTeams.test.tsx
index 4b076bbfb3c..afd456ebc7c 100644
--- a/ui/litellm-dashboard/src/components/OldTeams.test.tsx
+++ b/ui/litellm-dashboard/src/components/OldTeams.test.tsx
@@ -1038,3 +1038,65 @@ describe("OldTeams - Resources column keys badge", () => {
expect(cyanTag?.textContent).toContain("2");
});
});
+
+describe("OldTeams - delete team warning copy", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ mockUseOrganizations.mockReturnValue({ data: [] });
+ });
+
+ const openDeleteModal = async (team: any) => {
+ renderWithQueryClient(
+ <OldTeams
+ teams={[team]}
+ searchParams={{}}
+ accessToken="test-token"
+ setTeams={vi.fn()}
+ userID="user-123"
+ userRole="Admin"
+ organizations={[]}
+ />,
+ );
+ await waitFor(() => {
+ expect(screen.getByTestId("delete-team-button")).toBeInTheDocument();
+ });
+ act(() => {
+ fireEvent.click(screen.getByTestId("delete-team-button"));
+ });
+ expect(screen.getByText("Delete Team?")).toBeInTheDocument();
+ };
+
+ const baseTeam = {
+ team_id: "1",
+ team_alias: "Test Team",
+ organization_id: "org-123",
+ models: ["gpt-4"],
+ max_budget: 100,
+ budget_duration: "1d",
+ tpm_limit: 1000,
+ rpm_limit: 1000,
+ created_at: new Date().toISOString(),
+ members_with_roles: [],
+ spend: 0,
+ };
+
+ it("warns that the team's models are deleted when the team has keys", async () => {
+ await openDeleteModal({ ...baseTeam, keys: [], keys_count: 2 });
+
+ expect(screen.getByText(/Warning: This team has 2 keys associated with it/i)).toHaveTextContent(
+ /along with any models created for this team/i,
+ );
+ expect(screen.getByText(/Are you sure you want to delete this team/i)).toHaveTextContent(
+ /any models created for it/i,
+ );
+ });
+
+ it("still warns about model deletion in the confirmation message when the team has no keys", async () => {
+ await openDeleteModal({ ...baseTeam, keys: [], keys_count: 0 });
+
+ expect(screen.queryByText(/Warning: This team has/i)).not.toBeInTheDocument();
+ expect(screen.getByText(/Are you sure you want to delete this team/i)).toHaveTextContent(
+ /any models created for it/i,
+ );
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/OldTeams.tsx b/ui/litellm-dashboard/src/components/OldTeams.tsx
index c7a2ae0e61a..adfec4bdf6a 100644
--- a/ui/litellm-dashboard/src/components/OldTeams.tsx
+++ b/ui/litellm-dashboard/src/components/OldTeams.tsx
@@ -967,9 +967,9 @@ const Teams: React.FC<TeamProps> = ({ accessToken, userID, userRole, premiumUser
const deleteKeyCount = teamToDelete?.keys_count ?? teamToDelete?.keys?.length ?? 0;
return deleteKeyCount === 0
? undefined
- : `Warning: This team has ${deleteKeyCount} keys associated with it. Deleting the team will also delete all associated keys. This action is irreversible.`;
+ : `Warning: This team has ${deleteKeyCount} keys associated with it. Deleting the team will also delete all associated keys, along with any models created for this team. This action is irreversible.`;
})()}
- message="Are you sure you want to delete this team and all its keys? This action cannot be undone."
+ message="Are you sure you want to delete this team, all its keys, and any models created for it? This action cannot be undone."
resourceInformationTitle="Team Information"
resourceInformation={[
{ label: "Team ID", value: teamToDelete?.team_id, code: true },