Add job cancellation to work history page

This commit is contained in:
DJP 2025-12-13 15:44:13 -05:00
parent 87ec0fbe25
commit 44571e5ac9

View file

@ -214,10 +214,10 @@ export default function HistoryPage() {
<td className="px-6 py-4 text-gray-400 text-sm">
{job.completed_at
? `${Math.round(
(new Date(job.completed_at).getTime() -
new Date(job.created_at).getTime()) /
1000
)}s`
(new Date(job.completed_at).getTime() -
new Date(job.created_at).getTime()) /
1000
)}s`
: '-'}
</td>
<td className="px-6 py-4">
@ -229,6 +229,24 @@ export default function HistoryPage() {
>
<Eye className="w-4 h-4" />
</button>
{(job.status === 'queued' || job.status === 'processing') && (
<button
onClick={async () => {
try {
await jobsApi.delete(job.id);
toast.success('Job cancelled');
fetchJobs(); // Refresh the list
} catch (err) {
console.error('Failed to cancel job:', err);
toast.error('Failed to cancel job');
}
}}
className="p-2 text-gray-400 hover:text-red-400 transition-colors"
title="Cancel job"
>
<Trash2 className="w-4 h-4" />
</button>
)}
{job.output_asset_ids?.[0] && (
<button
onClick={() =>