Skip to content

Enable Partial User ID Search on Virtual Keys Page #12220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NANDINI-star
Copy link
Collaborator

@NANDINI-star NANDINI-star commented Jul 1, 2025

Title

Enable Partial User ID Search on Virtual Keys Page

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🆕 Enhancement

Changes

  • This PR resolves an issue on the virtual keys page where the User ID filter required an exact match making it difficult to find keys without knowing the complete User ID.

  • This PR introduces client-side filtering for the User ID field to provide a more intuitive and flexible search experience.

  • The key changes are in the useFilterLogic hook (/ui/litellm-dashboard/src/components/key_team_helpers/filter_logic.tsx):

    • Partial, Case-Insensitive Search: The User ID filter now performs a partial, case-insensitive search on the list of keys returned from the server.
    • Decoupled Filtering Logic: Server-side calls now fetch keys based on broader criteria (like Team or Organization) without attempting an exact match on the User ID.
    • A useEffect hook handles the client-side filtering for the User ID, ensuring a fast and responsive search experience as the user types.
    • Initial State Handling: Fixed a bug where the keys table would be empty on initial page load. The component now correctly displays the initial set of keys before any filters are applied.
    • Code Refinements: Refactored the filtering logic to use const instead of let, improving code quality and predictability.

    https://www.loom.com/share/0020c88e04254111a61f88ebe3735088?sid=833e7676-e137-4394-8fe0-f53acbd604d9

Copy link

vercel bot commented Jul 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 1, 2025 10:44pm

Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed

@@ -158,22 +161,11 @@ export function useFilterLogic({
}, [organizations]);

const handleFilterChange = (newFilters: Record<string, string>) => {
// Update filters state
setFilters({
'Team ID': newFilters['Team ID'] || '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like it removes the team filter and key alias filter

const filteredData = serverData.filter(
(key) =>
key.user_id &&
key.user_id.toLowerCase().includes(userIdFilter.toLowerCase())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this just a frontend search ? so just on the first page ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants