feat: add replay button on completed jobs in the jobs table

Shows a "Replay" button on non-active jobs that re-creates a new job
of the same type and library. Supports all replayable job types:
rebuild, full_rebuild, rescan, scan, thumbnail_rebuild,
thumbnail_regenerate, metadata_batch, metadata_refresh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-24 21:18:12 +01:00
parent 2febab2c39
commit 6a838fb840
5 changed files with 66 additions and 2 deletions

View File

@@ -95,6 +95,14 @@ export function JobsList({ initialJobs, libraries, highlightJobId }: JobsListPro
}
};
const handleReplay = async (id: string) => {
const response = await fetch(`/api/jobs/${id}/replay`, { method: "POST" });
if (!response.ok) {
const data = await response.json().catch(() => ({}));
console.error("Failed to replay job:", data?.error ?? response.status);
}
};
return (
<div className="bg-card rounded-xl shadow-sm border border-border/60 overflow-hidden">
<div className="overflow-x-auto">
@@ -119,6 +127,7 @@ export function JobsList({ initialJobs, libraries, highlightJobId }: JobsListPro
libraryName={job.library_id ? libraries.get(job.library_id) : undefined}
highlighted={job.id === highlightJobId}
onCancel={handleCancel}
onReplay={handleReplay}
formatDate={formatDate}
formatDuration={formatDuration}
/>