fix(zigbee): inject IEEE/Vendor/Model/LQI props into approved nodes client-side

Backend already writes the properties on approve, but the frontend's local
addNode() call rebuilt NodeData without them — so newly approved zigbee
nodes showed an empty right panel until a full canvas reload. Build the
property list on the client from the PendingDevice fields so the canvas
state matches the DB row immediately. Single + bulk approve flows updated.
This commit is contained in:
Pouzor
2026-05-14 00:45:58 +02:00
parent 3a303a1376
commit 5822a1483a
2 changed files with 37 additions and 6 deletions
+23
View File
@@ -0,0 +1,23 @@
import type { NodeProperty, NodeType } from '@/types'
const ZIGBEE_TYPES: NodeType[] = ['zigbee_coordinator', 'zigbee_router', 'zigbee_enddevice']
export function isZigbeeType(type: NodeType | string | undefined | null): boolean {
return !!type && (ZIGBEE_TYPES as string[]).includes(type)
}
/** Build the IEEE/Vendor/Model/LQI property rows shown in the right panel.
* Matches backend `build_zigbee_properties`. */
export function buildZigbeeProperties(input: {
ieee_address?: string | null
vendor?: string | null
model?: string | null
lqi?: number | null
}): NodeProperty[] {
const props: NodeProperty[] = []
if (input.ieee_address) props.push({ key: 'IEEE', value: input.ieee_address, icon: null, visible: true })
if (input.vendor) props.push({ key: 'Vendor', value: input.vendor, icon: null, visible: true })
if (input.model) props.push({ key: 'Model', value: input.model, icon: null, visible: true })
if (input.lqi != null) props.push({ key: 'LQI', value: String(input.lqi), icon: null, visible: true })
return props
}