Skip to content

chore: reformat virtualKeysTable.tsx and fix dropdown menu close-on-action - #3602

Merged
akshaydeo merged 2 commits into
devfrom
05-19-fix_dropdown_open_state_in_the_vkey_table
May 20, 2026
Merged

chore: reformat virtualKeysTable.tsx and fix dropdown menu close-on-action#3602
akshaydeo merged 2 commits into
devfrom
05-19-fix_dropdown_open_state_in_the_vkey_table

Conversation

@impoiler

@impoiler impoiler commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Reformats virtualKeysTable.tsx to use tab-based indentation consistently throughout the file, and fixes a bug where the VKActionsMenu dropdown would remain open after selecting "Edit" or "Delete".

Changes

  • Converted all 2-space indentation to tabs across the entire virtualKeysTable.tsx file to match the project's preferred style
  • Added explicit isOpen / setIsOpen state to VKActionsMenu and wired it to the DropdownMenu's open / onOpenChange props so the menu closes immediately when "Edit" or "Delete" is selected, preventing the dropdown from staying visible while a sheet or dialog opens

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. Navigate to the Virtual Keys table.
  2. Open the actions menu (⋯) on any virtual key row.
  3. Click Edit — the dropdown should close immediately and the edit sheet should open.
  4. Repeat and click Delete — the dropdown should close immediately and the delete confirmation dialog should appear.
  5. Confirm neither the edit nor delete action leaves the dropdown menu visible in the background.
cd ui
pnpm i || npm i
pnpm build || npm run build

Screenshots/Recordings

N/A

Breaking changes

  • Yes
  • No

Related issues

N/A

Security considerations

No security implications. The change only affects UI rendering and dropdown state management.

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 19, 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: 28e4b57d-c738-4373-b03d-bb77cc0de047

📥 Commits

Reviewing files that changed from the base of the PR and between 630a813 and 6ca2e78.

📒 Files selected for processing (10)
  • ui/app/workspace/custom-pricing/overrides/scopedPricingOverridesView.tsx
  • ui/app/workspace/governance/views/customerTable.tsx
  • ui/app/workspace/governance/views/teamsTable.tsx
  • ui/app/workspace/logs/views/columns.tsx
  • ui/app/workspace/mcp-logs/views/mcpLogDetailsSheet.tsx
  • ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx
  • ui/app/workspace/model-limits/views/modelLimitsTable.tsx
  • ui/app/workspace/providers/views/modelProviderKeysTableView.tsx
  • ui/app/workspace/routing-rules/views/routingRulesTable.tsx
  • ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Unified per-row action menus across workspace tables into reusable, self-contained components that manage dropdown open/close state.
    • Action items now use selection handlers that prevent default, explicitly close menus, and avoid triggering row clicks.
    • Edit/Delete/Export flows respect permission states and show progress where applicable for more consistent, predictable interactions.

Walkthrough

This PR standardizes per-row action dropdowns across workspace views by extracting several inline menus into local action-menu components, converting other menus to controlled open/close state, and ensuring menus explicitly close after selection.

Changes

Dropdown Menu Control Refactoring Across Workspace Tables

Layer / File(s) Summary
Pricing override actions component
ui/app/workspace/custom-pricing/overrides/scopedPricingOverridesView.tsx
Adds PricingOverrideActionsMenu and replaces inline per-row dropdowns with the component wired to edit/delete handlers.
Logs actions component
ui/app/workspace/logs/views/columns.tsx
Adds LogActionsMenu and replaces the inline actions dropdown in the actions column with the new component.
MCP clients actions component
ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx
Adds MCPClientActionsMenu handling reconnect/delete, reconnect spinner and access flags; replaces inline per-row dropdown with the component.
Model limits actions component
ui/app/workspace/model-limits/views/modelLimitsTable.tsx
Adds ModelLimitActionsMenu with RBAC-aware disabled states and replaces the inlined dropdown in the row actions cell.
Provider key actions component
ui/app/workspace/providers/views/modelProviderKeysTableView.tsx
Adds ProviderKeyActionsMenu managing open state, stop-propagation trigger, and disabled Edit/Delete items based on permissions; replaces inline menu.
Routing rule actions component
ui/app/workspace/routing-rules/views/routingRulesTable.tsx
Adds RoutingRuleActionsMenu and replaces inline per-row dropdown with the new component wired to edit/delete flows.
Convert to controlled dropdown state
ui/app/workspace/governance/views/customerTable.tsx, ui/app/workspace/governance/views/teamsTable.tsx, ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx
Adds local isOpen state to several existing action menus, converts DropdownMenu to controlled components, and updates Edit/Delete items to onSelect handlers that preventDefault() and close the menu.
MCPLogDetailsSheet header dropdown control
ui/app/workspace/mcp-logs/views/mcpLogDetailsSheet.tsx
Removes AlertDialogTrigger import; makes header DropdownMenu controlled via dropdownOpen; updates Export/Delete items to use onSelect with preventDefault(), explicitly close the dropdown, and open the delete dialog via state.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • maximhq/bifrost#3485: Modifies scopedPricingOverridesView.tsx to extract pricing override actions into a dropdown component.
  • maximhq/bifrost#3484: Refactors routingRulesTable.tsx to use a dedicated RoutingRuleActionsMenu component for per-row actions.
  • maximhq/bifrost#3480: Changes logs/columns.tsx to replace inline delete UI with a dropdown menu component.

