diff --git a/frontend/src/components/DownloadTable.vue b/frontend/src/components/DownloadTable.vue index 07baa8c..2298e55 100644 --- a/frontend/src/components/DownloadTable.vue +++ b/frontend/src/components/DownloadTable.vue @@ -20,6 +20,28 @@ function showToast(message: string): void { toastTimer = setTimeout(() => { toast.value = null }, 2000) } +// Completed jobs with downloadable files +const completedWithFiles = computed(() => + props.jobs.filter(j => j.status === 'completed' && j.filename) +) + +function downloadAll(): void { + const jobs = completedWithFiles.value + if (!jobs.length) return + // Stagger downloads slightly to avoid browser blocking + jobs.forEach((job, i) => { + setTimeout(() => { + const a = document.createElement('a') + a.href = downloadUrl(job) + a.download = '' + document.body.appendChild(a) + a.click() + document.body.removeChild(a) + }, i * 300) + }) + showToast(`Downloading ${jobs.length} file${jobs.length > 1 ? 's' : ''}…`) +} + // Sort state type SortKey = 'name' | 'status' | 'progress' | 'speed' | 'eta' const sortBy = ref('name') @@ -169,6 +191,11 @@ async function clearJob(jobId: string): Promise {