-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: add filtering and pagination to MCP sessions table #3825
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
ui/app/workspace/mcp-sessions/views/sessionsFilterBar.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| // Inline filter row above the sessions table: search input + three multi- | ||
| // selects (kind, status, auth_mode) + a clear-filters affordance shown | ||
| // only when something is active. | ||
| // | ||
| // MCP-client filter is intentionally absent here. Adding it would need a | ||
| // separate source for the dropdown options (the existing list response | ||
| // only shows clients that have *sessions*, which is filter-dependent and | ||
| // would cause the option list to collapse as filters narrow). When we | ||
| // want it we'll piggyback on useGetMCPClientsQuery. | ||
|
|
||
| import { Button } from "@/components/ui/button"; | ||
| import { ComboboxSelect } from "@/components/ui/combobox"; | ||
| import { Input } from "@/components/ui/input"; | ||
| import { Fingerprint, KeyRound, Search, UserRound, X } from "lucide-react"; | ||
|
|
||
| // Labels mirror the Type column's TypeBadge ("OAuth" / "Headers") so the | ||
| // filter vocabulary matches what the user sees in the table. | ||
| const KIND_OPTIONS = [ | ||
| { label: "OAuth", value: "token" }, | ||
| { label: "Headers", value: "header" }, | ||
| ]; | ||
|
|
||
| const STATUS_OPTIONS = [ | ||
| { label: "Active", value: "active" }, | ||
| { label: "Orphaned", value: "orphaned" }, | ||
| { label: "Needs re-auth", value: "needs_reauth" }, | ||
| { label: "Needs update", value: "needs_update" }, | ||
| { label: "Pending", value: "pending" }, | ||
| ]; | ||
|
|
||
| // Identity-mode icons match the glyphs used in BindingCell so the dropdown | ||
| // reads as the same vocabulary as the rendered table column. | ||
| const AUTH_MODE_OPTIONS = [ | ||
| { label: "User", value: "user", icon: <UserRound className="size-3.5" /> }, | ||
| { label: "Virtual key", value: "vk", icon: <KeyRound className="size-3.5" /> }, | ||
| { label: "Session", value: "session", icon: <Fingerprint className="size-3.5" /> }, | ||
| ]; | ||
|
|
||
| export interface SessionsFilterBarProps { | ||
| search: string; | ||
| onSearchChange: (value: string) => void; | ||
| kindFilter: string[]; | ||
| onKindFilterChange: (value: string[]) => void; | ||
| statusFilter: string[]; | ||
| onStatusFilterChange: (value: string[]) => void; | ||
| authModeFilter: string[]; | ||
| onAuthModeFilterChange: (value: string[]) => void; | ||
| hasActiveFilters: boolean; | ||
| onClearFilters: () => void; | ||
| } | ||
|
|
||
| export default function SessionsFilterBar(props: SessionsFilterBarProps) { | ||
| return ( | ||
| <div className="flex shrink-0 flex-wrap items-center gap-3"> | ||
| <div className="relative max-w-sm flex-1 min-w-[200px]"> | ||
| <Search className="text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2" /> | ||
| <Input | ||
| aria-label="Search sessions" | ||
| placeholder="Search MCP, user, VK, session..." | ||
| value={props.search} | ||
| onChange={(e) => props.onSearchChange(e.target.value)} | ||
| className="pl-9" | ||
| data-testid="mcp-sessions-search-input" | ||
| /> | ||
| </div> | ||
| <ComboboxSelect | ||
| multiple | ||
| disableSearch | ||
| compactTrigger | ||
| data-testid="mcp-sessions-kind-filter" | ||
| options={KIND_OPTIONS} | ||
| value={props.kindFilter} | ||
| onValueChange={props.onKindFilterChange} | ||
| placeholder="All types" | ||
| className="h-9 w-[180px]" | ||
| /> | ||
| <ComboboxSelect | ||
| multiple | ||
| disableSearch | ||
| compactTrigger | ||
| data-testid="mcp-sessions-status-filter" | ||
| options={STATUS_OPTIONS} | ||
| value={props.statusFilter} | ||
| onValueChange={props.onStatusFilterChange} | ||
| placeholder="All statuses" | ||
| className="h-9 w-[180px]" | ||
| /> | ||
| <ComboboxSelect | ||
| multiple | ||
| disableSearch | ||
| compactTrigger | ||
| data-testid="mcp-sessions-auth-mode-filter" | ||
| options={AUTH_MODE_OPTIONS} | ||
| value={props.authModeFilter} | ||
| onValueChange={props.onAuthModeFilterChange} | ||
| placeholder="All identities" | ||
| className="h-9 w-[180px]" | ||
| /> | ||
| {props.hasActiveFilters && ( | ||
| <Button | ||
| variant="ghost" | ||
| size="sm" | ||
| onClick={props.onClearFilters} | ||
| data-testid="mcp-sessions-clear-filters-btn" | ||
| className="h-9" | ||
| > | ||
| <X className="h-4 w-4" /> | ||
| Clear filters | ||
| </Button> | ||
| )} | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.