feat: allow trusted devices with unknown type to set device type - #114
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 === trueANDdevice_typeisnullor'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}, returnsDeviceOutFrontend — Devices table (
DevicesPage.tsx)DeviceTypeCellcomponent: renders badge normally, or aSet type…select when conditions are metlocalTypesstate keeps the table in sync without a full refetchFrontend — Device detail page (
DeviceDetailPage.tsx)refetch()on save so the whole detail view updatesTesting
Closes #110