Files
komp_ac/web/templates/pages/admin/ecb/status.html
2026-08-24 10:36:13 +02:00

68 lines
2.7 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">{{ nav.tr("ecb-import-running") }}</span>{% endif %}
</h2>
<p class="hint">{{ page.explanation() }}</p>
<div class="postable">
<p class="postable-lead">{{ nav.tr("ecb-postable-lead") }}</p>
{% if let Some(through) = page.transactions_postable_through %}
<dl class="postable-grid">
<div>
<dt>{{ nav.tr("ecb-ordinary-transactions") }}</dt>
<dd>{{ nav.tr("ecb-dated-up-to") }} <strong>{{ through }}</strong></dd>
</div>
<div>
<dt>{{ nav.tr("ecb-statements-title") }}</dt>
<dd>{{ nav.tr("ecb-dated-up-to") }} <strong>{{ page.statements_postable_through.as_deref().unwrap_or("—") }}</strong></dd>
</div>
</dl>
{% else %}
<p><strong>{{ nav.tr("ecb-nothing") }}</strong> {{ nav.tr("ecb-no-publication-hint") }}</p>
{% endif %}
</div>
<dl class="status-grid">
<div>
<dt>{{ nav.tr("ecb-verified-through") }}</dt>
<dd>{% if let Some(date) = page.verified_through_date %}<strong>{{ date }}</strong>{% else %}<span class="hint">{{ nav.tr("ecb-never") }}</span>{% endif %}</dd>
</div>
<div>
<dt>{{ nav.tr("ecb-last-success") }}</dt>
<dd>{% if let Some(when) = page.last_success() %}{{ when }}{% else %}<span class="hint">{{ nav.tr("ecb-none") }}</span>{% endif %}</dd>
</div>
<div>
<dt>{{ nav.tr("ecb-next-import") }}</dt>
<dd>{{ page.next_import() }}</dd>
</div>
</dl>
{% if !page.covered_currencies.is_empty() %}
<div class="currency-list">
<strong>{{ nav.tr("ecb-ready-currencies") }}</strong>
{% for currency in page.currencies() %}<span class="tag">{{ currency }}</span>{% endfor %}
</div>
{% endif %}
{% if !page.healthy %}
{% if let Some(failure) = page.last_failure() %}
<p class="failure-note">
<strong>{{ nav.tr("ecb-latest-problem") }}</strong>
{% if let Some(message) = failure.error_message %}{{ message }}{% else %}{{ nav.tr("ecb-no-reason-recorded") }}{% endif %}
</p>
{% endif %}
{% endif %}
</section>