From ef9444a766a6fcf311265c71e47d9608de77a1d4 Mon Sep 17 00:00:00 2001 From: Till Immer Date: Mon, 29 Jun 2026 18:26:25 +0000 Subject: [PATCH] ui grouping --- script-api.py | 163 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 154 insertions(+), 9 deletions(-) diff --git a/script-api.py b/script-api.py index 6a14cba..b4f2206 100755 --- a/script-api.py +++ b/script-api.py @@ -493,16 +493,34 @@ class ApiHandler( ).path + if path == "/": - + self.send_html( 200, render_index() ) - + + return + + + + group_match = re.fullmatch( + r"/group/([a-zA-Z0-9_-]+)", + path + ) + + + if group_match: + + self.send_html( + 200, + render_group( + group_match.group(1) + ) + ) + return - - if path == "/health": @@ -1386,11 +1404,14 @@ def render_index(): sections.append( - f""" +f""" + + +
-
{html.escape(group_name)} @@ -1398,17 +1419,20 @@ def render_index():
-
+
-{"".join(buttons)} +{len(commands)} Befehle
+ +
+ """ - ) +) @@ -1431,6 +1455,96 @@ Keine Befehle verfügbar. "\n".join(sections) ) + +def render_group(group_name): + + buttons = [] + + + for command_id, command in CONFIG["commands"].items(): + + + if not command.get( + "web_enabled", + False + ): + continue + + + title = command.get( + "web_title", + command_id + ) + + + current_group = title.split( + " ", + 1 + )[0] + + + if current_group != group_name: + + continue + + + + buttons.append( + f""" +
+ + + + + + + + +
+""" + ) + + + + if not buttons: + + return render_page( + "Fehler", + "
Gruppe nicht gefunden.
" + ) + + + return render_page( + + group_name, + + f""" + + + +← Gruppen + + + + +
+ +{"".join(buttons)} + +
+ +""" + + ) def render_page( title, body @@ -1556,6 +1670,37 @@ h1 {{ }} +.group-link {{ + + text-decoration: + none; + + color: + inherit; + +}} + + + +.group-card:hover {{ + + background: + var(--card-hover); + +}} + + + +.group-count {{ + + color: + var(--secondary); + + margin-top: + 8px; + +}} + .card {{