fix(admin): drop processed count from RUNNING import card
Some checks failed
CI / Unit & Component Tests (pull_request) Has been cancelled
CI / OCR Service Tests (pull_request) Has been cancelled
CI / Backend Unit Tests (pull_request) Has been cancelled
CI / fail2ban Regex (pull_request) Has been cancelled
CI / Semgrep Security Scan (pull_request) Has been cancelled
CI / Compose Bucket Idempotency (pull_request) Has been cancelled

The whole document load commits in one transaction, so a live counter
sits at 0 for the entire run and only jumps to the final number on
completion. Showing "0" next to the spinner read as "nothing happening"
and prompted repeated retriggers. Render just the spinner + running
label until the DONE branch displays the final processed count.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-28 12:56:00 +02:00
parent 548bc60747
commit 74cc4c8722
2 changed files with 8 additions and 11 deletions

View File

@@ -42,14 +42,9 @@ function reasonLabel(code: string): string {
aria-label={m.admin_system_import_status_running()} aria-label={m.admin_system_import_status_running()}
class="inline-block h-5 w-5 animate-spin rounded-full border-2 border-ink-3 border-t-brand-mint motion-reduce:animate-none" class="inline-block h-5 w-5 animate-spin rounded-full border-2 border-ink-3 border-t-brand-mint motion-reduce:animate-none"
></span> ></span>
<div> <p class="font-sans text-xs font-bold tracking-widest text-ink-3 uppercase">
<p data-testid="processed-count" class="text-base font-bold text-ink"> {m.admin_system_import_status_running()}
{importStatus.processed} </p>
</p>
<p class="font-sans text-xs font-bold tracking-widest text-ink-3 uppercase">
{m.admin_system_import_status_running()}
</p>
</div>
</div> </div>
{:else if importStatus?.state === 'DONE'} {:else if importStatus?.state === 'DONE'}
<div class="mb-4 rounded-sm border border-green-200 bg-green-50 p-4 text-green-700"> <div class="mb-4 rounded-sm border border-green-200 bg-green-50 p-4 text-green-700">

View File

@@ -26,15 +26,17 @@ describe('ImportStatusCard', () => {
await expect.element(getByTestId('spinner')).toBeInTheDocument(); await expect.element(getByTestId('spinner')).toBeInTheDocument();
}); });
it('shows processed count at text-base while RUNNING', async () => { it('shows no processed count while RUNNING (spinner only, no misleading 0)', async () => {
// The whole document load commits in one transaction, so a live count would sit at 0
// until the end. Show just the spinner + "running" label instead of a stuck "0".
const { getByTestId } = render(ImportStatusCard, { const { getByTestId } = render(ImportStatusCard, {
props: { props: {
importStatus: makeStatus({ state: 'RUNNING', statusCode: 'IMPORT_RUNNING', processed: 7 }), importStatus: makeStatus({ state: 'RUNNING', statusCode: 'IMPORT_RUNNING', processed: 0 }),
ontrigger: () => {} ontrigger: () => {}
} }
}); });
await expect.element(getByTestId('processed-count')).toHaveTextContent('7'); await expect.element(getByTestId('processed-count')).not.toBeInTheDocument();
}); });
it('shows processed count while DONE', async () => { it('shows processed count while DONE', async () => {