feat(devices): add device management#40
Conversation
Test & Lint Summary
|
|
Implementation complete. Requesting code review. Changes (10 files, +979/-31):
CI status: Build ✅ | E2E pending | Argos: visual changes expected (new page) |
noa-lucent
left a comment
There was a problem hiding this comment.
Clean implementation that closely follows the existing ApiTokensPage / CreateApiTokenDialog patterns. All spec requirements from Issue #39 are addressed:
- ✅
formatDeviceStatusutility with unit tests - ✅
CreateDeviceDialogwith enrollment JWT flow (one-time display, copy, warning, blocked close) - ✅
DevicesPagewith list, search, sort, delete confirmation - ✅ Route added as sibling to
api-tokens - ✅ Sidebar NavLink with
MonitorSmartphoneIcon, before API Tokens - ✅ Generated proto types regenerated
One minor comment on the React key fallback in DevicesPage. Otherwise, this is ready to merge.
| className="grid items-center gap-2 px-6 py-4 text-sm text-foreground md:grid-cols-[2fr_1fr_1fr_120px]" | ||
| data-testid="devices-row" | ||
| > | ||
| <span className="font-medium" data-testid="devices-name"> |
There was a problem hiding this comment.
[minor] Falling back to device.name as a React key when deviceId is undefined is fragile — device names aren't unique, so two devices with the same name would cause key collisions and rendering bugs.
The ApiTokensPage reference uses token.id directly (a required top-level field), so there's no fallback needed there. Here, since meta is an optional proto message field, consider asserting the ID is present rather than silently degrading:
const deviceId = device.meta?.id ?? '';
// ...
key={deviceId}An empty string key is at least consistently degenerate and signals something is wrong, rather than silently producing plausible-looking-but-wrong keys.
Summary
Testing
Fixes #39