Show total job count and aggregate download speed on Jobs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jos Vooges | STH 2026-09-08 03:21:13 +02:00
parent 7b7ca96d91
commit c8647a9e9d
2 changed files with 44 additions and 1 deletions

View file

@ -293,6 +293,17 @@ export default function DownloadsPage() {
() => jobs.filter((j) => j.status === "IMPORTED"), () => jobs.filter((j) => j.status === "IMPORTED"),
[jobs] [jobs]
); );
const downloadingCount = useMemo(
() => jobs.filter((j) => j.status === "DOWNLOADING").length,
[jobs]
);
const totalSpeedBps = useMemo(
() =>
jobs
.filter((j) => j.status === "DOWNLOADING")
.reduce((sum, j) => sum + (j.progress?.speedBps ?? 0), 0),
[jobs]
);
async function runSearch() { async function runSearch() {
if (!query.trim() || !nodeId) return; if (!query.trim() || !nodeId) return;
@ -865,8 +876,23 @@ export default function DownloadsPage() {
</section> </section>
<section className="stack-section"> <section className="stack-section">
<div className="section-head"> <div className="section-head downloads-jobs-head">
<h2 className="section-title">Jobs</h2> <h2 className="section-title">Jobs</h2>
<div className="downloads-jobs-totals muted">
<span>
{jobs.length} job{jobs.length === 1 ? "" : "s"}
{activeJobs.length > 0 || completedJobs.length > 0
? ` · ${activeJobs.length} actief · ${completedJobs.length} voltooid`
: ""}
</span>
<span>
Snelheid:{" "}
<strong className="downloads-jobs-speed">
{downloadingCount === 0 ? "—" : formatSpeed(totalSpeedBps)}
</strong>
{downloadingCount > 0 ? ` (${downloadingCount} downloadend)` : ""}
</span>
</div>
</div> </div>
<div className="card"> <div className="card">
<div className="list-cards"> <div className="list-cards">

View file

@ -1418,6 +1418,23 @@ tr.row-selected {
gap: 0.35rem; gap: 0.35rem;
justify-content: flex-end; justify-content: flex-end;
} }
.downloads-jobs-head {
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: space-between;
gap: 0.5rem 1.25rem;
}
.downloads-jobs-totals {
display: flex;
flex-wrap: wrap;
gap: 0.35rem 1.25rem;
font-size: 0.85rem;
}
.downloads-jobs-speed {
color: var(--text-bright, var(--text));
font-variant-numeric: tabular-nums;
}
.downloads-target-select { .downloads-target-select {
min-height: 36px; min-height: 36px;
font-size: 0.8rem; font-size: 0.8rem;