From 0676c840a1e38348c8cc14286f8335d458aec865 Mon Sep 17 00:00:00 2001 From: tanjiro <56165694+NANDINI-star@users.noreply.github.com> Date: Tue, 20 May 2025 05:21:02 +0900 Subject: [PATCH] add keys and members (#10950) --- ui/litellm-dashboard/src/components/teams.tsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/ui/litellm-dashboard/src/components/teams.tsx b/ui/litellm-dashboard/src/components/teams.tsx index 3abbaee48a9..6c6b4dd5b58 100644 --- a/ui/litellm-dashboard/src/components/teams.tsx +++ b/ui/litellm-dashboard/src/components/teams.tsx @@ -201,6 +201,27 @@ const Teams: React.FC = ({ fetchGuardrails(); }, [accessToken]); + useEffect(() => { + const fetchTeamInfo = async () => { + if (!teams || !accessToken) return; + + const teamInfoPromises = teams.map(async (team) => { + try { + const info = await teamInfoCall(accessToken, team.team_id); + return { [team.team_id]: info }; + } catch (error) { + console.error(`Error fetching info for team ${team.team_id}:`, error); + return { [team.team_id]: null }; + } + }); + + const results = await Promise.all(teamInfoPromises); + const newPerTeamInfo = results.reduce((acc, curr) => ({ ...acc, ...curr }), {}); + setPerTeamInfo(newPerTeamInfo); + }; + + fetchTeamInfo(); + }, [teams, accessToken]); const handleOk = () => { setIsTeamModalVisible(false); @@ -721,8 +742,9 @@ const Teams: React.FC = ({ {perTeamInfo && team.team_id && perTeamInfo[team.team_id] && - perTeamInfo[team.team_id].members_with_roles && - perTeamInfo[team.team_id].members_with_roles.length}{" "} + perTeamInfo[team.team_id].team_info && + perTeamInfo[team.team_id].team_info.members_with_roles && + perTeamInfo[team.team_id].team_info.members_with_roles.length}{" "} Members