hvac: add device delete (retire stale mhi_modbus rows after MQTT switch)
There was no way to remove a zone_devices mapping — a gap exposed by the Modbus->MQTT switchover, which leaves the old mhi_modbus rows stale beside the freshly auto-registered mhi_mqtt ones. Adds DELETE /api/devices/:id (manage_devices cap, unlinks photo files then deletes; device_photos cascade) and a 'Delete device' button in the expanded device row. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6325532cfe
commit
7ce95a31da
3 changed files with 53 additions and 7 deletions
|
|
@ -71,6 +71,9 @@ export function discoverDevices(deviceType: string): Promise<{ ok: boolean; devi
|
|||
export function updateDevice(id: number, body: { zone_id?: number | null; location?: string }): Promise<Device> {
|
||||
return request(`/devices/${id}`, { method: 'PATCH', body: JSON.stringify(body) })
|
||||
}
|
||||
export function deleteDevice(id: number): Promise<{ ok: boolean }> {
|
||||
return request(`/devices/${id}`, { method: 'DELETE' })
|
||||
}
|
||||
export function createMaintenanceAsset(id: number): Promise<{ ok: boolean; notImplemented?: boolean; error?: string }> {
|
||||
return request(`/devices/${id}/create-maintenance-asset`, { method: 'POST', body: JSON.stringify({}) })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue