Skip to content

feat: allow trusted devices with unknown type to set device type - #114

Merged
reloadfast merged 1 commit into
mainfrom
feat/device-type-select-110
Mar 2, 2026
Merged

reloadfast merged 1 commit into
mainfrom
feat/device-type-select-110

Conversation

@reloadfast

Copy link
Copy Markdown
Owner

Summary

For trusted devices where the scanner couldn't determine the device type, users can now select it directly from the UI.

Behaviour

The select is shown only when device.trusted === true AND device_type is null or 'unknown'. Once a type is set, it shows as the normal read-only badge.

Changes

Backend

  • PATCH /api/devices/{id}/device_type — validates against {iot, server, router, workstation, unknown}, returns DeviceOut
  • 422 on invalid value, 404 on missing device

Frontend — Devices table (DevicesPage.tsx)

  • New DeviceTypeCell component: renders badge normally, or a Set type… select when conditions are met
  • Local localTypes state keeps the table in sync without a full refetch

Frontend — Device detail page (DeviceDetailPage.tsx)

  • Device Type section shows select instead of badge when trusted + unknown
  • Calls refetch() on save so the whole detail view updates

Testing

  • 277 backend tests pass (3 new)
  • 146 frontend tests pass
  • Ruff + ESLint + Prettier clean

Closes #110

Backend:
- PATCH /api/devices/{id}/device_type — validates against allowed set
  (iot|server|router|workstation|unknown), 422 on invalid value
- 3 new tests (set value, reject invalid, 404)

Frontend:
- DevicesPage: DeviceTypeCell replaces static badge in table;
  shows 'Set type…' select only when trusted=true AND type is
  null or 'unknown'
- DeviceDetailPage: same condition — device type section shows
  select instead of badge; calls refetch() on save
- Both pages maintain local state so UI updates immediately on save

Closes #110

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@reloadfast
reloadfast merged commit fde3a3d into main Mar 2, 2026
7 checks passed
@reloadfast
reloadfast deleted the feat/device-type-select-110 branch March 2, 2026 14:24
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.

feat: offer the option to select the type of device

1 participant