diff --git a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx index 8cfe5cc2f1..b95d675979 100644 --- a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx +++ b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx @@ -24,7 +24,7 @@ import { TableRow, Text, } from "@tremor/react"; -import { Tooltip } from "antd"; +import { Skeleton, Tooltip } from "antd"; import React, { useEffect, useState } from "react"; import { getModelDisplayName } from "../key_team_helpers/fetch_available_models_team_key"; import { useFilterLogic } from "../key_team_helpers/filter_logic"; @@ -520,6 +520,10 @@ export function VirtualKeysTable({ teams, organizations, onSortChange, currentSo } }, [currentSort]); + const { pageIndex, pageSize } = table.getState().pagination; + const start = pageIndex * pageSize + 1; + const end = Math.min((pageIndex + 1) * pageSize, totalCount); + const rangeLabel = `${start} - ${end}`; return (
{selectedKey ? ( @@ -541,38 +545,46 @@ export function VirtualKeysTable({ teams, organizations, onSortChange, currentSo
- - Showing{" "} - {isLoading - ? "..." - : `${table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1} - ${Math.min( - (table.getState().pagination.pageIndex + 1) * table.getState().pagination.pageSize, - totalCount, - )}`}{" "} - of {isLoading ? "..." : totalCount} results - + {isLoading ? ( + + ) : ( + + Showing {rangeLabel} of {totalCount} results + + )}
- - Page {isLoading ? "..." : table.getState().pagination.pageIndex + 1} of{" "} - {isLoading ? "..." : table.getPageCount()} - + {isLoading ? ( + + ) : ( + + Page {pageIndex + 1} of {table.getPageCount()} + + )} - + {isLoading ? ( + + ) : ( + + )} - + {isLoading ? ( + + ) : ( + + )}
diff --git a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx index 83ef444d59..3cd8a04e06 100644 --- a/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx +++ b/ui/litellm-dashboard/src/components/organisms/create_key_button.tsx @@ -1,4 +1,5 @@ "use client"; +import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized"; import { formatNumberWithCommas } from "@/utils/dataUtils"; import { InfoCircleOutlined } from "@ant-design/icons"; import { Accordion, AccordionBody, AccordionHeader, Button, Col, Grid, Text, TextInput, Title } from "@tremor/react"; @@ -39,14 +40,10 @@ import VectorStoreSelector from "../vector_store_management/VectorStoreSelector" const { Option } = Select; interface CreateKeyProps { - userID: string; team: Team | null; - userRole: string | null; - accessToken: string; data: any[] | null; teams: Team[] | null; addKey: (data: any) => void; - premiumUser?: boolean; } interface User { @@ -137,16 +134,8 @@ export const fetchUserModels = async ( * Please contribute to the new refactor. * ───────────────────────────────────────────────────────────────────────── */ -const CreateKey: React.FC = ({ - userID, - team, - teams, - userRole, - accessToken, - data, - addKey, - premiumUser = false, -}) => { +const CreateKey: React.FC = ({ team, teams, data, addKey }) => { + const { accessToken, userId: userID, userRole, premiumUser } = useAuthorized(); const [form] = Form.useForm(); const [isModalVisible, setIsModalVisible] = useState(false); const [apiKey, setApiKey] = useState(null); @@ -170,7 +159,6 @@ const CreateKey: React.FC = ({ const [modelAliases, setModelAliases] = useState<{ [key: string]: string }>({}); const [autoRotationEnabled, setAutoRotationEnabled] = useState(false); const [rotationInterval, setRotationInterval] = useState("30d"); - const handleOk = () => { setIsModalVisible(false); form.resetFields(); @@ -490,14 +478,7 @@ const CreateKey: React.FC = ({ + Create New Key )} - +
{/* Section 1: Key Ownership */}
diff --git a/ui/litellm-dashboard/src/components/user_dashboard.tsx b/ui/litellm-dashboard/src/components/user_dashboard.tsx index c55cb09457..ec6de82fdf 100644 --- a/ui/litellm-dashboard/src/components/user_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/user_dashboard.tsx @@ -92,13 +92,7 @@ const UserDashboard: React.FC = ({ const [teamSpend, setTeamSpend] = useState(null); const [userModels, setUserModels] = useState([]); const [proxySettings, setProxySettings] = useState(null); - const defaultTeam: TeamInterface = { - models: [], - team_alias: "Default Team", - team_id: null, - }; const [selectedTeam, setSelectedTeam] = useState(null); - const [selectedKeyAlias, setSelectedKeyAlias] = useState(null); // check if window is not undefined if (typeof window !== "undefined") { window.addEventListener("beforeunload", function () { @@ -352,14 +346,10 @@ const UserDashboard: React.FC = ({