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]

Delete user and mcp server modal and mcp table tooltips (#16751)

yuneng-jiangf1c5ed19aa09
diff --git a/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_columns.tsx b/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_columns.tsx
index 2e128f32d80..1bf719ef904 100644
--- a/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_columns.tsx
+++ b/ui/litellm-dashboard/src/components/mcp_tools/mcp_server_columns.tsx
@@ -154,13 +154,22 @@ export const mcpServerColumns = (
header: "Actions",
cell: ({ row }) => (
<div className="flex items-center gap-2">
- <Icon
- icon={PencilAltIcon}
- size="sm"
- onClick={() => onEdit(row.original.server_id)}
- className="cursor-pointer"
- />
- <Icon icon={TrashIcon} size="sm" onClick={() => onDelete(row.original.server_id)} className="cursor-pointer" />
+ <Tooltip title="Edit MCP Server">
+ <Icon
+ icon={PencilAltIcon}
+ size="sm"
+ onClick={() => onEdit(row.original.server_id)}
+ className="cursor-pointer hover:text-blue-600"
+ />
+ </Tooltip>
+ <Tooltip title="Delete MCP Server">
+ <Icon
+ icon={TrashIcon}
+ size="sm"
+ onClick={() => onDelete(row.original.server_id)}
+ className="cursor-pointer hover:text-red-600"
+ />
+ </Tooltip>
</div>
),
},
diff --git a/ui/litellm-dashboard/src/components/mcp_tools/mcp_servers.test.tsx b/ui/litellm-dashboard/src/components/mcp_tools/mcp_servers.test.tsx
new file mode 100644
index 00000000000..b6323397524
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/mcp_tools/mcp_servers.test.tsx
@@ -0,0 +1,125 @@
+import React from "react";
+import { render, waitFor } from "@testing-library/react";
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import MCPServers from "./mcp_servers";
+import * as networking from "../networking";
+
+// Mock the networking module
+vi.mock("../networking", () => ({
+ fetchMCPServers: vi.fn(),
+ deleteMCPServer: vi.fn(),
+ getProxyBaseUrl: vi.fn().mockReturnValue("http://localhost:4000"),
+}));
+
+// Mock NotificationsManager
+vi.mock("../molecules/notifications_manager", () => ({
+ default: {
+ success: vi.fn(),
+ fromBackend: vi.fn(),
+ },
+}));
+
+const createQueryClient = () =>
+ new QueryClient({
+ defaultOptions: {
+ queries: {
+ retry: false,
+ gcTime: 0,
+ },
+ },
+ });
+
+describe("MCPServers", () => {
+ const defaultProps = {
+ accessToken: "test-token",
+ userRole: "Admin",
+ userID: "admin-user-id",
+ };
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("should render the MCPServers component with title", async () => {
+ // Mock empty response for simple render test
+ vi.mocked(networking.fetchMCPServers).mockResolvedValue([]);
+
+ const queryClient = createQueryClient();
+ const { getByText } = render(
+ <QueryClientProvider client={queryClient}>
+ <MCPServers {...defaultProps} />
+ </QueryClientProvider>,
+ );
+
+ // Wait for the component to load and check if title renders
+ await waitFor(() => {
+ expect(getByText("MCP Servers")).toBeInTheDocument();
+ });
+
+ // Verify the title is rendered
+ expect(getByText("MCP Servers")).toBeInTheDocument();
+ });
+
+ it("should render mocked MCP servers data in the table", async () => {
+ // Mock MCP servers data
+ const mockServers = [
+ {
+ server_id: "server-1",
+ server_name: "Test Server 1",
+ alias: "test-server-1",
+ url: "https://example.com/mcp",
+ transport: "http",
+ auth_type: "none",
+ created_at: "2024-01-01T00:00:00Z",
+ created_by: "user-1",
+ updated_at: "2024-01-01T00:00:00Z",
+ updated_by: "user-1",
+ teams: [],
+ mcp_access_groups: [],
+ },
+ {
+ server_id: "server-2",
+ server_name: "Test Server 2",
+ alias: "test-server-2",
+ url: "https://example2.com/mcp",
+ transport: "sse",
+ auth_type: "api_key",
+ created_at: "2024-01-02T00:00:00Z",
+ created_by: "user-2",
+ updated_at: "2024-01-02T00:00:00Z",
+ updated_by: "user-2",
+ teams: [],
+ mcp_access_groups: ["group-1"],
+ },
+ ];
+
+ vi.mocked(networking.fetchMCPServers).mockResolvedValue(mockServers);
+
+ const queryClient = createQueryClient();
+ const { getByText } = render(
+ <QueryClientProvider client={queryClient}>
+ <MCPServers {...defaultProps} />
+ </QueryClientProvider>,
+ );
+
+ // Wait for the component to load
+ await waitFor(() => {
+ expect(getByText("MCP Servers")).toBeInTheDocument();
+ });
+
+ // Wait for the mocked data to render in the table
+ await waitFor(() => {
+ expect(getByText("Test Server 1")).toBeInTheDocument();
+ });
+
+ // Verify the mocked server data is rendered in the table
+ expect(getByText("Test Server 1")).toBeInTheDocument();
+ expect(getByText("Test Server 2")).toBeInTheDocument();
+ expect(getByText("test-server-1")).toBeInTheDocument();
+ expect(getByText("test-server-2")).toBeInTheDocument();
+
+ // Verify the API was called
+ expect(networking.fetchMCPServers).toHaveBeenCalledWith("test-token");
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/mcp_tools/mcp_servers.tsx b/ui/litellm-dashboard/src/components/mcp_tools/mcp_servers.tsx
index 30ac44bd12a..82435383ab0 100644
--- a/ui/litellm-dashboard/src/components/mcp_tools/mcp_servers.tsx
+++ b/ui/litellm-dashboard/src/components/mcp_tools/mcp_servers.tsx
@@ -1,40 +1,21 @@
-import React, { useState, useEffect } from "react";
+import { isAdminRole } from "@/utils/roles";
+import { QuestionCircleOutlined } from "@ant-design/icons";
import { useQuery } from "@tanstack/react-query";
-import { Modal, Select, Tooltip } from "antd";
-import { TabPanel, TabPanels, TabGroup, TabList, Tab, Button } from "@tremor/react";
-import { Grid, Col, Title, Text } from "@tremor/react";
-import { DataTable } from "../view_logs/table";
-import { mcpServerColumns } from "./mcp_server_columns";
+import { Button, Tab, TabGroup, TabList, TabPanel, TabPanels, Text, Title } from "@tremor/react";
+import { Descriptions, Modal, Select, Tooltip, Typography } from "antd";
+import React, { useEffect, useState } from "react";
+import NotificationsManager from "../molecules/notifications_manager";
import { deleteMCPServer, fetchMCPServers } from "../networking";
-import { MCPServer, MCPServerProps, Team } from "./types";
-import { isAdminRole } from "@/utils/roles";
-import { MCPServerView } from "./mcp_server_view";
+import { DataTable } from "../view_logs/table";
import CreateMCPServer from "./create_mcp_server";
import MCPConnect from "./mcp_connect";
-import { QuestionCircleOutlined } from "@ant-design/icons";
-import NotificationsManager from "../molecules/notifications_manager";
+import { mcpServerColumns } from "./mcp_server_columns";
+import { MCPServerView } from "./mcp_server_view";
+import { MCPServer, MCPServerProps, Team } from "./types";
+const { Text: AntdText, Title: AntdTitle } = Typography;
const { Option } = Select;
-const DeleteModal: React.FC<{
- isModalOpen: boolean;
- title: string;
- confirmDelete: () => void;
- cancelDelete: () => void;
-}> = ({ isModalOpen, title, confirmDelete, cancelDelete }) => {
- if (!isModalOpen) return null;
- return (
- <Modal open={isModalOpen} onOk={confirmDelete} okType="danger" onCancel={cancelDelete}>
- <Grid numItems={1} className="gap-2 w-full">
- <Title>{title}</Title>
- <Col numColSpan={1}>
- <p>Are you sure you want to delete this MCP Server?</p>
- </Col>
- </Grid>
- </Modal>
- );
-};
-
const MCPServers: React.FC<MCPServerProps> = ({ accessToken, userRole, userID }) => {
const {
data: mcpServers,
@@ -70,7 +51,7 @@ const MCPServers: React.FC<MCPServerProps> = ({ accessToken, userRole, userID })
const [selectedMcpAccessGroup, setSelectedMcpAccessGroup] = useState<string>("all");
const [filteredServers, setFilteredServers] = useState<MCPServer[]>([]);
const [isModalVisible, setModalVisible] = useState(false);
-
+ const [isDeletingServer, setIsDeletingServer] = useState(false);
const isInternalUser = userRole === "Internal User";
// Get unique teams from all servers
@@ -165,14 +146,17 @@ const MCPServers: React.FC<MCPServerProps> = ({ accessToken, userRole, userID })
return;
}
try {
+ setIsDeletingServer(true);
await deleteMCPServer(accessToken, serverIdToDelete);
NotificationsManager.success("Deleted MCP Server successfully");
refetch();
} catch (error) {
console.error("Error deleting the mcp server:", error);
+ } finally {
+ setIsDeletingServer(false);
+ setIsDeleteModalOpen(false);
+ setServerToDelete(null);
}
- setIsDeleteModalOpen(false);
- setServerToDelete(null);
};
const cancelDelete = () => {
@@ -180,6 +164,11 @@ const MCPServers: React.FC<MCPServerProps> = ({ accessToken, userRole, userID })
setServerToDelete(null);
};
+ // Find the server to delete from the servers list
+ const serverToDelete = serverIdToDelete
+ ? (mcpServers || []).find((server) => server.server_id === serverIdToDelete)
+ : null;
+
const handleCreateSuccess = (newMcpServer: MCPServer) => {
setFilteredServers((prev) => [...prev, newMcpServer]);
setModalVisible(false);
@@ -289,12 +278,51 @@ const MCPServers: React.FC<MCPServerProps> = ({ accessToken, userRole, userID })
return (
<div className="w-full h-full p-6">
- <DeleteModal
- isModalOpen={isDeleteModalOpen}
- title="Delete MCP Server"
- confirmDelete={confirmDelete}
- cancelDelete={cancelDelete}
- />
+ <Modal
+ open={isDeleteModalOpen}
+ title="Delete MCP Server?"
+ onOk={confirmDelete}
+ okText={isDeletingServer ? "Deleting..." : "Delete"}
+ onCancel={cancelDelete}
+ cancelText="Cancel"
+ cancelButtonProps={{ disabled: isDeletingServer }}
+ okButtonProps={{ danger: true }}
+ confirmLoading={isDeletingServer}
+ >
+ <div className="space-y-4">
+ <AntdText>Are you sure you want to delete this MCP Server? This action cannot be undone.</AntdText>
+
+ {serverToDelete && (
+ <div className="mt-4 p-4 bg-red-50 rounded-lg border border-red-200">
+ <AntdTitle level={5} className="mb-3 text-gray-900">
+ Server Information
+ </AntdTitle>
+ <Descriptions column={1} size="small">
+ {serverToDelete.server_name && (
+ <Descriptions.Item label={<span className="font-semibold text-gray-700">Server Name</span>}>
+ <AntdText className="text-sm">{serverToDelete.server_name}</AntdText>
+ </Descriptions.Item>
+ )}
+ {serverToDelete.alias && (
+ <Descriptions.Item label={<span className="font-semibold text-gray-700">Alias</span>}>
+ <AntdText className="text-sm">{serverToDelete.alias}</AntdText>
+ </Descriptions.Item>
+ )}
+ <Descriptions.Item label={<span className="font-semibold text-gray-700">Server ID</span>}>
+ <AntdText code className="text-sm">
+ {serverToDelete.server_id}
+ </AntdText>
+ </Descriptions.Item>
+ <Descriptions.Item label={<span className="font-semibold text-gray-700">URL</span>}>
+ <AntdText code className="text-sm">
+ {serverToDelete.url}
+ </AntdText>
+ </Descriptions.Item>
+ </Descriptions>
+ </div>
+ )}
+ </div>
+ </Modal>
<CreateMCPServer
userRole={userRole}
accessToken={accessToken}
diff --git a/ui/litellm-dashboard/src/components/view_users.test.tsx b/ui/litellm-dashboard/src/components/view_users.test.tsx
new file mode 100644
index 00000000000..c327d1efaa8
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/view_users.test.tsx
@@ -0,0 +1,167 @@
+import React from "react";
+import { render, waitFor, screen, fireEvent } from "@testing-library/react";
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import ViewUserDashboard from "./view_users";
+
+// Mock the networking module
+vi.mock("./networking", () => ({
+ userListCall: vi.fn().mockResolvedValue({
+ users: [
+ {
+ user_id: "user-1",
+ user_email: "[email protected]",
+ user_role: "Admin",
+ spend: 100.5,
+ max_budget: null,
+ key_count: 2,
+ created_at: "2024-01-01T00:00:00Z",
+ updated_at: "2024-01-01T00:00:00Z",
+ sso_user_id: null,
+ budget_duration: null,
+ },
+ ],
+ total: 1,
+ page: 1,
+ page_size: 25,
+ total_pages: 1,
+ }),
+ userDeleteCall: vi.fn().mockResolvedValue({}),
+ getPossibleUserRoles: vi.fn().mockResolvedValue({
+ Admin: { ui_label: "Admin" },
+ User: { ui_label: "User" },
+ }),
+ modelAvailableCall: vi.fn().mockResolvedValue({ data: [] }),
+ invitationCreateCall: vi.fn().mockResolvedValue({}),
+ userUpdateUserCall: vi.fn().mockResolvedValue({}),
+ getProxyBaseUrl: vi.fn().mockReturnValue("http://localhost:4000"),
+ getProxyUISettings: vi.fn().mockResolvedValue({
+ PROXY_BASE_URL: null,
+ PROXY_LOGOUT_URL: null,
+ DEFAULT_TEAM_DISABLED: false,
+ SSO_ENABLED: false,
+ }),
+ getInternalUserSettings: vi.fn().mockResolvedValue({}),
+}));
+
+// Mock NotificationsManager
+vi.mock("./molecules/notifications_manager", () => ({
+ default: {
+ success: vi.fn(),
+ fromBackend: vi.fn(),
+ },
+}));
+
+const createQueryClient = () =>
+ new QueryClient({
+ defaultOptions: {
+ queries: {
+ retry: false,
+ gcTime: 0,
+ },
+ },
+ });
+
+describe("ViewUserDashboard", () => {
+ const defaultProps = {
+ accessToken: "test-token",
+ token: "test-token",
+ keys: null,
+ userRole: "Admin",
+ userID: "admin-user-id",
+ teams: [],
+ setKeys: vi.fn(),
+ };
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it("should render the ViewUserDashboard component", async () => {
+ const queryClient = createQueryClient();
+ render(
+ <QueryClientProvider client={queryClient}>
+ <ViewUserDashboard {...defaultProps} />
+ </QueryClientProvider>,
+ );
+
+ // Wait for the component to load (it shows "Loading..." initially)
+ await waitFor(() => {
+ expect(screen.getByText("Users")).toBeInTheDocument();
+ });
+
+ // Check if main elements are rendered
+ expect(screen.getByText("Users")).toBeInTheDocument();
+ // Use getAllByText since "Default User Settings" appears multiple times
+ const defaultUserSettingsTabs = screen.getAllByText("Default User Settings");
+ expect(defaultUserSettingsTabs.length).toBeGreaterThan(0);
+ });
+
+ it("should show delete modal after clicking delete user button", async () => {
+ const queryClient = createQueryClient();
+ render(
+ <QueryClientProvider client={queryClient}>
+ <ViewUserDashboard {...defaultProps} />
+ </QueryClientProvider>,
+ );
+
+ // Wait for the component to load and the table to render
+ await waitFor(() => {
+ expect(screen.getByText("Users")).toBeInTheDocument();
+ });
+
+ // Wait for the user data to load
+ await waitFor(() => {
+ expect(screen.getAllByText("[email protected]").length).toBeGreaterThan(0);
+ });
+
+ // Initially, the delete modal should not be visible
+ expect(screen.queryByText("Delete User?")).not.toBeInTheDocument();
+
+ // Find the row containing the user email (use the first one which is in the table)
+ // The email appears in both the table and potentially in modals, so get the first one from the table
+ const userEmailCells = screen.getAllByText("[email protected]");
+ const userEmailCell = userEmailCells[0]; // First occurrence is in the table
+ const userRow = userEmailCell.closest("tr");
+ expect(userRow).toBeInTheDocument();
+
+ // Find clickable elements in the actions column (the last column)
+ const actionCells = userRow?.querySelectorAll("td");
+ const actionsCell = actionCells?.[actionCells.length - 1];
+ expect(actionsCell).toBeInTheDocument();
+
+ // Find the action container div with flex gap-2
+ const actionContainer =
+ actionsCell?.querySelector("div.flex.gap-2") ||
+ Array.from(actionsCell?.querySelectorAll("div") || []).find(
+ (div) => div.className.includes("flex") && div.className.includes("gap"),
+ );
+
+ expect(actionContainer).toBeInTheDocument();
+
+ // Get all direct children of the action container
+ // These should be Tooltip components wrapping Icon components
+ const tooltipWrappers = Array.from(actionContainer!.children);
+ expect(tooltipWrappers.length).toBeGreaterThanOrEqual(2);
+
+ // The delete icon is the second tooltip wrapper (index 1)
+ // Edit=0, Delete=1, Reset=2
+ const deleteTooltipWrapper = tooltipWrappers[1] as HTMLElement;
+ const clickableElement = deleteTooltipWrapper.querySelector("button, [role='button'], svg") as HTMLElement;
+
+ expect(clickableElement).toBeInTheDocument();
+
+ fireEvent.click(clickableElement);
+
+ await waitFor(() => {
+ expect(screen.getByText("Delete User?")).toBeInTheDocument();
+ });
+
+ expect(
+ screen.getByText("Are you sure you want to delete this user? This action cannot be undone."),
+ ).toBeInTheDocument();
+ expect(screen.getByText("user-1")).toBeInTheDocument();
+ const emailInstances = screen.getAllByText("[email protected]");
+ expect(emailInstances.length).toBeGreaterThan(0);
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/view_users.tsx b/ui/litellm-dashboard/src/components/view_users.tsx
index d0f17031ffc..1d456dd0b8a 100644
--- a/ui/litellm-dashboard/src/components/view_users.tsx
+++ b/ui/litellm-dashboard/src/components/view_users.tsx
@@ -26,6 +26,9 @@ import { updateExistingKeys } from "@/utils/dataUtils";
import { useDebouncedState } from "@tanstack/react-pacer/debouncer";
import { isAdminRole } from "@/utils/roles";
import NotificationsManager from "./molecules/notifications_manager";
+import { Modal, Typography, Descriptions } from "antd";
+
+const { Text, Title } = Typography;
interface ViewUserDashboardProps {
accessToken: string | null;
@@ -71,7 +74,8 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({ accessToken, toke
const [editModalVisible, setEditModalVisible] = useState(false);
const [selectedUser, setSelectedUser] = useState<UserInfo | null>(null);
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
- const [userToDelete, setUserToDelete] = useState<string | null>(null);
+ const [isDeletingUser, setIsDeletingUser] = useState(false);
+ const [userToDelete, setUserToDelete] = useState<UserInfo | null>(null);
const [activeTab, setActiveTab] = useState("users");
const [filters, setFilters] = useState<FilterState>(initialFilters);
const [debouncedFilters, setDebouncedFilters, debouncer] = useDebouncedState(filters, { wait: 300 });
@@ -83,8 +87,8 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({ accessToken, toke
const [selectionMode, setSelectionMode] = useState(false);
const [userModels, setUserModels] = useState<string[]>([]);
- const handleDelete = (userId: string) => {
- setUserToDelete(userId);
+ const handleDelete = (user: UserInfo) => {
+ setUserToDelete(user);
setIsDeleteModalOpen(true);
};
@@ -148,12 +152,13 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({ accessToken, toke
const confirmDelete = async () => {
if (userToDelete && accessToken) {
try {
- await userDeleteCall(accessToken, [userToDelete]);
+ setIsDeletingUser(true);
+ await userDeleteCall(accessToken, [userToDelete.user_id]);
// Update the user list after deletion
queryClient.setQueriesData<UserListResponse>({ queryKey: ["userList"] }, (previousData) => {
if (previousData === undefined) return previousData;
- const updatedUsers = previousData.users.filter((user) => user.user_id !== userToDelete);
+ const updatedUsers = previousData.users.filter((user) => user.user_id !== userToDelete.user_id);
return { ...previousData, users: updatedUsers };
});
@@ -161,10 +166,12 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({ accessToken, toke
} catch (error) {
console.error("Error deleting user:", error);
NotificationsManager.fromBackend("Failed to delete user");
+ } finally {
+ setIsDeleteModalOpen(false);
+ setUserToDelete(null);
+ setIsDeletingUser(false);
}
}
- setIsDeleteModalOpen(false);
- setUserToDelete(null);
};
const cancelDelete = () => {
@@ -372,39 +379,53 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({ accessToken, toke
{/* Delete Confirmation Modal */}
{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">
- &#8203;
- </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 User</h3>
- <div className="mt-2">
- <p className="text-sm text-gray-500">Are you sure you want to delete this user?</p>
- <p className="text-sm font-medium text-gray-900 mt-2">User ID: {userToDelete}</p>
- </div>
- </div>
- </div>
+ <Modal
+ title="Delete User?"
+ open={isDeleteModalOpen}
+ onCancel={cancelDelete}
+ onOk={confirmDelete}
+ okText={isDeletingUser ? "Deleting..." : "Delete"}
+ cancelText="Cancel"
+ cancelButtonProps={{ disabled: isDeletingUser }}
+ okButtonProps={{ danger: true }}
+ confirmLoading={isDeletingUser}
+ >
+ <div className="space-y-4">
+ <Text>Are you sure you want to delete this user? This action cannot be undone.</Text>
+
+ {userToDelete && (
+ <div className="mt-4 p-4 bg-red-50 rounded-lg border border-red-200">
+ <Title level={5} className="mb-3 text-gray-900">
+ User Information
+ </Title>
+ <Descriptions column={1} size="small">
+ {userToDelete.user_email && (
+ <Descriptions.Item label={<span className="font-semibold text-gray-700">Email</span>}>
+ <Text className="text-sm">{userToDelete.user_email}</Text>
+ </Descriptions.Item>
+ )}
+ <Descriptions.Item label={<span className="font-semibold text-gray-700">User ID</span>}>
+ <Text code className="text-sm">
+ {userToDelete.user_id}
+ </Text>
+ </Descriptions.Item>
+ {userToDelete.user_role && (
+ <Descriptions.Item label={<span className="font-semibold text-gray-700">Role</span>}>
+ <Text className="text-sm">
+ {possibleUIRoles?.[userToDelete.user_role]?.ui_label || userToDelete.user_role}
+ </Text>
+ </Descriptions.Item>
+ )}
+ {userToDelete.spend !== undefined && (
+ <Descriptions.Item label={<span className="font-semibold text-gray-700">Total Spend</span>}>
+ <Text className="text-sm">${userToDelete.spend.toFixed(2)}</Text>
+ </Descriptions.Item>
+ )}
+ </Descriptions>
</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>
+ </Modal>
)}
<OnboardingModal
diff --git a/ui/litellm-dashboard/src/components/view_users/columns.tsx b/ui/litellm-dashboard/src/components/view_users/columns.tsx
index cb6c54d4d52..32bfa0ed6d2 100644
--- a/ui/litellm-dashboard/src/components/view_users/columns.tsx
+++ b/ui/litellm-dashboard/src/components/view_users/columns.tsx
@@ -17,7 +17,7 @@ interface SelectionOptions {
export const columns = (
possibleUIRoles: Record<string, Record<string, string>>,
handleEdit: (user: UserInfo) => void,
- handleDelete: (userId: string) => void,
+ handleDelete: (user: UserInfo) => void,
handleResetPassword: (userId: string) => void,
handleUserClick: (userId: string, openInEditMode?: boolean) => void,
selectionOptions?: SelectionOptions,
@@ -124,7 +124,7 @@ export const columns = (
<Icon
icon={TrashIcon}
size="sm"
- onClick={() => handleDelete(row.original.user_id)}
+ onClick={() => handleDelete(row.original)}
className="cursor-pointer hover:text-red-600"
/>
</Tooltip>
diff --git a/ui/litellm-dashboard/src/components/view_users/table.tsx b/ui/litellm-dashboard/src/components/view_users/table.tsx
index f1565f220e1..7ce8f4ce650 100644
--- a/ui/litellm-dashboard/src/components/view_users/table.tsx
+++ b/ui/litellm-dashboard/src/components/view_users/table.tsx
@@ -39,7 +39,7 @@ interface UserDataTableProps {
userRole: string | null;
possibleUIRoles: Record<string, Record<string, string>> | null;
handleEdit: (user: UserInfo) => void;
- handleDelete: (userId: string) => void;
+ handleDelete: (user: UserInfo) => void;
handleResetPassword: (userId: string) => void;
selectedUsers?: UserInfo[];
onSelectionChange?: (selectedUsers: UserInfo[]) => void;