Skip to content

fix: persist customers pagination/search in URL state and improve table layout - #3751

Merged
akshaydeo merged 1 commit into
devfrom
05-26-fix_governance_pages_views_and_layout_fixes
May 27, 2026
Merged

fix: persist customers pagination/search in URL state and improve table layout#3751
akshaydeo merged 1 commit into
devfrom
05-26-fix_governance_pages_views_and_layout_fixes

Conversation

@impoiler

@impoiler impoiler commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Improves the layout of governance pages (Customers, Virtual Keys, Access Profiles, RBAC) so that tables fill the available viewport height without causing the full page to scroll. Also migrates the Customers page search and pagination state into URL query parameters so that filters and page position are preserved in browser history.

Changes

  • Applied h-[calc(100vh_-_50px)] flex flex-col to governance page wrappers so content fills the viewport and inner tables can grow to fill remaining space.
  • Replaced useState for search and offset on the Customers page with nuqs useQueryStates, syncing both values to the URL with history: "push". Resetting search now also resets offset to 0 in a single state update.
  • Added isFetching prop to CustomersTable and VirtualKeysTable to prevent the empty state from flashing while a fetch is in progress.
  • Refactored CustomersTable layout to use flex flex-col grow so the table container expands to fill available space and the pagination bar stays anchored at the bottom.
  • Redesigned the customers pagination controls to use ghost icon-only prev/next buttons with a "Page X of Y" label, and formatted entry counts with toLocaleString.
  • Removed the Save icon from the customer sheet submit button.

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 Customers governance page and verify the table fills the viewport without a full-page scrollbar.
  2. Enter a search term and paginate — confirm the search and page offset are reflected in the URL and survive a browser back/forward navigation.
  3. Clear the search and confirm the offset resets to 0.
  4. Delete the last item on the last page and confirm the offset snaps back correctly.
  5. Verify no empty-state flash occurs while data is loading on the Customers and Virtual Keys pages.
cd ui
pnpm i
pnpm build

Screenshots/Recordings

Add before/after screenshots of the governance table pages showing the full-height layout and updated pagination controls.

Breaking changes

  • Yes
  • No

Related issues

Security considerations

None. URL state contains only non-sensitive pagination and search values.

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 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ea545971-7105-481d-ad8d-41ac462ee95f

📥 Commits

Reviewing files that changed from the base of the PR and between ceb6243 and 7f9e347.

📒 Files selected for processing (7)
  • ui/app/workspace/governance/access-profiles/page.tsx
  • ui/app/workspace/governance/customers/page.tsx
  • ui/app/workspace/governance/rbac/page.tsx
  • ui/app/workspace/governance/views/customerSheet.tsx
  • ui/app/workspace/governance/views/customerTable.tsx
  • ui/app/workspace/governance/virtual-keys/page.tsx
  • ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Customers page search and pagination now sync with the URL for shareable, bookmarkable links
  • Bug Fixes

    • Fixed empty state display appearing while data is loading
  • Style

    • Updated pagination controls and layout spacing on governance pages

Walkthrough

This PR refactors the customers page to use URL-backed state for search and pagination via nuqs, adds an isFetching prop to customers and virtual-keys table components to suppress empty-state UI during data loading, redesigns the pagination UI with a compact format, and applies cosmetic improvements to the CustomerSheet and governance page layouts.

Changes

Governance state management and table empty-state handling

Layer / File(s) Summary
Table loading-state prop contracts
ui/app/workspace/governance/views/customerTable.tsx, ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx
CustomersTable and VirtualKeysTable interfaces add optional isFetching?: boolean prop; both components destructure the new prop.
Customers page URL-backed state migration
ui/app/workspace/governance/customers/page.tsx
Replace local state with nuqs useQueryStates for search and pagination offset. Customer fetch and offset snap-back logic now read/write URL state instead of component state.
CustomersTable isFetching integration and pagination redesign
ui/app/workspace/governance/views/customerTable.tsx
Implement isFetching prop to prevent empty-state display during loading. Redesign pagination bar as compact text-xs layout with ghost icon buttons. Update table header and spacing. Rewire CustomersTable props to use URL state for search/offset and receive isFetching.
VirtualKeysTable and virtual-keys page isFetching wiring
ui/app/workspace/governance/virtual-keys/page.tsx, ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx
VirtualKeysTable empty-state condition updated to require !isFetching. Virtual-keys page destructures isFetching from hook and passes it to the table.
CustomerSheet import reordering and icon removal
ui/app/workspace/governance/views/customerSheet.tsx
Reorder component imports (Input/Label before NumberAndSelect), remove Save icon import and rendering from submit button, reformat Validator rule arrays without changing validation logic.
Governance page layout styling updates
ui/app/workspace/governance/access-profiles/page.tsx, ui/app/workspace/governance/rbac/page.tsx
Access-profiles and RBAC pages add viewport-based height constraint and scrollable layout styling (h-[calc(100vh_-_50px)], flex, overflow-y-auto).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • maximhq/bifrost#3675: Both PRs remove the Save icon from sheet submit buttons in governance views.
  • maximhq/bifrost#3487: Both PRs modify customers and virtual-keys table components with overlapping UI refinements.
  • maximhq/bifrost#3560: Both PRs extend VirtualKeysTable functionality with loading state handling and virtual-keys page integration.

Suggested reviewers

  • danpiths
  • akshaydeo

Poem

🐰 Tables now know when they're hungry—
Behold the isFetching dance,
URLs remember journeys past,
Icons fade to elegant silence,
Layouts stretch to fill the void.

✨ 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-26-fix_governance_pages_views_and_layout_fixes

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

@impoiler impoiler reopened this May 26, 2026
@impoiler
impoiler force-pushed the 05-26-feat_adds_keyboard_navigation_in_the_routing_rules_sheet branch from f9fc93c to 782c5fe Compare May 26, 2026 07:50
@impoiler
impoiler force-pushed the 05-26-fix_governance_pages_views_and_layout_fixes branch from 364141a to 0454568 Compare May 26, 2026 07:50
@impoiler
impoiler force-pushed the 05-26-feat_adds_keyboard_navigation_in_the_routing_rules_sheet branch from 782c5fe to f987fc9 Compare May 26, 2026 09:44
@impoiler
impoiler force-pushed the 05-26-fix_governance_pages_views_and_layout_fixes branch from 0454568 to b636d08 Compare May 26, 2026 09:44
@impoiler
impoiler force-pushed the 05-26-feat_adds_keyboard_navigation_in_the_routing_rules_sheet branch from f987fc9 to 146cab3 Compare May 26, 2026 17:00
@impoiler
impoiler force-pushed the 05-26-fix_governance_pages_views_and_layout_fixes branch from b636d08 to 05d8a2f Compare May 26, 2026 17:00
@impoiler
impoiler force-pushed the 05-26-feat_adds_keyboard_navigation_in_the_routing_rules_sheet branch from 146cab3 to ecda73a Compare May 27, 2026 04:06
@impoiler
impoiler force-pushed the 05-26-fix_governance_pages_views_and_layout_fixes branch from 05d8a2f to 1b6f765 Compare May 27, 2026 04:06
@impoiler impoiler changed the title fix: governance pages views and layout fixes fix: persist customers pagination/search in URL state and improve table layout May 27, 2026
@impoiler impoiler self-assigned this May 27, 2026
@impoiler
impoiler force-pushed the 05-26-fix_governance_pages_views_and_layout_fixes branch from 1b6f765 to e02f244 Compare May 27, 2026 09:13
@impoiler
impoiler force-pushed the 05-26-feat_adds_keyboard_navigation_in_the_routing_rules_sheet branch from ecda73a to c8a50a8 Compare May 27, 2026 09:13
@greptile-apps

greptile-apps Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

Safe to merge after fixing the snap-back guard; the current logic fires a redundant setUrlState on every poll cycle when the list is empty.

The snap-back effect in customers/page.tsx calls setUrlState on every 5-second poll whenever the list is empty, because the guard urlState.offset < customersTotal evaluates to 0 < 0 = false and lets the call through even when offset is already 0. The rest of the changes are straightforward and carry no logic risk.

ui/app/workspace/governance/customers/page.tsx — the snap-back useEffect guard needs a no-op check before calling setUrlState.

Important Files Changed

Filename Overview
ui/app/workspace/governance/customers/page.tsx Migrates search/offset to nuqs URL state; snap-back effect fires unnecessarily (and pushes history) when both offset and total are 0, which re-triggers on every 5-second poll.
ui/app/workspace/governance/views/customerTable.tsx Layout refactored to flex/grow; isFetching guard prevents initial flash but causes the empty state to flicker away on every polling cycle when the list is empty.
ui/app/workspace/governance/virtual-keys/page.tsx Adds isFetching prop to VirtualKeysTable; same polling-vs-empty-state tradeoff as the customers table but no new logic changes.
ui/app/workspace/virtual-keys/views/virtualKeysTable.tsx Accepts optional isFetching prop and adds it to the empty-state guard; no other logic changes.
ui/app/workspace/governance/views/customerSheet.tsx Removes the Save icon from the submit button and fixes indentation in the Validator array spreads; no logic changes.
ui/app/workspace/governance/access-profiles/page.tsx Adds viewport-height flex layout to the wrapper div; purely cosmetic.
ui/app/workspace/governance/rbac/page.tsx Adds viewport-height flex layout with overflow-y-auto; purely cosmetic.

Reviews (4): Last reviewed commit: "fix: governance pages views and layout f..." | Re-trigger Greptile

Comment thread ui/app/workspace/governance/customers/page.tsx
Comment thread ui/app/workspace/governance/customers/page.tsx
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 27, 2026
@impoiler
impoiler force-pushed the 05-26-feat_adds_keyboard_navigation_in_the_routing_rules_sheet branch from 3e6125e to d4273fe Compare May 27, 2026 12:30
@impoiler
impoiler force-pushed the 05-26-fix_governance_pages_views_and_layout_fixes branch from 8991c33 to 7f82c60 Compare May 27, 2026 12:30
@impoiler
impoiler force-pushed the 05-26-feat_adds_keyboard_navigation_in_the_routing_rules_sheet branch from d4273fe to 7e4bc70 Compare May 27, 2026 13:16
@impoiler
impoiler force-pushed the 05-26-fix_governance_pages_views_and_layout_fixes branch from 7f82c60 to 1b4ba73 Compare May 27, 2026 13:16
Comment thread ui/app/workspace/governance/customers/page.tsx

akshaydeo commented May 27, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • May 27, 1:44 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 27, 1:52 PM UTC: Graphite rebased this pull request as part of a merge.
  • May 27, 1:53 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo changed the base branch from 05-26-feat_adds_keyboard_navigation_in_the_routing_rules_sheet to graphite-base/3751 May 27, 2026 13:50
@akshaydeo
akshaydeo changed the base branch from graphite-base/3751 to dev May 27, 2026 13:51
@akshaydeo
akshaydeo dismissed coderabbitai[bot]’s stale review May 27, 2026 13:51

The base branch was changed.