Suggested reviewers

  • akshaydeo

Poem

🐰 A rabbit twitches its nose in delight,
Menus that open then close just right,
Clicks handled clean, no stray propagation,
Edit and Delete with tidy elation,
Hoppity code, polished and light.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the two main changes: reformatting for tab-based indentation and fixing the dropdown menu close-on-action bug in virtualKeysTable.tsx.
Description check ✅ Passed The PR description is comprehensive and complete, covering all required template sections with clear explanations of the changes, testing steps, and affected areas.
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-19-fix_dropdown_open_state_in_the_vkey_table

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

@impoiler impoiler changed the title fix: dropdown open state in the vkey table chore: reformat virtualKeysTable.tsx and fix dropdown menu close-on-action May 19, 2026
@impoiler impoiler self-assigned this May 19, 2026
@impoiler
impoiler force-pushed the 05-19-fix_dropdown_open_state_in_the_vkey_table branch 2 times, most recently from 0113030 to b5c60e1 Compare May 20, 2026 03:39
@impoiler
impoiler force-pushed the 05-19-chore_added_a_close_button_to_the_toast_notification branch from 90b89b3 to 0e6e600 Compare May 20, 2026 03:39
@impoiler
impoiler force-pushed the 05-19-fix_dropdown_open_state_in_the_vkey_table branch from b5c60e1 to 5c657d1 Compare May 20, 2026 03:57
@impoiler
impoiler marked this pull request as ready for review May 20, 2026 04:26
@coderabbitai
coderabbitai Bot requested a review from akshaydeo May 20, 2026 04:27
@greptile-apps

greptile-apps Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — changes are UI-only, self-contained, and consistently applied across all affected files.

The refactor is purely additive state management on controlled Radix UI dropdowns; the onSelect+e.preventDefault()+setIsOpen(false) pattern is idiomatic and all callbacks are threaded correctly. No data-fetching, auth, or backend logic is touched.

No files require special attention.

Important Files Changed

Filename Overview
ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx Core target of the PR — adds controlled isOpen state to VKActionsMenu and calls setIsOpen(false) on Edit/Delete selection so the dropdown closes immediately; also reformats with tab indentation.
ui/app/workspace/mcp-logs/views/mcpLogDetailsSheet.tsx Replaces AlertDialogTrigger-based delete with controlled dropdownOpen state; removes unused AlertDialogTrigger import; all three menu items now use onSelect + e.preventDefault() + manual close.
ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx Extracts MCPClientActionsMenu component; correctly threads isReconnecting, hasUpdateAccess, hasDeleteAccess, onReconnect (wrapping void), and onDelete props; adds setIsOpen(false) on each action.
ui/app/workspace/governance/views/customerTable.tsx Adds isOpen/setIsOpen controlled state; switches from onClick+stopPropagation to onSelect+preventDefault+setIsOpen(false) — correct pattern for Radix UI controlled dropdowns.
ui/app/workspace/governance/views/teamsTable.tsx Same controlled-dropdown fix as customerTable; Delete action sets both setDeleteOpen(true) and setIsOpen(false), correctly decoupling the inner confirm dialog from the dropdown.
ui/app/workspace/logs/views/columns.tsx Extracts LogActionsMenu component from inline table cell JSX; adds controlled open state; adds useState import that was previously unnecessary.
ui/app/workspace/model-limits/views/modelLimitsTable.tsx Extracts ModelLimitActionsMenu component; correctly forwards hasUpdateAccess/hasDeleteAccess and all callbacks; adds setIsOpen(false) on both actions.
ui/app/workspace/providers/views/modelProviderKeysTableView.tsx Extracts ProviderKeyActionsMenu component; onEdit/onDelete lambdas correctly set dialog state in the parent; controlled open state added.
ui/app/workspace/routing-rules/views/routingRulesTable.tsx Extracts RoutingRuleActionsMenu component; canUpdate/canDelete and callbacks correctly threaded; setIsOpen(false) added on both actions.
ui/app/workspace/custom-pricing/overrides/scopedPricingOverridesView.tsx Extracts PricingOverrideActionsMenu component; openEditDrawer and setDeleteTarget passed correctly as onEdit/onDelete callbacks.

Reviews (3): Last reviewed commit: "fix: dropdown open state in the vkey tab..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx`:
- Around line 62-87: The new DropdownMenuItem entries for reconnect and delete
lack data-testid attributes needed for E2E tests; update the Reconnect
DropdownMenuItem (the one that calls onReconnect(client) and checks
isPerUserOAuth / client.config.disabled / isReconnecting) and the Delete
DropdownMenuItem (the one that calls onDelete(client) and uses
variant="destructive") to include unique data-testid values (e.g., data-testid
values incorporating client.id or client.name such as reconnect-<client.id> and
delete-<client.id>) so tests can reliably target them while preserving the
existing props and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9c214f2f-eea8-4ea5-a3f9-716686103858

