fix(zigbee): hide check method in modal, force none/online for zigbee nodes
Zigbee nodes have no IP-based check — hide Check Method and Check Target fields in NodeModal for all three zigbee types. Default and force check_method='none' so the scheduler marks them always online. Backend approve and zigbee import routes also set status='online' and check_method='none' for zigbee node types.
This commit is contained in:
@@ -225,18 +225,18 @@ async def approve_device(
|
||||
if device.status != "pending":
|
||||
raise HTTPException(status_code=409, detail="Device already processed")
|
||||
device.status = "approved"
|
||||
_zigbee_types = {"zigbee_coordinator", "zigbee_router", "zigbee_enddevice"}
|
||||
_is_zigbee = node_data.type in _zigbee_types
|
||||
node = Node(
|
||||
label=node_data.label,
|
||||
type=node_data.type,
|
||||
ip=node_data.ip,
|
||||
hostname=node_data.hostname,
|
||||
status=node_data.status,
|
||||
status="online" if _is_zigbee else node_data.status,
|
||||
services=node_data.services or [],
|
||||
ieee_address=device.ieee_address,
|
||||
# Honour caller-supplied check_method, else default to ping when an IP exists
|
||||
# so the scheduler doesn't silently skip the new node.
|
||||
check_method=node_data.check_method or ("ping" if node_data.ip else None),
|
||||
check_target=node_data.check_target,
|
||||
check_method="none" if _is_zigbee else (node_data.check_method or ("ping" if node_data.ip else None)),
|
||||
check_target=None if _is_zigbee else node_data.check_target,
|
||||
)
|
||||
db.add(node)
|
||||
await db.flush()
|
||||
|
||||
@@ -157,7 +157,8 @@ async def _persist_pending_import(
|
||||
node = Node(
|
||||
label=label,
|
||||
type=n.get("type") or "zigbee_coordinator",
|
||||
status="unknown",
|
||||
status="online",
|
||||
check_method="none",
|
||||
ieee_address=ieee,
|
||||
services=[],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user