Skip to content

feat: add server-side search to filter sidebar checkbox lists via debounced q query param - #3568

Merged
akshaydeo merged 3 commits into
devfrom
05-18-feat_ability_to_search_for_filters_in_logs_and_mcp_logs
May 18, 2026
Merged

feat: add server-side search to filter sidebar checkbox lists via debounced q query param#3568
akshaydeo merged 3 commits into
devfrom
05-18-feat_ability_to_search_for_filters_in_logs_and_mcp_logs

Conversation

@impoiler

@impoiler impoiler commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Filter dropdowns in the logs and MCP logs sidebars previously fetched all available options upfront. This PR wires the search input in each SearchableCheckboxList to the backend filter data query, so that typing in a filter panel sends a debounced q parameter to /logs/filterdata or /mcp-logs/filterdata, narrowing results server-side rather than relying solely on client-side filtering.

Changes

  • Added an optional onSearch callback to SearchableCheckboxList in both logsFilterSidebar.tsx and mcpFilterSidebar.tsx. When provided, a 300 ms debounced effect fires onSearch with the current trimmed query.
  • Each filter component (StopReasonFilter, ModelsFilter, AliasesFilter, SelectedKeysFilter, VirtualKeysFilter, RoutingEnginesFilter, RoutingRulesFilter, ToolNamesFilter, ServersFilter) now holds a searchQuery state and passes it as q to useGetAvailableFilterDataQuery / useGetMCPLogsFilterDataQuery.
  • MetadataFilters gets its own search input with a local debounce (since it doesn't use SearchableCheckboxList) and passes the debounced value as q to the filter data query.
  • The getAvailableFilterData and getMCPAvailableFilterData API query builders now accept an optional q field and append it as a URL query parameter when present.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

  1. Open the logs or MCP logs page and expand any filter panel (e.g. Models, Aliases, Virtual Keys).
  2. Type in the search box inside the filter panel.
  3. After ~300 ms, verify that the displayed options update to reflect server-filtered results matching the query.
  4. Clear the search box and confirm the full list is restored.
  5. Verify that the Metadata filter search input similarly narrows the displayed metadata keys.
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build

Screenshots/Recordings

Add before/after screenshots or a short clip showing the filter search narrowing results.

Breaking changes

  • Yes
  • No

Related issues

Security considerations

The q parameter is passed as a plain URL query string to existing authenticated endpoints. No new auth surface or PII handling is introduced beyond what the filter data endpoints already expose.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8d2f1e54-ad2d-4d7b-b0ca-b13cb80ca885

📥 Commits

Reviewing files that changed from the base of the PR and between 502c146 and 27d3dc2.

📒 Files selected for processing (4)
  • ui/components/filters/logsFilterSidebar.tsx
  • ui/components/filters/mcpFilterSidebar.tsx
  • ui/lib/store/apis/logsApi.ts
  • ui/lib/store/apis/mcpLogsApi.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • ui/lib/store/apis/mcpLogsApi.ts
  • ui/components/filters/mcpFilterSidebar.tsx
  • ui/lib/store/apis/logsApi.ts
  • ui/components/filters/logsFilterSidebar.tsx

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added searchable inputs to multiple filter panels (Stop Reason, Models, Aliases, Keys, Virtual Keys, Routing Engines, Routing Rules, Tool Names, Servers) with server-side filtering
    • Added metadata key search above metadata groups
    • Search inputs are debounced (~300ms) for smoother typing and reduced load

Walkthrough

Adds server-side search for filter dropdowns: filter-data endpoints accept optional q; SearchableCheckboxList emits a debounced onSearch; logs and MCP filter sections maintain search state and pass q (debounced for metadata) to their queries for backend-filtered options.

Changes

Filter dropdown server-side search

Layer / File(s) Summary
API endpoint search parameter support
ui/lib/store/apis/logsApi.ts, ui/lib/store/apis/mcpLogsApi.ts
getAvailableFilterData and getMCPAvailableFilterData endpoints now accept optional q and build request URLs with URLSearchParams, including sorted dimensions and q when provided.
SearchableCheckboxList debounced onSearch callback
ui/components/filters/logsFilterSidebar.tsx, ui/components/filters/mcpFilterSidebar.tsx
SearchableCheckboxList accepts optional onSearch(query: string) and invokes it ~300ms after user input with query.trim().
Logs filter sections with server-side search
ui/components/filters/logsFilterSidebar.tsx
Stop Reason, Models, Aliases, Selected Keys, Virtual Keys, Routing Engines, Routing Rules, and Metadata filters add searchQuery state, wire onSearch to update it, and pass q (metadata uses a 300ms-debounced query) to useGetAvailableFilterDataQuery.
MCP filter sections with server-side search
ui/components/filters/mcpFilterSidebar.tsx
Tool Names, Servers, and Virtual Keys filters add searchQuery state, wire onSearch={setSearchQuery}, and pass `q: searchQuery

🎯 3 (Moderate) | ⏱️ ~25 minutes

🐰 A search within each list so fine,
Debounced input, API align,
Filter dropdowns now feel swift and lean,
Server-side magic in between!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main feature: adding server-side search to filter sidebar checkbox lists with a debounced query parameter.
Description check ✅ Passed The description follows the template structure with all required sections completed: Summary, Changes, Type of change, Affected areas, How to test, Breaking changes, Security considerations, and Checklist.
Docstring Coverage ✅ Passed Docstring coverage is 84.62% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 05-18-feat_ability_to_search_for_filters_in_logs_and_mcp_logs

Comment @coderabbitai help to get the list of available commands and usage tips.

@impoiler impoiler self-assigned this May 18, 2026
@impoiler impoiler changed the title feat: ability to search for filters in logs and MCP logs feat: add server-side search to filter sidebar checkbox lists via debounced q query param May 18, 2026
@impoiler
impoiler marked this pull request as ready for review May 18, 2026 12:00
@greptile-apps

greptile-apps Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

Safe to merge after addressing the MetadataFilters search-input disappearance on empty results.

The MetadataFilters component adds debouncedQuery state and renders a search input inside the else branch of the isEmpty check, but isEmpty is still entries.length === 0 && !hasActive with no guard for an active debouncedQuery. When the user types a query that returns zero metadata keys, the entire panel contents — including the search input — are replaced by a static message, trapping the user with no way to clear the query.

ui/components/filters/logsFilterSidebar.tsx — specifically the MetadataFilters isEmpty guard around line 924.

Important Files Changed

Filename Overview
ui/components/filters/logsFilterSidebar.tsx Adds server-side search to all filter components; MetadataFilters.isEmpty guard does not account for debouncedQuery, causing the search input to disappear when a query returns no results.
ui/components/filters/mcpFilterSidebar.tsx Adds onSearch and searchQuery state to ToolNamesFilter, ServersFilter, and VirtualKeysFilter — mirrors the logs sidebar pattern cleanly with no issues.
ui/lib/store/apis/logsApi.ts Migrates query-string building to URLSearchParams and adds optional q field — encoding behaviour for dimensions is unchanged, no issues.
ui/lib/store/apis/mcpLogsApi.ts Same URLSearchParams + optional q refactor as logsApi.ts — clean, symmetric with the logs endpoint.

Reviews (2): Last reviewed commit: "feat: ability to search for filters in l..." | Re-trigger Greptile

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 18, 2026
@impoiler
impoiler force-pushed the 05-18-feat_add_search_functionality_to_the_filter_apis branch from 18f5adf to e811375 Compare May 18, 2026 13:01
@impoiler
impoiler force-pushed the 05-18-feat_ability_to_search_for_filters_in_logs_and_mcp_logs branch from 502c146 to 27d3dc2 Compare May 18, 2026 13:01

akshaydeo commented May 18, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • May 18, 1:40 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 18, 1:44 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo changed the base branch from 05-18-feat_add_search_functionality_to_the_filter_apis to graphite-base/3568 May 18, 2026 13:41
@akshaydeo
akshaydeo changed the base branch from graphite-base/3568 to dev May 18, 2026 13:43
@akshaydeo
akshaydeo dismissed coderabbitai[bot]’s stale review May 18, 2026 13:43

The base branch was changed.

@akshaydeo
akshaydeo merged commit ae35e04 into dev May 18, 2026
13 checks passed
@akshaydeo
akshaydeo deleted the 05-18-feat_ability_to_search_for_filters_in_logs_and_mcp_logs branch May 18, 2026 13:44
akshaydeo pushed a commit that referenced this pull request May 20, 2026
…ounced `q` query param (#3568)

## Summary

Filter dropdowns in the logs and MCP logs sidebars previously fetched all available options upfront. This PR wires the search input in each `SearchableCheckboxList` to the backend filter data query, so that typing in a filter panel sends a debounced `q` parameter to `/logs/filterdata` or `/mcp-logs/filterdata`, narrowing results server-side rather than relying solely on client-side filtering.

## Changes

- Added an optional `onSearch` callback to `SearchableCheckboxList` in both `logsFilterSidebar.tsx` and `mcpFilterSidebar.tsx`. When provided, a 300 ms debounced effect fires `onSearch` with the current trimmed query.
- Each filter component (`StopReasonFilter`, `ModelsFilter`, `AliasesFilter`, `SelectedKeysFilter`, `VirtualKeysFilter`, `RoutingEnginesFilter`, `RoutingRulesFilter`, `ToolNamesFilter`, `ServersFilter`) now holds a `searchQuery` state and passes it as `q` to `useGetAvailableFilterDataQuery` / `useGetMCPLogsFilterDataQuery`.
- `MetadataFilters` gets its own search input with a local debounce (since it doesn't use `SearchableCheckboxList`) and passes the debounced value as `q` to the filter data query.
- The `getAvailableFilterData` and `getMCPAvailableFilterData` API query builders now accept an optional `q` field and append it as a URL query parameter when present.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [ ] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [x] UI (React)
- [ ] Docs

## How to test

1. Open the logs or MCP logs page and expand any filter panel (e.g. Models, Aliases, Virtual Keys).
2. Type in the search box inside the filter panel.
3. After ~300 ms, verify that the displayed options update to reflect server-filtered results matching the query.
4. Clear the search box and confirm the full list is restored.
5. Verify that the Metadata filter search input similarly narrows the displayed metadata keys.

```sh
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build
```

## Screenshots/Recordings

_Add before/after screenshots or a short clip showing the filter search narrowing results._

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

## Security considerations

The `q` parameter is passed as a plain URL query string to existing authenticated endpoints. No new auth surface or PII handling is introduced beyond what the filter data endpoints already expose.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
@akshaydeo akshaydeo mentioned this pull request May 20, 2026
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