import page progress live

This commit is contained in:
Priec
2026-08-19 00:51:13 +02:00
parent e2956455c8
commit d6f2e6b0a4
12 changed files with 724 additions and 61 deletions

View File

@@ -0,0 +1,33 @@
{#
A running import — crate::pages::import_export::import::ui::ImportProgress.
The card carries its own poll trigger, the way admin/ecb's status card does:
while the import is running each answer is another card with the trigger
still on it, and the answer that ends the import is the success or failure
alert instead — which has no trigger, and that is what stops the polling.
#}
{#
The card sits inside #submission-status, which is a polite live region: left
alone, a screen reader would read the whole card out again every second. It
silences itself instead, and the alert that replaces it when the import ends
— which is the part worth hearing — is announced by the region as usual.
#}
<div id="import-progress" class="import-progress" aria-live="off"
hx-get="{{ poll_url }}" hx-trigger="every 1s"
hx-target="#import-progress" hx-swap="outerHTML">
<h3>{{ heading }}</h3>
<div class="progress-line">
<progress max="100" value="{{ percent }}" aria-label="{{ label }}"></progress>
<span class="progress-percent">{{ percent }}%</span>
</div>
<p class="progress-rows"><strong>{{ rows }}</strong></p>
<dl class="progress-stats">
{% for stat in stats %}
<div>
<dt>{{ stat.label }}</dt>
<dd>{{ stat.value }}</dd>
</div>
{% endfor %}
</dl>
<p class="hint">{{ hint }}</p>
</div>