Add service categories and also unbreak things

This commit is contained in:
Helix K
2026-04-29 22:56:37 -05:00
parent 2791ed59e3
commit 6dd3371464
3 changed files with 35 additions and 19 deletions
+26 -14
View File
@@ -12,21 +12,33 @@
<body>
<h2>{{ cfg.web.name }}</h2>
{% for service in services %}
<div class="service">
<p><b>{{ service.name }}</b></p>
<div class="status">
{% for ping in uptime[service.name] %}
{% if ping == "I" %}
<p class="green">█</p>
{% elif ping == "O" %}
<p class="red">█</p>
{% else %}
<p class="grey">█</p>
{% endif %}
{% endfor %}
{% set services_by_cat = {} %}
{% for s in services %}
{% set cat = s.category if s.category else "__none__" %}
{% set _ = services_by_cat.setdefault(cat, []).append(s) %}
{% endfor %}
{% for cat, cat_services in services_by_cat.items() %}
{% if cat != "__none__" %}
<h3>{{ cat }}</h3>
{% endif %}
{% for service in cat_services %}
<div class="service">
<p><b>{{ service.name }}</b></p>
<div class="status">
{% for ping in uptime[service.name] %}
{% if ping == "I" %}
<p class="green">█</p>
{% elif ping == "O" %}
<p class="red">█</p>
{% else %}
<p class="grey">█</p>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endfor %}
{% endfor %}
</body>