mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
feat(ui): add Key Alias filter to virtual keys drawer
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
9cae6fa437
commit
471fefd0c2
2 changed files with 27 additions and 1 deletions
|
|
@ -410,6 +410,24 @@ describe("server-side filtering – the LIT-4080 regression guard", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("threads an applied Key Alias filter into the useKeys query as selectedKeyAlias", async () => {
|
||||
renderWithProviders(<VirtualKeysTable />);
|
||||
|
||||
openFilters();
|
||||
|
||||
const aliasInput = await screen.findByPlaceholderText(/Enter key alias/);
|
||||
fireEvent.change(aliasInput, { target: { value: "claude-code-mub" } });
|
||||
fireEvent.click(screen.getByTestId("filter-drawer-apply"));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockUseKeys).toHaveBeenLastCalledWith(
|
||||
1,
|
||||
50,
|
||||
expect.objectContaining({ selectedKeyAlias: "claude-code-mub" }),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("does not send filter params to useKeys when no filter is active", () => {
|
||||
renderWithProviders(<VirtualKeysTable />);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ const FILTER_LABELS: Record<string, string> = {
|
|||
team_id: "Team",
|
||||
org_id: "Organization",
|
||||
user_id: "User ID",
|
||||
key_alias: "Key Alias",
|
||||
key_hash: "Key ID",
|
||||
};
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ export function VirtualKeysTable({ headerActions }: VirtualKeysTableProps) {
|
|||
const keyListOptions = {
|
||||
teamID: getFilterValue("team_id"),
|
||||
organizationID: getFilterValue("org_id"),
|
||||
selectedKeyAlias: searchQuery.trim() || undefined,
|
||||
selectedKeyAlias: getFilterValue("key_alias") || searchQuery.trim() || undefined,
|
||||
userID: getFilterValue("user_id"),
|
||||
keyHash: getFilterValue("key_hash"),
|
||||
sortBy,
|
||||
|
|
@ -233,6 +234,13 @@ export function VirtualKeysTable({ headerActions }: VirtualKeysTableProps) {
|
|||
placeholder="Enter User ID…"
|
||||
/>
|
||||
</DataTableFilterField>
|
||||
<DataTableFilterField label="Key Alias">
|
||||
<Input
|
||||
value={(get("key_alias") as string) ?? ""}
|
||||
onChange={(event) => set("key_alias", event.target.value)}
|
||||
placeholder="Enter key alias…"
|
||||
/>
|
||||
</DataTableFilterField>
|
||||
<DataTableFilterField label="Key ID">
|
||||
<Input
|
||||
value={(get("key_hash") as string) ?? ""}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue