fix(ui): add paginated team search to usage page filter#25107
fix(ui): add paginated team search to usage page filter#25107ryan-crabbe-berri merged 2 commits intolitellm_ryan-march-31from
Conversation
Replace the static team dropdown on the usage page with a new TeamMultiSelect component that uses the paginated v2/team/list endpoint with debounced server-side search and infinite scroll.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR replaces the static, unpaginated team filter on the Usage page's Team Usage tab with a new Key changes:
Confidence Score: 4/5Safe to merge for the core paginated-search improvement; two prior-thread issues (chip label loss, ID-search mismatch) are still open and affect correctness of the UX promise made in the PR description. The new component is architecturally clean and follows established patterns. The two unresolved issues from prior rounds (selected chip labels dropping after search, alias-only search despite ID-search promise) are real UX defects the author should address before declaring the feature complete, hence 4 rather than 5. ui/litellm-dashboard/src/components/common_components/team_multi_select.tsx — chip label persistence and search-by-ID claims still need resolution.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/common_components/team_multi_select.tsx | New paginated multi-select component for teams — mirrors TeamDropdown pattern correctly with debounced search, infinite scroll deduplication, and server-side filtering; two pre-existing issues flagged in prior threads (label loss on search, alias-only search); minor null alias rendering concern flagged here. |
| ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/EntityUsage.tsx | Integrates TeamMultiSelect for the team entity type; correctly hides the old UsageExportHeader filter for teams via showFilters guard; selected team IDs flow correctly to both the backend API arg and client-side filterDataByTags. |
Sequence Diagram
sequenceDiagram
participant U as User
participant TMS as TeamMultiSelect
participant Hook as useInfiniteTeams
participant API as v2/team/list
participant EU as EntityUsage
participant DA as teamDailyActivityCall
U->>TMS: types search term
TMS->>TMS: setSearchInput (immediate, controls searchValue)
TMS->>Hook: setDebouncedSearch after 300ms
Hook->>API: GET /v2/team/list?team_alias=&page=1
API-->>Hook: TeamsResponse {teams, total_pages}
Hook-->>TMS: data.pages[]
TMS-->>U: renders deduplicated team options
U->>TMS: scrolls to 80% of dropdown
TMS->>Hook: fetchNextPage()
Hook->>API: GET /v2/team/list?team_alias=&page=2
API-->>Hook: next TeamsResponse
Hook-->>TMS: appended to data.pages
U->>TMS: selects team IDs
TMS->>EU: onChange(selectedTags)
EU->>EU: entityFilterArg = selectedTags
EU->>DA: fetch(accessToken, start, end, entityFilterArg)
DA-->>EU: filtered SpendData
EU->>EU: filterDataByTags (client-side)
EU-->>U: renders filtered usage charts
Reviews (2): Last reviewed commit: "fix(ui): fix imports and update placehol..." | Re-trigger Greptile
| {teams.map((team) => ( | ||
| <Select.Option key={team.team_id} value={team.team_id}> | ||
| <span className="font-medium">{team.team_alias}</span>{" "} | ||
| <Text type="secondary">({team.team_id})</Text> | ||
| </Select.Option> | ||
| ))} |
There was a problem hiding this comment.
Selected chips lose their display label after a search
Ant Design's <Select mode="multiple" /> uses the option's children/label to render the selected-value chips. When a user selects a team (e.g. "My Team (team_abc123)") and then types a new search term that evicts those options from the list, the chip falls back to rendering the raw value string — losing the human-readable alias.
A common fix is to always keep previously-selected teams in the options list regardless of the current search results, or pass labelInValue to Ant Design Select so the label is stored alongside the selected value and doesn't depend on the current options list.
0575c3f
into
litellm_ryan-march-31
…rch-filter fix(ui): add paginated team search to usage page filter
User Usage filter only allowed selecting from a static preloaded list, unlike Global Usage which supports debounced text search via useInfiniteUsers. Add UserSingleSelect component (single-select with useInfiniteUsers + 300ms debounce + infinite scroll) and wire it into EntityUsage for entityType === 'user', mirroring the TeamMultiSelect fix in PR BerriAI#25107. - Add src/components/common_components/user_single_select.tsx - Add src/components/common_components/user_single_select.test.tsx (10 tests) - Update EntityUsage.tsx to render UserSingleSelect for user entity type - Update EntityUsage.test.tsx to mock user_single_select
Summary
<Select>with noshowSearch, loading all teams upfront via the unpaginated v1/team/listendpointTeamMultiSelectcomponent that mirrors the existingTeamDropdownpattern — paginatedv2/team/listendpoint, debounced server-side search, infinite scroll. Options display both team alias and team ID so users can search by eitherScreenshot
greptile comment not real bug
Test plan