Files
komp_ac/web/templates/pages/admin/ecb/status.html
2026-08-13 09:27:42 +02:00

76 lines
3.1 KiB
HTML

{#
The health card — crate::pages::admin::ecb::ui::StatusFragment, and what
ecb.html embeds on first load.
It carries its own poll trigger rather than the page carrying it, so the
trigger travels with each swap: while a batch is running the card asks for
itself every few seconds, and the card that comes back after the batch
finishes has no trigger, which is what stops the polling.
#}
<section class="panel status-card {{ page.health_class() }}"
{% if page.should_poll() %}hx-get="/admin/ecb/status" hx-trigger="every 3s" hx-target="#ecb-status" hx-swap="outerHTML"{% endif %}
id="ecb-status">
<h2>
{{ page.headline() }}
{% if page.import_running %}<span class="tag">import running</span>{% endif %}
</h2>
<p class="hint">{{ page.explanation() }}</p>
{# Coverage first and on its own line: the two dates and the gap between
them are the whole answer, and burying them in a four-column grid made
them read as trivia. #}
<div class="coverage">
<div class="coverage-point">
<span class="coverage-label">Verified through</span>
<span class="coverage-date">
{%- if let Some(date) = page.verified_through_date %}{{ date }}
{%- else %}never{% endif -%}
</span>
</div>
<div class="coverage-gap">
{%- if page.healthy %}<span class="tag tag-ok">up to date</span>
{%- else if page.days_behind > 0 %}<span class="tag tag-bad">{{ page.days_behind }} publication day{% if page.days_behind != 1 %}s{% endif %} behind</span>
{%- else %}<span class="tag tag-bad">no coverage</span>{% endif -%}
</div>
<div class="coverage-point">
<span class="coverage-label">Should reach</span>
<span class="coverage-date">{{ page.latest_verifiable_date }}</span>
</div>
</div>
<dl class="status-grid">
<div>
<dt>Last attempt</dt>
<dd>{% if let Some(when) = page.last_attempt() %}{{ when }}{% else %}<span class="hint">none recorded</span>{% endif %}</dd>
</div>
<div>
<dt>Last success</dt>
<dd>{% if let Some(when) = page.last_success() %}{{ when }}{% else %}<span class="hint">none</span>{% endif %}</dd>
</div>
<div>
<dt>Next import</dt>
<dd>{{ page.next_import() }}</dd>
</div>
<div>
<dt>Currencies on {% if let Some(date) = page.verified_through_date %}{{ date }}{% else %}the covered day{% endif %}</dt>
<dd>
{%- if page.covered_currencies.is_empty() %}<span class="hint">none</span>
{%- else %}{{ page.covered_currencies.len() }}{% endif -%}
</dd>
</div>
</dl>
{% if !page.covered_currencies.is_empty() %}
<div class="currency-list">
{% for currency in page.currencies() %}<span class="tag">{{ currency }}</span>{% endfor %}
</div>
{% endif %}
{% if let Some(failure) = page.last_failure() %}
<p class="hint failure-note">
Most recent failure — batch {{ failure.batch_id }}, started {{ failure.started() }}:
{% if let Some(message) = failure.error_message %}{{ message }}{% else %}no reason was recorded.{% endif %}
</p>
{% endif %}
</section>