web/queue: replace pipelineResults array with object

This commit is contained in:
jj
2025-05-23 17:44:47 +00:00
parent 17bcfa3a03
commit 892c055d6a
7 changed files with 38 additions and 28 deletions

View File

@@ -96,7 +96,8 @@
// if only fetch workers are running, then we should
// show the sum of all running & completed fetch workers
if (running.size === 1 && running.has("fetch")) {
totalSize += info.pipelineResults.reduce((s, p) => s + (p?.size ?? 0), 0);
totalSize += Object.values(info.pipelineResults)
.reduce((s, p) => s + (p?.size ?? 0), 0);
}
const runningText = [...running].map(task => $t(`queue.state.running.${task}`)).join(", ");
@@ -107,7 +108,7 @@
}
const firstUnstarted = info.pipeline.find(w => {
if (info.completedWorkers.has(w.workerId))
if (info.pipelineResults[w.workerId])
return false;
const task = currentTasks[w.workerId];
@@ -134,7 +135,7 @@
};
const getWorkerProgress = (item: CobaltQueueItem, workerId: UUID): number | undefined => {
if (item.state === 'running' && item.completedWorkers.has(workerId)) {
if (item.state === 'running' && item.pipelineResults[workerId]) {
return 100;
}
@@ -187,7 +188,7 @@
<ProgressBar
percentage={getWorkerProgress(info, task.workerId) || 0}
workerId={task.workerId}
completedWorkers={info.completedWorkers}
pipelineResults={info.pipelineResults}
/>
{/each}
</div>