Devices list — add a per-page-size selector (10/25/50/100/200) #684
Closed
bdunncompany
started this conversation in
Ideas
Replies: 2 comments
-
|
Green light — PR welcome. Answers to your open questions:
A small unit test for the localStorage read/write helper would be appreciated since |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Shipped — the per-page-size selector (10/25/50/100/200) on the Devices list landed on Thanks @bdunncompany. Closing as resolved — reopen if it misbehaves. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Why
/devicespaginates client-side at a fixed 10 rows per page(
apps/web/src/components/devices/DeviceList.tsx:95—pageSize = 10default, no consumer overrides). For a partner with several hundred
endpoints, that's a lot of clicking. The data is already fetched in one
shot (
fetchWithAuth('/devices?includeDecommissioned=true')returns thefull list with no
limitparam), so the gating is purely the UI default.What I built
A working POC running on my own deploy. Behavior:
Implementation summary:
effectivePageSizeinitialized fromlocalStorage['breeze.devices.pageSize'], falling back to the propdefault if the stored value is missing, malformed, or not in the allowed
set.
localStoragewrite-through on every change, wrappedin try/catch (private mode / quota safe).
<select>next to the existing "Showing X to Y of Z"indicator, styled to match the page's other selects (
h-10 text-sm rounded-md border). Visible whenever there is at least one device, sousers can pick 25/page even when 10 fit on one page.
currentPageto 1 so the userdoesn't land on an out-of-range page.
pageSize?: numberprop onDeviceListstill acts as the default for new browsers; no consumeroutside
DevicesPagepasses it, so the public surface is unchanged.Scope is intentionally minimal:
DeviceList.tsx)Why localStorage instead of
users.settings.devicesPageSizeon this machine"; if a user wants the choice to follow them across
browsers, that's a follow-up.
Happy to switch to a server-side preference instead if you'd prefer
account-level persistence.
Accessibility
Uses a native
<select>element, so keyboard nav, screen-reader labels(
aria-label="Devices per page"), and OS-level form control behavior allcome for free. No custom appearance overrides.
Tests
The POC patch is a single-file change so I have not added a dedicated
DeviceList.test.tsxyet (there is no existing test file for thiscomponent — only its children — so adding one would be the first). Happy
to land a small unit test covering the
localStorageread/write helperalong with the PR.
Open questions
the same pattern? Easy follow-up; keeping this discussion scoped to
devices for now.
scope here.
Patches
One patch against latest main:
feat(web): devices list per-page-size selector (10/25/50/100/200, localStorage-persisted)plus a chevron/heightfix folded in.
PR is ready to open whenever you give the nod.
Beta Was this translation helpful? Give feedback.
All reactions