diff --git a/app.py b/app.py index b4d7252..6a5b814 100644 --- a/app.py +++ b/app.py @@ -335,6 +335,14 @@ async def devices_page(request: Request): """, (dev["hostname"],)).fetchone() d = dict(dev) d["last_activity"] = last_act["la"] if last_act and last_act["la"] else None + # Segment assignments for this device + d["segments"] = conn.execute(""" + SELECT a.segment, u.display_name + FROM assignments a + JOIN users u ON u.azure_id = a.user_azure_id + WHERE a.wled_device_id = ? + ORDER BY a.segment + """, (dev["id"],)).fetchall() devices.append(d) last_check_row = conn.execute( "SELECT MAX(last_check) as lc FROM wled_devices WHERE last_check IS NOT NULL" diff --git a/templates/devices.html b/templates/devices.html index e55c2e3..ceb914b 100644 --- a/templates/devices.html +++ b/templates/devices.html @@ -7,7 +7,7 @@
| Status | -Hostname / IP | -Name | -LEDs | -Version | -MAC | -Letzte Aktivitaet | -Segmente | -Aktionen | -
|---|---|---|---|---|---|---|---|---|
| - {% if device.last_check %} - {% if device.online %} - - {% else %} - - {% endif %} - {% else %} - - {% endif %} - | -
- {{ device.hostname }}
- |
- {{ device.name }} | -{{ device.leds if device.leds else '-' }} | -{{ device.version if device.version else '-' }} | -{{ device.mac if device.mac else '-' }} | -{{ device.last_activity or '-' }} | -{{ device.segment_count }} | -- - {% if firmwares and device.version and device.online %} - {% set needs_update = [] %} - {% for fw in firmwares %} - {% if device.version not in fw.name %} - {% if needs_update.append(1) %}{% endif %} - {% endif %} - {% endfor %} - {% if needs_update %} - - {% endif %} - {% endif %} - - - | -
| Host | +{{ device.hostname }} |
+
| MAC | +{{ device.mac if device.mac else '-' }} | +
| Version | +{{ device.version if device.version else '-' }} | +
| LEDs | +{{ device.leds if device.leds else '-' }} | +
| Segmente | +{{ device.segment_count }} | +