exporting ECB2

This commit is contained in:
Priec
2026-08-13 09:27:42 +02:00
parent fe8ea680e3
commit 78d72b7a44
5 changed files with 227 additions and 29 deletions

View File

@@ -23,7 +23,10 @@
{% include "pages/admin/ecb/status.html" %}
<section class="panel">
<h2>Import attempts <span class="count">{{ page.batches.len() }}</span></h2>
<h2>
Import attempts <span class="count">{{ page.batches.len() }}</span>
{%- if page.failure_count() > 0 %}<span class="tag tag-bad">{{ page.failure_count() }} failed</span>{% endif -%}
</h2>
{% if page.batches.is_empty() %}
<p class="hint">
The importer has not recorded an attempt. It runs on startup and then daily, so
@@ -35,36 +38,45 @@
<table class="builder-table">
<thead>
<tr>
<th>Started</th><th>Finished</th><th>Window</th><th>Result</th>
<th>Observations</th><th>Verified through</th>
<th class="mark">#</th><th>Result</th><th>Started</th><th>Finished</th>
<th>Took</th><th>Window</th><th class="numeric">Observations</th>
<th>Verified through</th>
</tr>
</thead>
<tbody>
{% for batch in page.batches %}
<tr>
<td>{{ batch.started_at }}</td>
<td>
{%- if let Some(finished) = batch.completed_at %}{{ finished }}
{%- else %}<span class="hint">still running</span>{% endif -%}
</td>
<td>
{{ batch.window() }}
<div class="hint"><code>{{ batch.endpoint }}</code></div>
</td>
<tr{% if batch.failed() %} class="attempt-failed"{% endif %}>
<td class="mark">{{ batch.batch_id }}</td>
<td>
{%- if batch.succeeded() %}<span class="tag tag-ok">succeeded</span>
{%- else if batch.running() %}<span class="tag">running</span>
{%- else %}<span class="tag tag-bad">failed</span>{% endif -%}
{%- if let Some(message) = batch.error_message %}
<div class="hint">{{ message }}</div>
{% endif -%}
</td>
<td>{{ batch.observations() }}</td>
<td class="moment">{{ batch.started() }}</td>
<td class="moment">
{%- if let Some(finished) = batch.finished() %}{{ finished }}
{%- else %}<span class="hint">still running</span>{% endif -%}
</td>
<td class="numeric">
{%- if let Some(took) = batch.took() %}{{ took }}
{%- else %}<span class="hint"></span>{% endif -%}
</td>
<td>
{{ batch.window() }}
<div class="hint endpoint" title="{{ batch.endpoint }}"><code>{{ batch.endpoint }}</code></div>
</td>
<td class="numeric">{{ batch.observations() }}</td>
<td class="moment">
{%- if let Some(date) = batch.verified_through_date %}{{ date }}
{%- else %}<span class="hint"></span>{% endif -%}
</td>
</tr>
{% if let Some(message) = batch.error_message %}
<tr class="attempt-error">
<td class="mark"></td>
<td colspan="7">{{ message }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>

View File

@@ -16,21 +16,43 @@
</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>Verified through</dt>
<dd>{% if let Some(date) = page.verified_through_date %}{{ date }}{% else %}<span class="hint">never</span>{% endif %}</dd>
<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>Should reach</dt>
<dd>{{ page.latest_verifiable_date }}</dd>
<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_at }}</dd>
<dd>{{ page.next_import() }}</dd>
</div>
<div>
<dt>Currencies on that day</dt>
<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 -%}
@@ -40,13 +62,13 @@
{% if !page.covered_currencies.is_empty() %}
<div class="currency-list">
{% for currency in page.covered_currencies %}<span class="tag">{{ currency }}</span>{% endfor %}
{% 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_at }}:
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 %}