fix: persist customers pagination/search in URL state and improve table layout - #3751
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughThis PR refactors the customers page to use URL-backed state for search and pagination via ChangesGovernance state management and table empty-state handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
f9fc93c to
782c5fe
Compare
364141a to
0454568
Compare
782c5fe to
f987fc9
Compare
0454568 to
b636d08
Compare
f987fc9 to
146cab3
Compare
b636d08 to
05d8a2f
Compare
146cab3 to
ecda73a
Compare
05d8a2f to
1b6f765
Compare
1b6f765 to
e02f244
Compare
ecda73a to
c8a50a8
Compare
Confidence Score: 4/5Safe 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
Reviews (4): Last reviewed commit: "fix: governance pages views and layout f..." | Re-trigger Greptile |
3e6125e to
d4273fe
Compare
8991c33 to
7f82c60
Compare
d4273fe to
7e4bc70
Compare
7f82c60 to
1b4ba73
Compare
Merge activity
|
The base branch was changed.
1b4ba73 to
7f9e347
Compare
…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
…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

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
h-[calc(100vh_-_50px)] flex flex-colto governance page wrappers so content fills the viewport and inner tables can grow to fill remaining space.useStateforsearchandoffseton the Customers page withnuqsuseQueryStates, syncing both values to the URL withhistory: "push". Resetting search now also resets offset to 0 in a single state update.isFetchingprop toCustomersTableandVirtualKeysTableto prevent the empty state from flashing while a fetch is in progress.CustomersTablelayout to useflex flex-col growso the table container expands to fill available space and the pagination bar stays anchored at the bottom.toLocaleString.Saveicon from the customer sheet submit button.Type of change
Affected areas
How to test
cd ui pnpm i pnpm buildScreenshots/Recordings
Add before/after screenshots of the governance table pages showing the full-height layout and updated pagination controls.
Breaking changes
Related issues
Security considerations
None. URL state contains only non-sensitive pagination and search values.
Checklist
docs/contributing/README.mdand followed the guidelines