@akshaydeo
akshaydeo force-pushed the 05-26-fix_governance_pages_views_and_layout_fixes branch from 1b4ba73 to 7f9e347 Compare May 27, 2026 13:51
@coderabbitai
coderabbitai Bot requested review from akshaydeo and danpiths May 27, 2026 13:53
@akshaydeo
akshaydeo merged commit a84e6f2 into dev May 27, 2026
14 of 15 checks passed
@akshaydeo
akshaydeo deleted the 05-26-fix_governance_pages_views_and_layout_fixes branch May 27, 2026 13:53
akshaydeo pushed a commit that referenced this pull request May 29, 2026
…le layout (#3751)

## Summary

Improves the layout of governance pages (Customers, Virtual Keys, Access Profiles, RBAC) so that tables fill the available viewport height without causing the full page to scroll. Also migrates the Customers page search and pagination state into URL query parameters so that filters and page position are preserved in browser history.

## Changes

- Applied `h-[calc(100vh_-_50px)] flex flex-col` to governance page wrappers so content fills the viewport and inner tables can grow to fill remaining space.
- Replaced `useState` for `search` and `offset` on the Customers page with `nuqs` `useQueryStates`, syncing both values to the URL with `history: "push"`. Resetting search now also resets offset to 0 in a single state update.
- Added `isFetching` prop to `CustomersTable` and `VirtualKeysTable` to prevent the empty state from flashing while a fetch is in progress.
- Refactored `CustomersTable` layout to use `flex flex-col grow` so the table container expands to fill available space and the pagination bar stays anchored at the bottom.
- Redesigned the customers pagination controls to use ghost icon-only prev/next buttons with a "Page X of Y" label, and formatted entry counts with `toLocaleString`.
- Removed the `Save` icon from the customer sheet submit button.

## Type of change

- [ ] Bug fix
- [x] 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 Customers governance page and verify the table fills the viewport without a full-page scrollbar.
2. Enter a search term and paginate — confirm the search and page offset are reflected in the URL and survive a browser back/forward navigation.
3. Clear the search and confirm the offset resets to 0.
4. Delete the last item on the last page and confirm the offset snaps back correctly.
5. Verify no empty-state flash occurs while data is loading on the Customers and Virtual Keys pages.

```sh
cd ui
pnpm i
pnpm build
```

## Screenshots/Recordings

_Add before/after screenshots of the governance table pages showing the full-height layout and updated pagination controls._

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

## Security considerations

None. URL state contains only non-sensitive pagination and search values.

## 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
akhsaul pushed a commit to akhsaul/bifrost that referenced this pull request Aug 27, 2026
…le layout (maximhq#3751)

## Summary

Improves the layout of governance pages (Customers, Virtual Keys, Access Profiles, RBAC) so that tables fill the available viewport height without causing the full page to scroll. Also migrates the Customers page search and pagination state into URL query parameters so that filters and page position are preserved in browser history.

## Changes

- Applied `h-[calc(100vh_-_50px)] flex flex-col` to governance page wrappers so content fills the viewport and inner tables can grow to fill remaining space.
- Replaced `useState` for `search` and `offset` on the Customers page with `nuqs` `useQueryStates`, syncing both values to the URL with `history: "push"`. Resetting search now also resets offset to 0 in a single state update.
- Added `isFetching` prop to `CustomersTable` and `VirtualKeysTable` to prevent the empty state from flashing while a fetch is in progress.
- Refactored `CustomersTable` layout to use `flex flex-col grow` so the table container expands to fill available space and the pagination bar stays anchored at the bottom.
- Redesigned the customers pagination controls to use ghost icon-only prev/next buttons with a "Page X of Y" label, and formatted entry counts with `toLocaleString`.
- Removed the `Save` icon from the customer sheet submit button.

## Type of change

- [ ] Bug fix
- [x] 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 Customers governance page and verify the table fills the viewport without a full-page scrollbar.
2. Enter a search term and paginate — confirm the search and page offset are reflected in the URL and survive a browser back/forward navigation.
3. Clear the search and confirm the offset resets to 0.
4. Delete the last item on the last page and confirm the offset snaps back correctly.
5. Verify no empty-state flash occurs while data is loading on the Customers and Virtual Keys pages.

```sh
cd ui
pnpm i
pnpm build
```

## Screenshots/Recordings

_Add before/after screenshots of the governance table pages showing the full-height layout and updated pagination controls._

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

## Security considerations

None. URL state contains only non-sensitive pagination and search values.

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

3 participants