Files
minstrel/web/src/routes/collection/+page.svelte
T
bvandeusenandClaude Opus 5.5 ebb8e331a2
release / web (push) Successful in 1m42s
release / go (push) Successful in 2m13s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m38s
release / android (push) Successful in 5m11s
release / Build signed APK (push) Successful in 5m29s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 27s
release / Verify release artifacts (tag releases only) (push) Skipped
refactor(web): Admin's Overview and the Collection draw a waiting queue with one row (DRY W9)
The "what is waiting, how long, Open" row was written out four times: the
failed scan, each queue and each status problem on the Overview, and each
queue on the Collection. NeedsYouRow draws it once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 03:24:47 -05:00

48 lines
1.9 KiB
Svelte

<script lang="ts">
import NeedsYouRow from '#lib/components/NeedsYouRow.svelte';
import { pageTitle } from '#lib/branding.js';
import { createAdminSummaryQuery } from '#lib/api/admin.js';
import { relativeTime } from '#lib/utils/relativeTime.js';
import { QUEUES, countOf, queueLabel } from '#lib/admin/queues.js';
// The Collection's overview: each health queue with something in it and
// how long its oldest has waited, then the empty ones on one line.
const summaryStore = createAdminSummaryQuery();
const summaryQ = $derived($summaryStore);
const summary = $derived(summaryQ.data);
const waiting = $derived(QUEUES.filter((d) => countOf(summary, d.key) > 0));
const clear = $derived(QUEUES.filter((d) => countOf(summary, d.key) === 0));
</script>
<svelte:head><title>{pageTitle('Collection')}</title></svelte:head>
<section class="space-y-3" data-testid="collection-overview">
{#if summaryQ.isPending}
<p class="text-sm text-text-secondary">Reading the queues…</p>
{:else if summaryQ.isError}
<p class="text-sm text-error-fg">
Couldn't read the queues.
<button type="button" class="underline hover:no-underline" onclick={() => summaryQ.refetch()}>Try again</button>
</p>
{:else}
{#if waiting.length > 0}
<ul class="divide-y divide-border rounded-lg border border-border bg-surface">
{#each waiting as d (d.key)}
{@const q = summary?.[d.key]}
<NeedsYouRow
href={d.href}
text={queueLabel(d, countOf(summary, d.key))}
when={q?.since ? `oldest ${relativeTime(q.since)}` : undefined}
testid="collection-queue"
/>
{/each}
</ul>
{/if}
{#if clear.length > 0}
<p class="text-xs text-text-muted" data-testid="collection-clear">
No {clear.map((d) => d.none).join(', ')}.
</p>
{/if}
{/if}
</section>