From 352cfaa12cc3d38c91e410589294600ee4f8f7bf Mon Sep 17 00:00:00 2001 From: Taha Ali <123803932+tahaali-dev@users.noreply.github.com> Date: Sun, 9 Feb 2025 12:55:41 +0530 Subject: [PATCH] Added filter in Teams and fixed spacing & height issues in Teams tabs (#6192) (#8357) * [Bug] UI: Newly created key does not display on the View Key Page (#8039) - Fixed issue where all keys appeared blank for admin users. - Implemented filtering of data via team settings to ensure all keys are displayed correctly. * Fix: - Updated the validator to allow model editing when `keyTeam.team_alias === "Default Team"`. - Ensured other teams still follow the original validation rules. * - added some classes in global.css - added text wrap in output of request,response and metadata in index.tsx - fixed styles of table in table.tsx * - added full payload when we open single log entry - added Combined Info Card in index.tsx * fix: keys not showing on refresh for internal user * add: search added in teams --- .../src/components/team/available_teams.tsx | 8 +++- ui/litellm-dashboard/src/components/teams.tsx | 41 ++++++++++++++----- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/ui/litellm-dashboard/src/components/team/available_teams.tsx b/ui/litellm-dashboard/src/components/team/available_teams.tsx index 2959925f424..cade9072c56 100644 --- a/ui/litellm-dashboard/src/components/team/available_teams.tsx +++ b/ui/litellm-dashboard/src/components/team/available_teams.tsx @@ -25,11 +25,13 @@ interface AvailableTeam { interface AvailableTeamsProps { accessToken: string | null; userID: string | null; + searchTerm : string | null; } const AvailableTeamsPanel: React.FC = ({ accessToken, userID, + searchTerm, }) => { const [availableTeams, setAvailableTeams] = useState([]); @@ -70,7 +72,7 @@ const AvailableTeamsPanel: React.FC = ({ return ( - + @@ -82,7 +84,9 @@ const AvailableTeamsPanel: React.FC = ({ - {availableTeams.map((team) => ( + {availableTeams + ?.filter((team) => team["team_alias"].toLowerCase().includes(searchTerm?.toLowerCase() || '')) + ?.map((team) => ( {team.team_alias} diff --git a/ui/litellm-dashboard/src/components/teams.tsx b/ui/litellm-dashboard/src/components/teams.tsx index 6b0583bef84..4f655f3eab8 100644 --- a/ui/litellm-dashboard/src/components/teams.tsx +++ b/ui/litellm-dashboard/src/components/teams.tsx @@ -140,6 +140,7 @@ const Team: React.FC = ({ const [userModels, setUserModels] = useState([]); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); const [teamToDelete, setTeamToDelete] = useState(null); + const [searchTerm,setSearchTerm] = useState() @@ -362,6 +363,24 @@ const Team: React.FC = ({ /> ) : ( +
+

Teams

+
+ setSearchTerm(e.target.value)} + /> + +
+
Your Teams @@ -385,7 +404,7 @@ const Team: React.FC = ({
- +
@@ -403,7 +422,8 @@ const Team: React.FC = ({ {teams && teams.length > 0 ? teams - .sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()) + ?.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()) + ?.filter((team) => team["team_alias"].toLowerCase().includes(searchTerm?.toLowerCase() || '')) .map((team: any) => ( = ({ > {team["team_alias"]} -
@@ -434,7 +453,6 @@ const Team: React.FC = ({
-
= ({
)) : null} + + {teams && teams?.length === 0 && ( + + + No available teams + + + )}
{isDeleteModalOpen && ( @@ -620,12 +646,6 @@ const Team: React.FC = ({ {userRole == "Admin"? ( - = ({