feat(devices): add console-only display name (console_name)
Lets staff set a friendly name for a device independent of whatever name the end user gave it in the app. console_name is never shown to app users and never synced from/to device_name; every display label across search, equipment/helpdesk name resolution, device search, and the Manage tab's issue linker now falls back through console_name -> device_name -> serial rather than device_name alone. Also includes an incidental one-line fix in devices/service.py: the nested-struct deep-merge in update_device() was missing the newly added device_health_settings key. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -159,9 +159,10 @@ def list_devices(
|
||||
if search:
|
||||
search_lower = search.lower()
|
||||
name_match = search_lower in (device.device_name or "").lower()
|
||||
console_name_match = search_lower in (device.console_name or "").lower()
|
||||
location_match = search_lower in (device.device_location or "").lower()
|
||||
sn_match = search_lower in (device.serial_number or "").lower()
|
||||
if not (name_match or location_match or sn_match):
|
||||
if not (name_match or console_name_match or location_match or sn_match):
|
||||
continue
|
||||
|
||||
results.append(device)
|
||||
@@ -222,7 +223,7 @@ def update_device(device_doc_id: str, data: DeviceUpdate) -> DeviceInDB:
|
||||
# Deep-merge nested structs so unmentioned sub-fields are preserved
|
||||
existing = doc.to_dict()
|
||||
nested_keys = (
|
||||
"device_attributes", "device_subscription", "device_stats",
|
||||
"device_attributes", "device_subscription", "device_stats", "device_health_settings",
|
||||
)
|
||||
for key in nested_keys:
|
||||
if key in update_data and isinstance(existing.get(key), dict):
|
||||
|
||||
Reference in New Issue
Block a user