Repository navigation
feat(ui): staff-portal style for the inventory pages - #204
kevwilliams merged 6 commits into
Conversation
…oundary The inventory masked itself behind "Checking inventory access…", re-ran host loaders and re-read all collections whenever the tab was hidden or the host revalidated (for example on a theme change), and cancelled in-flight saves. No other staff-portal page does this, and per-request authorization already covers what it protected. Match the host instead: - Tab hide/show, pagehide/pageshow and focus leave inventory, cache, forms and in-flight saves alone. - Navigation keeps the current view on screen until the host has loaded. - A host revalidation for the same user pauses new reads and operations while it runs; nothing on screen changes. - A change of signed-in user (including A→B→A) or of non-presentation URL parameters replaces the private cache, with one fresh read. Tests for the removed hidden/pagehide/revalidation behaviour are removed; new tests cover inventory, forms and saves surviving tab switches. The design doc records the decision and the retained protections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g tab List pages follow staff-portal's Customers list: one toolbar row on top of a compact sortable datum-ui data table with a rows-per-page footer. - A category switcher (datum-ui Popover of links grouped by Equipment, Locations and Installation plans) replaces the group and kind tab rows. Each category shows its count once access resolves; the count is a description, not part of the name. - Manufacturers and Device types move to a Catalog tab with a two-option toggle. Links are absolute, and a kind requested on the other page is redirected there. - The toolbar row: borderless search, one Filter popover (facility, model, Clear filters), icon Refresh, Create. - The table keeps the directory rows' columns, attention edges and reasons, set on each row by InventoryListTable. - Fix: the list toolbar and table shared a React key, which duplicated the toolbar on every list/record switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record pages open with the staff-portal entity header: a back link to the list, the record's icon, name and one-line summary, and the actions. Record tabs use the pill style. The rack page moves facility, height and issue badges into the header summary, uses pill tabs, shows the face choice as a segmented pill and closes the device panel with an icon button. The screenshot script waits for the new header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ecv
left a comment
There was a problem hiding this comment.
Request changes.
The provider check is red at this head: in inventory-tab-navigation.test.tsx, "defaults to Devices and switches to every category without extra collection reads" fails at line 228. It expects the trigger "Inventory category: Racks" and gets "Facilities". This PR rewrote that test and the base has no switcher, so the failure is this PR's: either a stale trigger after chooseCategory or a race in the new helper.
- User switches hold up. A to B remounts the keyed
SessionQueriesin the same render, and A to B to A is caught by theHostedInventorysubscription, so B never sees A's data or a held operation. - With the pagehide, hidden and pageshow handling removed, nothing re-checks the signed-in user when a tab returns from hidden or from the back-forward cache. If another user signs in elsewhere meanwhile, the old user's data stays visible and writes go out under the new session. Show that the host revalidates on focus, or restore the check.
- Deleted tests with no replacement: the denied-access test asserting exactly nine list GETs with no permission review or write, and generations staying masked until the newest loader finishes. Restore them or point to where they live now.
scotwells
left a comment
There was a problem hiding this comment.
The open review still applies at this head (b9c6319). The provider check is still red on inventory-tab-navigation.test.tsx ("defaults to Devices and switches to every category…": 1 failed, 962 passed). The session re-check on tab return and the deleted access and generation tests are also still open.
"defaults to Devices and switches to every category without extra collection reads" failed in CI (trigger read "Facilities", expected "Racks") but passed locally. The cause is the test, not the switcher: RouterProvider applies router state to React inside startTransition, so router.state.location and navigation.state reach the new category before the page commits, and the "search box enabled" wait was satisfied by the previous category's search box. Under CPU load the trigger was read before the transition committed (2 of 6 loaded runs failed locally). Add switchCategory(), which waits for the new category's own search box (a committed signal independent of the trigger), and use it in the loop; the router-state checks become plain assertions after the commit. The trigger is not stale: it and the page read the same rendered location. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dcde392 removed the hidden/pagehide/pageshow handling to stop the "Checking inventory access" flashes, and with it the only re-check of the signed-in user after a tab was hidden or restored from the back-forward cache. The host does not do this: the principal arrives only through the Milo layout loader (requireStaffUser), which staff-portal re-runs on navigations and explicit revalidation only; app/ has no focus, visibilitychange or pageshow handling (staff-portal ba00ea6). Restore the check without any visible state: - Reads and operations gain a hold that pauses instead of cancelling (SessionHold). A read waits to start or deliver; a save waits in InventoryOperation.settle(), called right before every dispatch(). - Hiding the tab or pagehide holds the session. Showing it again, or any pageshow after a pagehide (always when persisted), calls router.revalidate(). The same user releases the hold and held work continues; another user, no user, a host error or a rejected revalidate fails closed, so held writes are never sent and a new principal remounts the cache. A later successful check reopens the session for new work only. - Host revalidation (e.g. a theme change) now holds and then releases same-user work instead of retiring it, so the return check does not refuse a save the user already made. Tests cover a same-user return (no flash, only the host loader, held create resumes, Refresh waits), a different user (old records gone, held create never sent), bfcache pageshow, failed checks, and held create/label/placement saves for both cases. The design doc records the host evidence and the new table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Restore, adapted to the switcher UI and the unmasked return check: - Denied access: a denied Refresh reads exactly nine collections (all GET, nine distinct lists) with no write. It now also sends exactly one SelfSubjectAccessReview: Refresh re-checks management access by design (recheckInventoryPermission), issued with the reads before the denial is known; once Devices is denied the Create device permission query is disabled, so no further review follows. The base test saw zero because its denial arrived through a host revalidation that rebuilt the cache. - Generations: overlapping return checks keep reads and operations held until the newest loader finishes; the earlier loader finishing releases nothing. The page itself is no longer masked, so the test asserts held work instead. - A check answered after another pagehide keeps work held until the next return (was "must keep inventory concealed ..."). - Logout or host failure found on return, immediate and held, for hidden and pagehide, removes the private page and refuses held work; focus alone does not re-check (was "settled host restoration handles ..."). - A failed return check stays closed until a later check succeeds (was "keeps failed foreground restoration masked ..."). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@ecv @scotwells addressed in 64746f2, 83a2f58, 7693723.
992 tests pass. |
scotwells
left a comment
There was a problem hiding this comment.
All three holds are fixed at 7693723. The switcher test now waits for the new category's page to render, and CI is green. A returning tab re-checks the signed-in user, and no save goes out until the check confirms the same user. The deleted access and generation tests are back in their new form.
Brings the inventory pages in line with staff-portal's list and detail style, rebuilt on the current
feat/manual-inventory-records.Changes
Session boundary (
dcde392)kind,record,tab,view, filters and so on) keep the loaded data.List pages and Catalog (
be46b9c)DataTableat compact density with sortable headers, a "rows per page · 1–N of M" footer, and row marks for conflicts and unavailable data.Record pages (
b9c6319)Docs:
docs/development/staff-inventory-ui.mddescribes the navigation and session boundary as implemented.Testing
pnpm testinui/provider: 1000 passed, including the native-controls guard.pnpm buildpass.Not in this PR
🤖 Generated with Claude Code