Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

feat(ui): find a row by its pasted ID on every list page

ryan-crabbe-berria6b7ef6abed7
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentsTable.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentsTable.test.tsx
index 4d18ec2ef5f..bef938cd31c 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentsTable.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentsTable.test.tsx
@@ -90,7 +90,7 @@ describe("AgentsTable", () => {
/>,
);
- const search = screen.getByPlaceholderText("Search agent names or descriptions...");
+ const search = screen.getByPlaceholderText("Search agents by name, ID, or description...");
await user.type(search, "billing");
expect(screen.getByText("Billing Router")).toBeInTheDocument();
expect(screen.queryByText("Second Agent")).not.toBeInTheDocument();
@@ -101,11 +101,36 @@ describe("AgentsTable", () => {
expect(screen.queryByText("Billing Router")).not.toBeInTheDocument();
});
+ it("filters agents by a pasted agent_id so only that agent's row survives", async () => {
+ const user = userEvent.setup();
+ render(
+ <AgentsTable
+ agents={[
+ makeAgent({ agent_id: "5f3c2a1b-9d8e-4f7a-b6c5-d4e3f2a1b0c9", agent_name: "Billing Router" }),
+ makeAgent({ agent_id: "0a9b8c7d-6e5f-4a3b-8c2d-1e0f9a8b7c6d", agent_name: "Second Agent" }),
+ ]}
+ {...baseProps}
+ />,
+ );
+
+ const search = screen.getByPlaceholderText("Search agents by name, ID, or description...");
+ await user.click(search);
+ await user.paste("5f3c2a1b-9d8e-4f7a-b6c5-d4e3f2a1b0c9");
+ expect(screen.getByText("Billing Router")).toBeInTheDocument();
+ expect(screen.queryByText("Second Agent")).not.toBeInTheDocument();
+
+ await user.clear(search);
+ await user.paste("ffffffff-0000-4000-8000-000000000000");
+ expect(screen.queryByText("Billing Router")).not.toBeInTheDocument();
+ expect(screen.queryByText("Second Agent")).not.toBeInTheDocument();
+ expect(screen.getByText("No matching agents")).toBeInTheDocument();
+ });
+
it("shows the no-match empty state when the search matches nothing", async () => {
const user = userEvent.setup();
render(<AgentsTable agents={[makeAgent()]} {...baseProps} />);
- await user.type(screen.getByPlaceholderText("Search agent names or descriptions..."), "zzzz");
+ await user.type(screen.getByPlaceholderText("Search agents by name, ID, or description..."), "zzzz");
expect(screen.queryByText("Test Agent")).not.toBeInTheDocument();
expect(screen.getByText("No matching agents")).toBeInTheDocument();
});
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentsTable.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentsTable.tsx
index 35ed6b66425..aceb07e2e9a 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentsTable.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/AgentsTable.tsx
@@ -55,7 +55,12 @@ const AgentsTable: React.FC<AgentsTableProps> = ({
const [sorting, setSorting] = useState<SortingState>(DEFAULT_SORTING);
const [searchTerm, setSearchTerm] = useState("");
const filteredAgents = useMemo(
- () => filterBySearchTerm(agents, searchTerm, (agent) => [agent.agent_name, agent.agent_card_params?.description]),
+ () =>
+ filterBySearchTerm(agents, searchTerm, (agent) => [
+ agent.agent_name,
+ agent.agent_id,
+ agent.agent_card_params?.description,
+ ]),
[agents, searchTerm],
);
@@ -83,7 +88,7 @@ const AgentsTable: React.FC<AgentsTableProps> = ({
<SearchIcon className="size-4 text-muted-foreground" />
</InputGroupAddon>
<InputGroupInput
- placeholder="Search agent names or descriptions..."
+ placeholder="Search agents by name, ID, or description..."
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/keys/useKeys.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/keys/useKeys.test.ts
index 8c9b33f2c3e..f23fcf811f2 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/keys/useKeys.test.ts
+++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/keys/useKeys.test.ts
@@ -518,6 +518,24 @@ describe("useKeys", () => {
const callUrl = mockFetch.mock.calls[0][0];
expect(callUrl).not.toContain("agent_id");
});
+
+ it("sends the combined alias-or-ID search as the search param, separate from key_alias and key_hash", async () => {
+ mockFetch.mockResolvedValueOnce({
+ ok: true,
+ json: async () => mockKeysResponse,
+ });
+
+ const { result } = renderHook(() => useKeys(1, 10, { search: "sk-pasted-key" }), { wrapper });
+
+ await waitFor(() => {
+ expect(result.current.isLoading).toBe(false);
+ });
+
+ const callUrl = new URL(mockFetch.mock.calls[0][0], "http://localhost");
+ expect(callUrl.searchParams.get("search")).toBe("sk-pasted-key");
+ expect(callUrl.searchParams.has("key_alias")).toBe(false);
+ expect(callUrl.searchParams.has("key_hash")).toBe(false);
+ });
});
describe("useDeletedKeys", () => {
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/keys/useKeys.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/keys/useKeys.ts
index 94ded01679d..7e7089e685f 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/keys/useKeys.ts
+++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/keys/useKeys.ts
@@ -40,6 +40,7 @@ export interface KeyListCallOptions {
selectedKeyAlias?: string | null;
userID?: string | null;
keyHash?: string | null;
+ search?: string | null;
sortBy?: string | null;
sortOrder?: string | null;
expand?: string | null;
@@ -61,6 +62,7 @@ const keyListCall = async (accessToken: string, page: number, pageSize: number,
organization_id: options.organizationID,
key_alias: options.selectedKeyAlias,
key_hash: options.keyHash,
+ search: options.search,
user_id: options.userID,
page,
size: pageSize,
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.test.tsx
index 5100b998b80..984b8135466 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.test.tsx
@@ -95,6 +95,7 @@ describe("MemoryTable", () => {
it("shows the filtered-empty copy when a search is active", () => {
render(<MemoryTable {...baseProps} data={[]} rowCount={0} hasActiveSearch={true} />);
expect(screen.getByText("No matching memories")).toBeInTheDocument();
+ expect(screen.getByText("No memories match your search.")).toBeInTheDocument();
expect(screen.queryByText("No memories stored yet")).not.toBeInTheDocument();
});
@@ -128,6 +129,7 @@ describe("MemoryTable", () => {
const onRefresh = vi.fn();
render(<MemoryTable {...baseProps} onSearchChange={onSearchChange} onRefresh={onRefresh} />);
+ expect(screen.getByPlaceholderText("Search by key prefix or memory ID…")).toBeInTheDocument();
fireEvent.change(screen.getByTestId("datatable-search"), { target: { value: "u" } });
expect(onSearchChange).toHaveBeenCalledWith("u");
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.tsx b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.tsx
index 50dd04ee14c..3e37faafe15 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryTable.tsx
@@ -36,7 +36,7 @@ function MemoryEmptyState({ hasActiveSearch }: { hasActiveSearch: boolean }) {
</div>
<div className="text-sm text-muted-foreground">
{hasActiveSearch
- ? "No memories have keys starting with your search."
+ ? "No memories match your search."
: "Memories your agents store under /v1/memory will appear here."}
</div>
</div>
@@ -81,7 +81,7 @@ export function MemoryTable({
table={table}
searchValue={searchValue}
onSearchChange={onSearchChange}
- searchPlaceholder='Filter by key prefix, e.g. "user:"'
+ searchPlaceholder="Search by key prefix or memory ID…"
onRefresh={onRefresh}
isRefreshing={isRefreshing}
showViewOptions={false}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryView.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryView.test.tsx
index 9ccef5357b9..b703df652c2 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryView.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryView.test.tsx
@@ -1,8 +1,9 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { act, render, screen } from "@testing-library/react";
+import type { PaginationState } from "@tanstack/react-table";
+import { act, render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import React from "react";
-import { describe, expect, it, vi } from "vitest";
+import { beforeEach, describe, expect, it, vi } from "vitest";
import { MemoryRow } from "@/components/networking";
@@ -13,10 +14,13 @@ interface CapturedTableProps {
rowCount: number;
data: MemoryRow[];
hasActiveSearch: boolean;
+ onSearchChange: (value: string) => void;
+ onPaginationChange: (state: PaginationState) => void;
onViewClick: (row: MemoryRow) => void;
}
const captured = vi.hoisted(() => ({ current: null as CapturedTableProps | null }));
+const fetchMemoryListMock = vi.hoisted(() => vi.fn());
vi.mock("./MemoryTable", () => ({
MemoryTable: function MemoryTableMock(props: CapturedTableProps) {
@@ -25,6 +29,15 @@ vi.mock("./MemoryTable", () => ({
},
}));
+vi.mock("@/components/networking", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@/components/networking")>()),
+ fetchMemoryList: fetchMemoryListMock,
+}));
+
+vi.mock("@tanstack/react-pacer/debouncer", () => ({
+ useDebouncedValue: (value: unknown) => [value, { cancel: vi.fn(), flush: vi.fn() }],
+}));
+
const renderView = (accessToken: string | null) => {
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
return render(
@@ -35,6 +48,28 @@ const renderView = (accessToken: string | null) => {
};
describe("MemoryView", () => {
+ beforeEach(() => {
+ fetchMemoryListMock.mockReset();
+ fetchMemoryListMock.mockResolvedValue({ memories: [], total: 0 });
+ });
+
+ it("queries the server with the search box value as `search` and resets to page 1", async () => {
+ renderView("token");
+ await waitFor(() => expect(fetchMemoryListMock).toHaveBeenCalled());
+
+ act(() => captured.current?.onPaginationChange({ pageIndex: 2, pageSize: 50 }));
+ await waitFor(() =>
+ expect(fetchMemoryListMock).toHaveBeenLastCalledWith("token", expect.objectContaining({ page: 3 })),
+ );
+
+ act(() => captured.current?.onSearchChange("mem-abc123"));
+
+ await waitFor(() =>
+ expect(fetchMemoryListMock).toHaveBeenLastCalledWith("token", { search: "mem-abc123", page: 1, pageSize: 50 }),
+ );
+ expect(captured.current?.hasActiveSearch).toBe(true);
+ });
+
it("keeps the table out of the skeleton state when the token is null (disabled query)", () => {
renderView(null);
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryView.tsx b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryView.tsx
index 1d2e5150a62..58d4e42aa96 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryView.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/memory/_components/MemoryView.tsx
@@ -43,10 +43,8 @@ export const MemoryView: React.FC<MemoryViewProps> = ({ accessToken }) => {
queryKey: [MEMORY_LIST_KEY, debouncedSearch, pagination.pageIndex, pagination.pageSize],
queryFn: () => {
if (!accessToken) throw new Error("Access token required");
- // Prefix search matches the Redis-style mental model (namespace scan):
- // typing "user:" finds "user:profile", "user:prefs", etc.
return fetchMemoryList(accessToken, {
- keyPrefix: debouncedSearch || undefined,
+ search: debouncedSearch || undefined,
page: pagination.pageIndex + 1,
pageSize: pagination.pageSize,
});
diff --git a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx
index c69662b69dc..881b0b93ff9 100644
--- a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx
+++ b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx
@@ -542,6 +542,19 @@ describe("server-side filtering – the LIT-4080 regression guard", () => {
expect((lastCall[2] ?? {}).userID).toBeUndefined();
});
});
+
+ it("sends the search box as the combined alias-or-ID search rather than the key-alias filter", async () => {
+ renderWithProviders(<VirtualKeysTable />);
+
+ fireEvent.change(screen.getByPlaceholderText(/Search by key alias or ID/), { target: { value: mockKey.token } });
+
+ await waitFor(() => {
+ expect(mockUseKeys).toHaveBeenLastCalledWith(1, 50, expect.objectContaining({ search: mockKey.token }));
+ });
+ const lastOptions = mockUseKeys.mock.calls.at(-1)?.[2];
+ expect(lastOptions?.selectedKeyAlias).toBeUndefined();
+ expect(lastOptions?.keyHash).toBeUndefined();
+ });
});
describe("pagination display – total count comes from useKeys", () => {
@@ -663,7 +676,7 @@ describe("table state lives in the URL so it survives leaving and returning to t
expect(mockUseKeys).toHaveBeenLastCalledWith(
3,
25,
- expect.objectContaining({ selectedKeyAlias: "prod", sortBy: "spend", sortOrder: "asc" }),
+ expect.objectContaining({ search: "prod", sortBy: "spend", sortOrder: "asc" }),
);
});
expect(screen.getByPlaceholderText(/Search by key alias/)).toHaveValue("prod");
@@ -736,7 +749,7 @@ describe("table state lives in the URL so it survives leaving and returning to t
fireEvent.change(screen.getByPlaceholderText(/Search by key alias/), { target: { value: "prod" } });
await waitFor(() => {
- expect(mockUseKeys).toHaveBeenLastCalledWith(1, 50, expect.objectContaining({ selectedKeyAlias: "prod" }));
+ expect(mockUseKeys).toHaveBeenLastCalledWith(1, 50, expect.objectContaining({ search: "prod" }));
});
await waitFor(() => {
expect(lastSearchParam(onUrlUpdate, "page")).toBeNull();
diff --git a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx
index c424966a0a3..ebedf57af45 100644
--- a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx
+++ b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx
@@ -118,7 +118,7 @@ export function VirtualKeysTable({ headerActions }: VirtualKeysTableProps) {
const keyListOptions = {
teamID: appliedFilters.team_id || undefined,
organizationID: appliedFilters.org_id || undefined,
- selectedKeyAlias: searchQuery.trim() || undefined,
+ search: searchQuery.trim() || undefined,
userID: appliedFilters.user_id || undefined,
keyHash: appliedFilters.key_hash || undefined,
sortBy,
@@ -291,7 +291,7 @@ export function VirtualKeysTable({ headerActions }: VirtualKeysTableProps) {
table={table}
searchValue={searchInput}
onSearchChange={handleSearchChange}
- searchPlaceholder="Search by key alias…"
+ searchPlaceholder="Search by key alias or ID…"
onRefresh={() => refetch?.()}
isRefreshing={isFetching}
onOpenFilters={() => setFiltersOpen(true)}
diff --git a/ui/litellm-dashboard/src/components/networking.test.ts b/ui/litellm-dashboard/src/components/networking.test.ts
index 7a220dd4711..9df9e9a9209 100644
--- a/ui/litellm-dashboard/src/components/networking.test.ts
+++ b/ui/litellm-dashboard/src/components/networking.test.ts
@@ -854,3 +854,48 @@ describe("userListCall search serialization", () => {
expect(lastParams(mockFetch).get("user_email")).toBe("[email protected]");
});
});
+
+describe("fetchMemoryList search serialization", () => {
+ const originalFetch = global.fetch;
+
+ afterEach(() => {
+ global.fetch = originalFetch;
+ });
+
+ const mockOkFetch = () => {
+ const emptyPage = { memories: [], total: 0 };
+ const mockFetch = vi.fn().mockResolvedValue({ ok: true, json: vi.fn().mockResolvedValue(emptyPage) } as any);
+ global.fetch = mockFetch as any;
+ return mockFetch;
+ };
+
+ const lastParams = (mockFetch: ReturnType<typeof vi.fn>) => {
+ const [url] = mockFetch.mock.calls.at(-1) ?? [];
+ return new URL(url as string, "http://example.com").searchParams;
+ };
+
+ it("sends the search box value as search and omits key_prefix and key", async () => {
+ const mockFetch = mockOkFetch();
+
+ await Networking.fetchMemoryList("token", { search: "mem-abc123", page: 1, pageSize: 50 });
+
+ const params = lastParams(mockFetch);
+ expect(params.get("search")).toBe("mem-abc123");
+ expect(params.has("key_prefix")).toBe(false);
+ expect(params.has("key")).toBe(false);
+ expect(params.get("page")).toBe("1");
+ expect(params.get("page_size")).toBe("50");
+ });
+
+ it("keeps key_prefix and key working when no search is given", async () => {
+ const mockFetch = mockOkFetch();
+
+ await Networking.fetchMemoryList("token", { keyPrefix: "user:" });
+ expect(lastParams(mockFetch).get("key_prefix")).toBe("user:");
+ expect(lastParams(mockFetch).has("search")).toBe(false);
+
+ await Networking.fetchMemoryList("token", { key: "user:profile" });
+ expect(lastParams(mockFetch).get("key")).toBe("user:profile");
+ expect(lastParams(mockFetch).has("search")).toBe(false);
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx
index d8762565e08..1384679a88a 100644
--- a/ui/litellm-dashboard/src/components/networking.tsx
+++ b/ui/litellm-dashboard/src/components/networking.tsx
@@ -2056,6 +2056,7 @@ interface UiSpendLogsParams {
exclude_internal_health_checks?: boolean;
group_by_session?: boolean;
session_cursor?: string;
+ search?: string;
}
interface UiSpendLogsCallOptions {
@@ -6563,6 +6564,7 @@ interface UiAuditLogsParams {
changed_by_api_key?: string;
object_team_id?: string;
object_key_hash?: string;
+ search?: string | null;
sort_by?: string;
sort_order?: "asc" | "desc";
}
@@ -8061,15 +8063,18 @@ export const fetchMemoryList = async (
options: {
key?: string;
keyPrefix?: string;
+ search?: string;
page?: number;
pageSize?: number;
} = {},
): Promise<MemoryListResponse> => {
const base = proxyBaseUrl ? `${proxyBaseUrl}/v1/memory` : `/v1/memory`;
const params = new URLSearchParams();
- // keyPrefix takes precedence — backend also does, but we omit `key`
+ // Backend precedence is search > key_prefix > key; only the winner is sent
// to keep the URL clean and intent obvious.
- if (options.keyPrefix) {
+ if (options.search) {
+ params.append("search", options.search);
+ } else if (options.keyPrefix) {
params.append("key_prefix", options.keyPrefix);
} else if (options.key) {
params.append("key", options.key);
diff --git a/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.test.tsx b/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.test.tsx
index 8bf5d639d6c..0d9d0988aa1 100644
--- a/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.test.tsx
+++ b/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.test.tsx
@@ -30,6 +30,8 @@ vi.mock("@tanstack/react-pacer/debouncer", () => ({
const mockUseKeys = useKeys as MockedFunction<typeof useKeys>;
+const KEY_HASH = "88a145505dd6e87e2ea166fcef1e4b53948dbdb32af6431dfd05ec06b571ee52";
+
const createMockKey = (overrides: Partial<KeyResponse> = {}): KeyResponse =>
({
token: "sk-test123",
@@ -277,7 +279,7 @@ describe("TeamVirtualKeysTable", () => {
);
});
- it("maps the search box to a server-side key-alias query", async () => {
+ it("maps the Key ID drawer filter to a server-side useKeys query and clears it", async () => {
const user = userEvent.setup();
mockUseKeys.mockReturnValue({
data: { keys: [createMockKey()], total_count: 1, current_page: 1, total_pages: 1 },
@@ -288,11 +290,42 @@ describe("TeamVirtualKeysTable", () => {
renderWithProviders(<TeamVirtualKeysTable {...defaultProps} />);
- fireEvent.change(await screen.findByTestId("datatable-search"), { target: { value: "check-002" } });
+ await user.click(await screen.findByTestId("datatable-filters-trigger"));
+ const drawerBody = await screen.findByTestId("filter-drawer-body");
+ fireEvent.change(within(drawerBody).getByPlaceholderText("Enter Key ID…"), { target: { value: KEY_HASH } });
+ await user.click(screen.getByTestId("filter-drawer-apply"));
+
+ await waitFor(() =>
+ expect(mockUseKeys).toHaveBeenLastCalledWith(1, 50, expect.objectContaining({ keyHash: KEY_HASH })),
+ );
+ expect(screen.getByTestId("filter-chip-key_hash")).toHaveTextContent("Key ID");
+
+ await user.click(screen.getByTestId("datatable-clear-filters"));
+ await waitFor(() =>
+ expect(mockUseKeys).toHaveBeenLastCalledWith(1, 50, expect.objectContaining({ keyHash: undefined })),
+ );
+ });
+
+ it("maps the search box to the combined alias-or-ID search rather than the key-alias filter", async () => {
+ mockUseKeys.mockReturnValue({
+ data: { keys: [createMockKey()], total_count: 1, current_page: 1, total_pages: 1 },
+ isPending: false,
+ isFetching: false,
+ refetch: vi.fn(),
+ } as unknown as ReturnType<typeof useKeys>);
+
+ renderWithProviders(<TeamVirtualKeysTable {...defaultProps} />);
+
+ const searchBox = await screen.findByTestId("datatable-search");
+ expect(searchBox).toHaveAttribute("placeholder", "Search by key alias or ID…");
+ fireEvent.change(searchBox, { target: { value: KEY_HASH } });
await waitFor(() =>
- expect(mockUseKeys).toHaveBeenLastCalledWith(1, 50, expect.objectContaining({ selectedKeyAlias: "check-002" })),
+ expect(mockUseKeys).toHaveBeenLastCalledWith(1, 50, expect.objectContaining({ search: KEY_HASH })),
);
+ const lastOptions = mockUseKeys.mock.calls.at(-1)?.[2];
+ expect(lastOptions?.selectedKeyAlias).toBeUndefined();
+ expect(lastOptions?.keyHash).toBeUndefined();
});
it("should show Loading keys when isPending", async () => {
diff --git a/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx b/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx
index bd7faa41ee9..aa9df4a0319 100644
--- a/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx
+++ b/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx
@@ -68,19 +68,17 @@ export function TeamVirtualKeysTable({ teamId, teamAlias, organization }: TeamVi
const pageIndex = tablePagination.pageIndex;
const pageSize = tablePagination.pageSize;
- const {
- data: keys,
- isPending: isLoading,
- isFetching,
- refetch,
- } = useKeys(pageIndex + 1, pageSize, {
+ const keyListOptions = {
teamID: teamId,
- selectedKeyAlias: searchQuery.trim() || undefined,
+ search: searchQuery.trim() || undefined,
userID: getFilterValue("user_id"),
+ keyHash: getFilterValue("key_hash"),
sortBy: sortBy || undefined,
sortOrder: sortOrder || undefined,
expand: "user",
- });
+ };
+
+ const { data: keys, isPending: isLoading, isFetching, refetch } = useKeys(pageIndex + 1, pageSize, keyListOptions);
const displayKeys = useMemo(() => {
const kList = keys?.keys || [];
@@ -481,11 +479,11 @@ export function TeamVirtualKeysTable({ teamId, teamAlias, organization }: TeamVi
table={table}
searchValue={searchInput}
onSearchChange={handleSearchChange}
- searchPlaceholder="Search by key alias…"
+ searchPlaceholder="Search by key alias or ID…"
onRefresh={() => refetch?.()}
isRefreshing={isFetching}
onOpenFilters={() => setFiltersOpen(true)}
- filterLabels={{ user_id: "User ID" }}
+ filterLabels={{ user_id: "User ID", key_hash: "Key ID" }}
/>
<DataTableFilterDrawer
table={table}
@@ -495,13 +493,22 @@ export function TeamVirtualKeysTable({ teamId, teamAlias, organization }: TeamVi
description={`Narrow down keys for ${teamAlias ?? "this team"}`}
>
{({ get, set }) => (
- <DataTableFilterField label="User ID">
- <Input
- value={(get("user_id") as string) ?? ""}
- onChange={(event) => set("user_id", event.target.value)}
- placeholder="Filter by user ID…"
- />
- </DataTableFilterField>
+ <>
+ <DataTableFilterField label="User ID">
+ <Input
+ value={(get("user_id") as string) ?? ""}
+ onChange={(event) => set("user_id", event.target.value)}
+ placeholder="Filter by user ID…"
+ />
+ </DataTableFilterField>
+ <DataTableFilterField label="Key ID">
+ <Input
+ value={(get("key_hash") as string) ?? ""}
+ onChange={(event) => set("key_hash", event.target.value)}
+ placeholder="Enter Key ID…"
+ />
+ </DataTableFilterField>
+ </>
)}
</DataTableFilterDrawer>
</>
diff --git a/ui/litellm-dashboard/src/components/view_logs/AuditLogsPanel.test.tsx b/ui/litellm-dashboard/src/components/view_logs/AuditLogsPanel.test.tsx
new file mode 100644
index 00000000000..3b27f663b8e
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/view_logs/AuditLogsPanel.test.tsx
@@ -0,0 +1,145 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { fireEvent, render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+import { chooseSelectOption } from "../../../tests/test-utils";
+import AuditLogsPanel from "./AuditLogsPanel";
+
+vi.mock("../networking", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("../networking")>();
+ return { ...actual, uiAuditLogsCall: vi.fn() };
+});
+
+// Resolve the debounced search synchronously so typed input reaches the query within the test tick.
+vi.mock("@tanstack/react-pacer/debouncer", () => ({
+ useDebouncedValue: (value: unknown) => [value, { cancel: vi.fn(), flush: vi.fn() }],
+}));
+
+import { uiAuditLogsCall } from "../networking";
+
+type AuditLogsParams = NonNullable<Parameters<typeof uiAuditLogsCall>[0]["params"]>;
+
+const PAGE_SIZE = 50;
+
+const ID_PARAM_KEYS = [
+ "search",
+ "object_id",
+ "changed_by",
+ "object_team_id",
+ "object_key_hash",
+ "action",
+ "table_name",
+] as const satisfies readonly (keyof AuditLogsParams)[];
+
+const respondWith = (total: number) => {
+ const response = { audit_logs: [], total, page: 1, page_size: PAGE_SIZE, total_pages: Math.ceil(total / PAGE_SIZE) };
+ return vi.mocked(uiAuditLogsCall).mockResolvedValue(response);
+};
+
+const lastCall = () => vi.mocked(uiAuditLogsCall).mock.calls.at(-1)?.[0];
+const sentIdParams = () => ID_PARAM_KEYS.filter((key) => lastCall()?.params?.[key] !== undefined);
+
+const defaultProps = {
+ accessToken: "sk-test",
+ token: "jwt-test",
+ userRole: "Admin",
+ userID: "user-1",
+ isActive: true,
+ premiumUser: true,
+};
+
+const renderPanel = () => {
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+ return render(
+ <QueryClientProvider client={queryClient}>
+ <AuditLogsPanel {...defaultProps} />
+ </QueryClientProvider>,
+ );
+};
+
+const TEXT_FILTERS: { filterId: string; placeholder: string; paramKey: keyof AuditLogsParams }[] = [
+ { filterId: "object_id", placeholder: "Enter object ID…", paramKey: "object_id" },
+ { filterId: "changed_by", placeholder: "Enter user ID…", paramKey: "changed_by" },
+ { filterId: "team_id", placeholder: "Enter team ID…", paramKey: "object_team_id" },
+ { filterId: "key_hash", placeholder: "Enter key hash…", paramKey: "object_key_hash" },
+];
+
+const SELECT_FILTERS: {
+ label: string;
+ comboboxIndex: number;
+ option: string;
+ paramKey: keyof AuditLogsParams;
+ value: string;
+}[] = [
+ { label: "Action", comboboxIndex: 0, option: "Created", paramKey: "action", value: "created" },
+ { label: "Table", comboboxIndex: 1, option: "Teams", paramKey: "table_name", value: "LiteLLM_TeamTable" },
+];
+
+describe("AuditLogsPanel", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ respondWith(0);
+ });
+
+ it("sends the typed search as params.search and returns to the first page", async () => {
+ const user = userEvent.setup();
+ respondWith(120);
+ renderPanel();
+ await waitFor(() => expect(uiAuditLogsCall).toHaveBeenCalled());
+ expect(lastCall()?.params?.search).toBeUndefined();
+
+ await user.click(screen.getByTestId("pagination-next"));
+ await waitFor(() => expect(lastCall()?.page).toBe(2));
+
+ await user.type(screen.getByTestId("datatable-search"), "team-abc");
+
+ await waitFor(() => expect(lastCall()?.params?.search).toBe("team-abc"));
+ expect(lastCall()?.page).toBe(1);
+ expect(sentIdParams()).toEqual(["search"]);
+ });
+
+ it("trims the search and drops params.search once the box is cleared", async () => {
+ const user = userEvent.setup();
+ renderPanel();
+ const input = await screen.findByTestId("datatable-search");
+
+ await user.type(input, " abc");
+ await waitFor(() => expect(lastCall()?.params?.search).toBe("abc"));
+
+ await user.clear(input);
+
+ await waitFor(() => expect(lastCall()?.params?.search).toBeUndefined());
+ expect(sentIdParams()).toEqual([]);
+ });
+
+ it.each(TEXT_FILTERS)("maps the $filterId drawer filter to params.$paramKey", async ({ placeholder, paramKey }) => {
+ const user = userEvent.setup();
+ renderPanel();
+ await waitFor(() => expect(uiAuditLogsCall).toHaveBeenCalled());
+
+ await user.click(screen.getByTestId("datatable-filters-trigger"));
+ fireEvent.change(await screen.findByPlaceholderText(placeholder), { target: { value: "val-1" } });
+ await user.click(screen.getByTestId("filter-drawer-apply"));
+
+ await waitFor(() => expect(lastCall()?.params?.[paramKey]).toBe("val-1"));
+ expect(sentIdParams()).toEqual([paramKey]);
+ });
+
+ it.each(SELECT_FILTERS)(
+ "maps the $label drawer select to params.$paramKey",
+ async ({ comboboxIndex, option, paramKey, value }) => {
+ const user = userEvent.setup();
+ renderPanel();
+ await waitFor(() => expect(uiAuditLogsCall).toHaveBeenCalled());
+
+ await user.click(screen.getByTestId("datatable-filters-trigger"));
+ const triggers = await screen.findAllByRole("combobox");
+ await chooseSelectOption(user, triggers[comboboxIndex], option);
+ await user.click(screen.getByTestId("filter-drawer-apply"));
+
+ await waitFor(() => expect(lastCall()?.params?.[paramKey]).toBe(value));
+ expect(sentIdParams()).toEqual([paramKey]);
+ },
+ );
+});
diff --git a/ui/litellm-dashboard/src/components/view_logs/AuditLogsPanel.tsx b/ui/litellm-dashboard/src/components/view_logs/AuditLogsPanel.tsx
index 81bd4a19f76..5ce4ca6053f 100644
--- a/ui/litellm-dashboard/src/components/view_logs/AuditLogsPanel.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/AuditLogsPanel.tsx
@@ -1,7 +1,9 @@
import { useCallback, useState } from "react";
+import { useDebouncedValue } from "@tanstack/react-pacer/debouncer";
import { useQuery, keepPreviousData } from "@tanstack/react-query";
import { ColumnFiltersState, OnChangeFn, PaginationState } from "@tanstack/react-table";
import { resolveLogoSrc } from "@/lib/assetPaths";
+import { DEBOUNCE_WAIT_MS } from "@/utils/debounceConstants";
import { uiAuditLogsCall } from "../networking";
import { AuditLogEntry } from "./AuditLogsTableColumns";
import { AuditLogsTable } from "./AuditLogsTable";
@@ -39,9 +41,13 @@ export default function AuditLogsPanel({
}: AuditLogsProps) {
const [pagination, setPagination] = useState<PaginationState>({ pageIndex: 0, pageSize: PAGE_SIZE });
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
+ const [searchInput, setSearchInput] = useState("");
+ const [debouncedSearch] = useDebouncedValue(searchInput, { wait: DEBOUNCE_WAIT_MS });
const [selectedLog, setSelectedLog] = useState<AuditLogEntry | null>(null);
const [drawerOpen, setDrawerOpen] = useState(false);
+ const searchTerm = debouncedSearch.trim();
+
const getFilterValue = (columnId: string): string | undefined => {
const entry = columnFilters.find((filter) => filter.id === columnId);
return typeof entry?.value === "string" && entry.value.trim() ? entry.value.trim() : undefined;
@@ -50,7 +56,7 @@ export default function AuditLogsPanel({
const canQueryAuditLogs = !!accessToken && !!token && !!userRole && !!userID && isActive && premiumUser;
const query = useQuery<AuditLogsResponse>({
- queryKey: ["audit_logs", pagination.pageIndex, pagination.pageSize, columnFilters],
+ queryKey: ["audit_logs", pagination.pageIndex, pagination.pageSize, columnFilters, searchTerm],
queryFn: async () => {
if (!accessToken) {
return { audit_logs: [], total: 0, page: 1, page_size: pagination.pageSize, total_pages: 0 };
@@ -60,6 +66,7 @@ export default function AuditLogsPanel({
page: pagination.pageIndex + 1,
page_size: pagination.pageSize,
params: {
+ search: searchTerm || undefined,
object_id: getFilterValue("object_id"),
changed_by: getFilterValue("changed_by"),
object_key_hash: getFilterValue("key_hash"),
@@ -80,6 +87,11 @@ export default function AuditLogsPanel({
setPagination((prev) => ({ ...prev, pageIndex: 0 }));
}, []);
+ const handleSearchChange = useCallback((value: string) => {
+ setSearchInput(value);
+ setPagination((prev) => ({ ...prev, pageIndex: 0 }));
+ }, []);
+
const handleViewLog = useCallback((log: AuditLogEntry) => {
setSelectedLog(log);
setDrawerOpen(true);
@@ -128,6 +140,8 @@ export default function AuditLogsPanel({
onPaginationChange={setPagination}
columnFilters={columnFilters}
onColumnFiltersChange={handleColumnFiltersChange}
+ searchValue={searchInput}
+ onSearchChange={handleSearchChange}
onRefresh={() => query.refetch()}
onViewLog={handleViewLog}
/>
diff --git a/ui/litellm-dashboard/src/components/view_logs/AuditLogsTable.test.tsx b/ui/litellm-dashboard/src/components/view_logs/AuditLogsTable.test.tsx
index 7349c3019ae..d8e549715af 100644
--- a/ui/litellm-dashboard/src/components/view_logs/AuditLogsTable.test.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/AuditLogsTable.test.tsx
@@ -120,6 +120,24 @@ describe("AuditLogsTable", () => {
expect(screen.getByText("No matching audit logs")).toBeInTheDocument();
});
+ it("renders the toolbar search box from the search props and forwards typed input", () => {
+ const onSearchChange = vi.fn();
+ renderTable({ searchValue: "team-", onSearchChange });
+
+ const input = screen.getByPlaceholderText("Search audit logs by ID…");
+ expect(input).toHaveValue("team-");
+
+ fireEvent.change(input, { target: { value: "team-7" } });
+ expect(onSearchChange).toHaveBeenCalledWith("team-7");
+ });
+
+ it("treats an active search as a filter for the empty state", () => {
+ const emptySearchResult = { data: [], rowCount: 0, searchValue: "zzz", onSearchChange: vi.fn() };
+ renderTable(emptySearchResult);
+
+ expect(screen.getByText("No matching audit logs")).toBeInTheDocument();
+ });
+
it("renders active filter chips with human-readable labels", () => {
const filters: ColumnFiltersState = [{ id: "action", value: "created" }];
renderTable({ columnFilters: filters });
diff --git a/ui/litellm-dashboard/src/components/view_logs/AuditLogsTable.tsx b/ui/litellm-dashboard/src/components/view_logs/AuditLogsTable.tsx
index 799505ed07c..cef828838e2 100644
--- a/ui/litellm-dashboard/src/components/view_logs/AuditLogsTable.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/AuditLogsTable.tsx
@@ -24,6 +24,8 @@ interface AuditLogsTableProps {
onPaginationChange: OnChangeFn<PaginationState>;
columnFilters: ColumnFiltersState;
onColumnFiltersChange: OnChangeFn<ColumnFiltersState>;
+ searchValue?: string;
+ onSearchChange?: (value: string) => void;
onRefresh: () => void;
onViewLog: (log: AuditLogEntry) => void;
}
@@ -102,11 +104,14 @@ export function AuditLogsTable({
onPaginationChange,
columnFilters,
onColumnFiltersChange,
+ searchValue,
+ onSearchChange,
onRefresh,
onViewLog,
}: AuditLogsTableProps) {
const [filtersOpen, setFiltersOpen] = useState(false);
const columns = useMemo(() => getAuditLogsTableColumns({ onViewLog }), [onViewLog]);
+ const hasActiveSearch = Boolean(searchValue?.trim());
return (
<DataTable
@@ -122,12 +127,15 @@ export function AuditLogsTable({
onColumnFiltersChange={onColumnFiltersChange}
isLoading={isLoading}
loadingMessage="Loading audit logs…"
- noDataMessage={<AuditLogsEmptyState filtered={columnFilters.length > 0} />}
+ noDataMessage={<AuditLogsEmptyState filtered={columnFilters.length > 0 || hasActiveSearch} />}
size="compact"
toolbar={(table) => (
<>
<DataTableToolbar
table={table}
+ searchValue={searchValue}
+ onSearchChange={onSearchChange}
+ searchPlaceholder="Search audit logs by ID…"
onRefresh={onRefresh}
isRefreshing={isRefreshing}
onOpenFilters={() => setFiltersOpen(true)}
diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx
index 93066c106ee..be0d0049c13 100644
--- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.test.tsx
@@ -54,6 +54,14 @@ vi.mock("./LogDetailsDrawer", () => ({
},
}));
+const debounce = vi.hoisted(() => ({ settled: null as string | null }));
+
+vi.mock("@tanstack/react-pacer/debouncer", () => ({
+ useDebouncedValue: vi.fn((value: unknown) => [debounce.settled ?? value, { cancel: vi.fn(), flush: vi.fn() }]),
+}));
+
+import { useDebouncedValue } from "@tanstack/react-pacer/debouncer";
+import { DEBOUNCE_WAIT_MS } from "@/utils/debounceConstants";
import { uiSpendLogsCall } from "../networking";
const logEntry = (overrides: Partial<LogEntry>): LogEntry => ({
@@ -136,6 +144,7 @@ describe("RequestLogsPanel", () => {
sessionStorage.clear();
testQueryClient.clear();
respondWith([]);
+ debounce.settled = null;
});
describe("server-grouped session pagination (#38060)", () => {
@@ -322,9 +331,8 @@ describe("RequestLogsPanel", () => {
});
});
- describe("search by request id (LIT-3981)", () => {
- it("sends the typed request id to the server on the first page instead of filtering the loaded rows", async () => {
- const user = userEvent.setup();
+ describe("search by any id (LIT-3981, LIT-4741)", () => {
+ it("sends the typed id to the server as search on the first page instead of filtering the loaded rows", async () => {
renderPanel();
await waitFor(() => expect(uiSpendLogsCall).toHaveBeenCalled());
@@ -334,9 +342,54 @@ describe("RequestLogsPanel", () => {
await waitFor(() => {
const call = lastCall();
if (!call) throw new Error("uiSpendLogsCall was not called");
- expect(call.params?.request_id).toBe("req-on-another-page");
+ expect(call.params?.search).toBe("req-on-another-page");
expect(call.page).toBe(1);
});
+ expect(lastCall()?.params?.request_id).toBeUndefined();
+ expect(lastCall()?.params?.session_cursor).toBeUndefined();
+ });
+
+ it("sends the debounced value to the server while the box shows what is being typed", async () => {
+ debounce.settled = "settled-id";
+ renderPanel();
+
+ await waitFor(() => expect(uiSpendLogsCall).toHaveBeenCalled());
+
+ fireEvent.change(screen.getByTestId("datatable-search"), { target: { value: "still-typing" } });
+
+ expect(screen.getByTestId("datatable-search")).toHaveValue("still-typing");
+ await waitFor(() =>
+ expect(useDebouncedValue).toHaveBeenLastCalledWith("still-typing", { wait: DEBOUNCE_WAIT_MS }),
+ );
+ await waitFor(() => expect(lastCall()?.params?.search).toBe("settled-id"));
+ const sentLiveValue = vi
+ .mocked(uiSpendLogsCall)
+ .mock.calls.some(([options]) => options.params?.search === "still-typing");
+ expect(sentLiveValue).toBe(false);
+ });
+
+ it("shows a Search chip whose remove button clears the box and restores the unsearched listing", async () => {
+ const user = userEvent.setup();
+ vi.mocked(uiSpendLogsCall).mockImplementation(async ({ params }) => {
+ const data =
+ params?.search === "sess-42"
+ ? [logEntry({ request_id: "req-sess", session_id: "sess-42" })]
+ : [logEntry({ request_id: "req-initial" })];
+ return { data, total: data.length, page: 1, page_size: 50, total_pages: 1 };
+ });
+ renderPanel();
+
+ await waitFor(() => expect(row("req-initial")).not.toBeNull());
+ fireEvent.change(screen.getByTestId("datatable-search"), { target: { value: "sess-42" } });
+ await waitFor(() => expect(row("req-sess")).not.toBeNull());
+ expect(row("req-initial")).toBeNull();
+ expect(screen.getByTestId("filter-chip-search")).toHaveTextContent("Search:sess-42");
+
+ await user.click(screen.getByRole("button", { name: "Remove Search filter" }));
+
+ expect(screen.getByTestId("datatable-search")).toHaveValue("");
+ await waitFor(() => expect(row("req-initial")).not.toBeNull());
+ expect(row("req-sess")).toBeNull();
});
});
diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx
index 96cf2bd5dde..9b99c6af923 100644
--- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsPanel.tsx
@@ -1,11 +1,13 @@
"use client";
+import { useDebouncedValue } from "@tanstack/react-pacer/debouncer";
import { useQuery, type UseQueryOptions } from "@tanstack/react-query";
import type { ColumnFiltersState, OnChangeFn, PaginationState, SortingState } from "@tanstack/react-table";
import moment from "moment";
import { useCallback, useEffect, useMemo, useState } from "react";
import { AutoRouterModelGroupsProvider } from "@/components/shared/table_cells";
+import { DEBOUNCE_WAIT_MS } from "@/utils/debounceConstants";
import type { KeyResponse } from "../key_team_helpers/key_list";
import { keyInfoV1Call, uiSpendLogsCall } from "../networking";
import KeyInfoView from "../templates/key_info_view";
@@ -75,12 +77,22 @@ export default function RequestLogsPanel({ accessToken, token, userRole, userID,
sessionStorage.setItem("excludeInternalHealthChecks", JSON.stringify(excludeInternalHealthChecks));
}, [excludeInternalHealthChecks]);
+ const searchTerm = useMemo(() => {
+ const entry = columnFilters.find((filter) => filter.id === LOG_FILTER_IDS.SEARCH);
+ return typeof entry?.value === "string" ? entry.value : "";
+ }, [columnFilters]);
+ const [debouncedSearch] = useDebouncedValue(searchTerm, { wait: DEBOUNCE_WAIT_MS });
+ const queryColumnFilters = useMemo<ColumnFiltersState>(() => {
+ const others = columnFilters.filter((filter) => filter.id !== LOG_FILTER_IDS.SEARCH);
+ return debouncedSearch === "" ? others : [...others, { id: LOG_FILTER_IDS.SEARCH, value: debouncedSearch }];
+ }, [columnFilters, debouncedSearch]);
+
const { logsQuery, filteredLogs, allTeams, usesSessionCursor } = useLogFilterLogic({
accessToken,
token,
userRole,
userID,
- columnFilters,
+ columnFilters: queryColumnFilters,
activeTab: isActive ? "request logs" : "inactive",
isLiveTail,
excludeInternalHealthChecks,
@@ -155,15 +167,10 @@ export default function RequestLogsPanel({ accessToken, token, userRole, userID,
const rows: LogEntry[] = filteredLogs.data;
- const searchTerm = useMemo(() => {
- const entry = columnFilters.find((filter) => filter.id === LOG_FILTER_IDS.REQUEST_ID);
- return typeof entry?.value === "string" ? entry.value : "";
- }, [columnFilters]);
-
const handleSearchChange = useCallback((value: string) => {
setColumnFilters((previous) => {
- const others = previous.filter((filter) => filter.id !== LOG_FILTER_IDS.REQUEST_ID);
- return value === "" ? others : [...others, { id: LOG_FILTER_IDS.REQUEST_ID, value }];
+ const others = previous.filter((filter) => filter.id !== LOG_FILTER_IDS.SEARCH);
+ return value === "" ? others : [...others, { id: LOG_FILTER_IDS.SEARCH, value }];
});
setSessionCursors({});
setPagination((previous) => ({ ...previous, pageIndex: 0 }));
diff --git a/ui/litellm-dashboard/src/components/view_logs/RequestLogsTable.tsx b/ui/litellm-dashboard/src/components/view_logs/RequestLogsTable.tsx
index 4159b3b699b..17caa4466fa 100644
--- a/ui/litellm-dashboard/src/components/view_logs/RequestLogsTable.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/RequestLogsTable.tsx
@@ -108,7 +108,7 @@ export function RequestLogsTable({
table={table}
searchValue={searchValue}
onSearchChange={onSearchChange}
- searchPlaceholder="Search by Request ID"
+ searchPlaceholder="Search logs by ID…"
onRefresh={onRefresh}
isRefreshing={isRefreshing}
onOpenFilters={() => setFiltersOpen(true)}
diff --git a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.test.tsx b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.test.tsx
index 1b738db097d..6af791cc50e 100644
--- a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.test.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.test.tsx
@@ -91,6 +91,7 @@ describe("useLogFilterLogic", () => {
{ id: LOG_FILTER_IDS.ERROR_CODE, value: "429", param: "error_code" },
{ id: LOG_FILTER_IDS.ERROR_MESSAGE, value: "rate limited", param: "error_message" },
{ id: LOG_FILTER_IDS.USER_ID, value: "user-9", param: "user_id" },
+ { id: LOG_FILTER_IDS.SEARCH, value: "any-id", param: "search" },
];
it.each(cases)("sends $id as $param", async ({ id, value, param }) => {
diff --git a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx
index 90f0f0a60f1..3d368527ad9 100644
--- a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx
@@ -33,6 +33,7 @@ export const LOG_FILTER_IDS = {
PUBLIC_MODEL_OR_SEARCH_TOOL: "model",
REQUEST_ID: "request_id",
USER_ID: "user_id",
+ SEARCH: "search",
} as const;
export const LOG_FILTER_LABELS: Record<string, string> = {
@@ -48,6 +49,7 @@ export const LOG_FILTER_LABELS: Record<string, string> = {
[LOG_FILTER_IDS.SESSION_ID]: "Session ID",
[LOG_FILTER_IDS.MODEL_ID]: "Model",
[LOG_FILTER_IDS.PUBLIC_MODEL_OR_SEARCH_TOOL]: "Public model / search tool",
+ [LOG_FILTER_IDS.SEARCH]: "Search",
};
export interface LogsWindow {
@@ -175,6 +177,7 @@ export function useLogFilterLogic({
api_key: getFilterValue(columnFilters, LOG_FILTER_IDS.KEY_HASH),
team_id: getFilterValue(columnFilters, LOG_FILTER_IDS.TEAM_ID),
request_id: getFilterValue(columnFilters, LOG_FILTER_IDS.REQUEST_ID),
+ search: getFilterValue(columnFilters, LOG_FILTER_IDS.SEARCH),
session_id: getFilterValue(columnFilters, LOG_FILTER_IDS.SESSION_ID),
user_id: userIdFilter,
end_user: getFilterValue(columnFilters, LOG_FILTER_IDS.END_USER),