Add service categories and also unbreak things
This commit is contained in:
+26
-14
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user