📥 Commits

Reviewing files that changed from the base of the PR and between 0e6e600 and 5c657d1.

📒 Files selected for processing (10)
  • ui/app/workspace/custom-pricing/overrides/scopedPricingOverridesView.tsx
  • ui/app/workspace/governance/views/customerTable.tsx
  • ui/app/workspace/governance/views/teamsTable.tsx
  • ui/app/workspace/logs/views/columns.tsx
  • ui/app/workspace/mcp-logs/views/mcpLogDetailsSheet.tsx
  • ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx
  • ui/app/workspace/model-limits/views/modelLimitsTable.tsx
  • ui/app/workspace/providers/views/modelProviderKeysTableView.tsx
  • ui/app/workspace/routing-rules/views/routingRulesTable.tsx
  • ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx

Comment thread ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx
@impoiler
impoiler force-pushed the 05-19-fix_dropdown_open_state_in_the_vkey_table branch from 5c657d1 to 630a813 Compare May 20, 2026 06:37
@impoiler
impoiler force-pushed the 05-19-chore_added_a_close_button_to_the_toast_notification branch from 0e6e600 to 0afc367 Compare May 20, 2026 06:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/app/workspace/mcp-logs/views/mcpLogDetailsSheet.tsx`:
- Around line 168-178: The delete action item in the McpLogDetailsSheet React
component lacks a stable selector for E2E tests; update the JSX for the delete
control (the delete ActionItem/button inside the McpLogDetailsSheet component)
to add a data-testid attribute (e.g. data-testid="mcp-log-delete" or your
project's naming convention) so the element can be targeted by tests, and ensure
any related clickable wrapper uses the same test id if the visible label is
nested.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d4064c40-9c9d-49eb-9bc5-8dadf3b18b28

📥 Commits

Reviewing files that changed from the base of the PR and between 5c657d1 and 630a813.

📒 Files selected for processing (10)
  • ui/app/workspace/custom-pricing/overrides/scopedPricingOverridesView.tsx
  • ui/app/workspace/governance/views/customerTable.tsx
  • ui/app/workspace/governance/views/teamsTable.tsx
  • ui/app/workspace/logs/views/columns.tsx
  • ui/app/workspace/mcp-logs/views/mcpLogDetailsSheet.tsx
  • ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx
  • ui/app/workspace/model-limits/views/modelLimitsTable.tsx
  • ui/app/workspace/providers/views/modelProviderKeysTableView.tsx
  • ui/app/workspace/routing-rules/views/routingRulesTable.tsx
  • ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx

Comment thread ui/app/workspace/mcp-logs/views/mcpLogDetailsSheet.tsx
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 20, 2026
@BearTS
BearTS force-pushed the 05-19-chore_added_a_close_button_to_the_toast_notification branch from 0afc367 to 39e7ac4 Compare May 20, 2026 09:00
@BearTS
BearTS force-pushed the 05-19-fix_dropdown_open_state_in_the_vkey_table branch from 630a813 to 6ca2e78 Compare May 20, 2026 09:00

akshaydeo commented May 20, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • May 20, 9:03 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 20, 9:04 AM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo changed the base branch from 05-19-chore_added_a_close_button_to_the_toast_notification to graphite-base/3602 May 20, 2026 09:03
@akshaydeo
akshaydeo changed the base branch from graphite-base/3602 to dev May 20, 2026 09:03
@akshaydeo
akshaydeo dismissed coderabbitai[bot]’s stale review May 20, 2026 09:03

The base branch was changed.

@akshaydeo
akshaydeo merged commit ba753eb into dev May 20, 2026
13 checks passed
@akshaydeo
akshaydeo deleted the 05-19-fix_dropdown_open_state_in_the_vkey_table branch May 20, 2026 09:04
akshaydeo pushed a commit that referenced this pull request May 20, 2026
…-action (#3602)

## Summary

Reformats `virtualKeysTable.tsx` to use tab-based indentation consistently throughout the file, and fixes a bug where the `VKActionsMenu` dropdown would remain open after selecting "Edit" or "Delete".

## Changes

- Converted all 2-space indentation to tabs across the entire `virtualKeysTable.tsx` file to match the project's preferred style
- Added explicit `isOpen` / `setIsOpen` state to `VKActionsMenu` and wired it to the `DropdownMenu`'s `open` / `onOpenChange` props so the menu closes immediately when "Edit" or "Delete" is selected, preventing the dropdown from staying visible while a sheet or dialog opens

## Type of change

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

## Affected areas

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

## How to test

1. Navigate to the Virtual Keys table.
2. Open the actions menu (⋯) on any virtual key row.
3. Click **Edit** — the dropdown should close immediately and the edit sheet should open.
4. Repeat and click **Delete** — the dropdown should close immediately and the delete confirmation dialog should appear.
5. Confirm neither the edit nor delete action leaves the dropdown menu visible in the background.

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

## Screenshots/Recordings

N/A

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

N/A

## Security considerations

No security implications. The change only affects UI rendering and dropdown state management.

## 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
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