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 @@
{% if last_check %} @@ -39,216 +39,231 @@
{% endif %} -
-
-
-
-
- - - - - - - - - - - - - - - - {% for device in devices %} - - - - - - - - - - - + +
+ {% for device in devices %} +
+
+
+
+ {{ device.name or device.hostname }} + {% if device.last_check %} + {% if device.online %} + + {% else %} + + {% endif %} + {% else %} + + {% endif %} +
+
+
+
StatusHostname / IPNameLEDsVersionMACLetzte AktivitaetSegmenteAktionen
- {% 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 }}
- - - - {% if firmwares %} - - {% endif %} - {% endfor %} + + {% if device.segments %} +
+ {% for seg in device.segments %} +
+ Seg {{ seg.segment }} + {{ seg.display_name }} +
+ {% endfor %} +
+ {% endif %} - {% if not devices %} - - - Noch keine Tuerschilder vorhanden. - - + {% if device.last_activity %} +
+ {{ device.last_activity }} +
+ {% endif %} +
+
-
- {{ devices|length }} Tuerschilder | Status wird alle 4 Minuten automatisch geprueft -
-
+ + + + {% if firmwares %} + + {% endif %} + {% endfor %} + + {% if not devices %} +
+
Noch keine Tuerschilder vorhanden.
+
+ {% endif %} +
+ +
+ {{ devices|length }} Tuerschilder | Status wird alle 4 Minuten automatisch geprueft +
+ + +
+
Neues Tuerschild
-
- - +
+
+ +
+
+ +
+
+ +
+
+ +
-
- - -
-
- - -
-
- - -
+
+
+
Firmware
-
-
- + +
+
- {% if firmwares %} -
- Verfuegbare Firmwares: {% for fw in firmwares %}
{{ fw.name }} ({{ fw.size }})