hvac: add gateway delete (retire the old Modbus gateway config)
There was no way to remove an mhi_gateways row either, alongside the already-fixed device-delete gap — exposed by the same Modbus->MQTT switchover. Adds DELETE /api/mhi-gateways/:id (manage_devices cap) and a 'Delete gateway' button. Devices referencing the gateway are NOT deleted (mhi_gateway_id just goes NULL per the existing ON DELETE SET NULL FK) — the confirm dialog says so and points at the separate device-delete flow for retiring the stale mhi_modbus rows too. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7ce95a31da
commit
d7cbb0c452
3 changed files with 37 additions and 2 deletions
|
|
@ -113,6 +113,9 @@ export function updateMhiGateway(id: number, body: Partial<{ name: string; host:
|
|||
export function testMhiGatewayConnection(id: number): Promise<{ ok: boolean; note?: string; error?: string }> {
|
||||
return request(`/mhi-gateways/${id}/test-connection`, { method: 'POST', body: JSON.stringify({}) })
|
||||
}
|
||||
export function deleteMhiGateway(id: number): Promise<{ ok: boolean }> {
|
||||
return request(`/mhi-gateways/${id}`, { method: 'DELETE' })
|
||||
}
|
||||
export async function importMhiRegisterMap(id: number, file: File): Promise<MhiGateway> {
|
||||
const form = new FormData()
|
||||
form.append('file', file)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue