conditionalize rendering of everything

This commit is contained in:
Tomáš Mládek 2020-07-15 13:51:40 +02:00
parent 6a55261a3d
commit a2253f1845

View file

@ -13,86 +13,94 @@
<header>
<h1>/-\ infrastructure</h1>
</header>
<h2>important links</h2>
<section class="links boxes">
{% for link in links %}
<a class="link box" href="{{ link.url }}">
<section class="box-content">
{% if link.image_url %}
<img src="{{ link.image_url }}" alt="image for {{ link.short_name }}"/>
{% endif %}
<div class="label">
<h3>{{ link.short_name }}</h3>
{% if link.description %}
<p class="description">{{ link.description }}</p>
{% if links %}
<h2>important links</h2>
<section class="links boxes">
{% for link in links %}
<a class="link box" href="{{ link.url }}">
<section class="box-content">
{% if link.image_url %}
<img src="{{ link.image_url }}" alt="image for {{ link.short_name }}"/>
{% endif %}
</div>
</section>
</a>
{% endfor %}
</section>
<h2>internal&nbsp;services</h2>
<section class="services boxes">
{% for service in services %}
<a class="service box status-{{ service.status }}" href="{{ service.url }}">
<section class="box-content">
{% if service.image_url %}
<img src="{{ service.image_url }}" alt="image for {{ service.short_name }}"/>
{% endif %}
<div class="label">
<h3>{{ service.short_name }}</h3>
{% if service.description %}
<p class="description">{{ service.description }}</p>
{% endif %}
</div>
</section>
<section class="status">
STATUS: {{ service.status }}
</section>
</a>
{% endfor %}
</section>
<h2>machines</h2>
<section class="machines boxes">
<section class="stats">
VPS STATS &mdash; {{ vps_stats|safe }}
</section>
{% for machine in machines %}
<a class="machine box status-{{ machine.status }}" href="{{ machine.url|default:"#" }}">
<section class="box-content">
{% if machine.image_url %}
<img src="{{ machine.image_url }}" alt="image for {{ machine.short_name }}"/>
{% endif %}
<div class="label">
<h3>{{ machine.short_name }}</h3>
{% if machine.description %}
<p class="description">{{ machine.description }}</p>
{% endif %}
</div>
</section>
<section class="status" title="Last ping at: {{ machine.last_ping|default:"UNKNOWN" }}">
STATUS: {{ machine.status }}
</section>
</a>
{% endfor %}
</section>
<h2>logs firehose</h2>
<section class="firehose">
<ul class="logs">
{% for feed_item in feed_items %}
<li>
<div class="header">
<div class="timestamp">[{{ feed_item.published_datetime|date:"Y-m-d | H:i:s" }}]</div>
<div class title="title">{{ feed_item.title }}</div>
</div>
{% if feed_item.summary %}
<div class="summary">
{{ feed_item.summary|bleach|safe }}
<div class="label">
<h3>{{ link.short_name }}</h3>
{% if link.description %}
<p class="description">{{ link.description }}</p>
{% endif %}
</div>
{% endif %}
</li>
</section>
</a>
{% endfor %}
</ul>
</section>
</section>
{% endif %}
{% if services %}
<h2>internal&nbsp;services</h2>
<section class="services boxes">
{% for service in services %}
<a class="service box status-{{ service.status }}" href="{{ service.url }}">
<section class="box-content">
{% if service.image_url %}
<img src="{{ service.image_url }}" alt="image for {{ service.short_name }}"/>
{% endif %}
<div class="label">
<h3>{{ service.short_name }}</h3>
{% if service.description %}
<p class="description">{{ service.description }}</p>
{% endif %}
</div>
</section>
<section class="status">
STATUS: {{ service.status }}
</section>
</a>
{% endfor %}
</section>
{% endif %}
{% if machines %}
<h2>machines</h2>
<section class="machines boxes">
<section class="stats">
VPS STATS &mdash; {{ vps_stats|safe }}
</section>
{% for machine in machines %}
<a class="machine box status-{{ machine.status }}" href="{{ machine.url|default:"#" }}">
<section class="box-content">
{% if machine.image_url %}
<img src="{{ machine.image_url }}" alt="image for {{ machine.short_name }}"/>
{% endif %}
<div class="label">
<h3>{{ machine.short_name }}</h3>
{% if machine.description %}
<p class="description">{{ machine.description }}</p>
{% endif %}
</div>
</section>
<section class="status" title="Last ping at: {{ machine.last_ping|default:"UNKNOWN" }}">
STATUS: {{ machine.status }}
</section>
</a>
{% endfor %}
</section>
{% endif %}
{% if feed_items %}
<h2>logs firehose</h2>
<section class="firehose">
<ul class="logs">
{% for feed_item in feed_items %}
<li>
<div class="header">
<div class="timestamp">[{{ feed_item.published_datetime|date:"Y-m-d | H:i:s" }}]</div>
<div class title="title">{{ feed_item.title }}</div>
</div>
{% if feed_item.summary %}
<div class="summary">
{{ feed_item.summary|bleach|safe }}
</div>
{% endif %}
</li>
{% endfor %}
</ul>
</section>
{% endif %}
</body>
</html>