diff --git a/components/jobs/job-detail-pane.tsx b/components/jobs/job-detail-pane.tsx index 42ddafc..9063113 100644 --- a/components/jobs/job-detail-pane.tsx +++ b/components/jobs/job-detail-pane.tsx @@ -1,9 +1,16 @@ 'use client' +import { useTransition } from 'react' +import { toast } from 'sonner' import { cn } from '@/lib/utils' import { JOB_STATUS_LABELS, JOB_STATUS_COLORS } from '@/components/shared/job-status' import { jobStatusToApi } from '@/lib/job-status' import type { JobWithRelations } from '@/actions/jobs-page' +import { Button } from '@/components/ui/button' +import { DemoTooltip } from '@/components/shared/demo-tooltip' +import { restartClaudeJobAction } from '@/actions/claude-jobs' + +const RESTARTABLE_API_STATUSES = new Set(['failed', 'cancelled', 'skipped']) interface FieldRowProps { label: string @@ -45,7 +52,9 @@ interface JobDetailPaneProps { isDemo: boolean } -export default function JobDetailPane({ job, isDemo: _isDemo }: JobDetailPaneProps) { +export default function JobDetailPane({ job, isDemo }: JobDetailPaneProps) { + const [isPending, startTransition] = useTransition() + if (!job) { return (
@@ -56,6 +65,14 @@ export default function JobDetailPane({ job, isDemo: _isDemo }: JobDetailPanePro const apiStatus = jobStatusToApi(job.status) const subject = subjectLabel(job) + const canRestart = RESTARTABLE_API_STATUSES.has(apiStatus) + + function handleRestart() { + startTransition(async () => { + const result = await restartClaudeJobAction(job!.id) + if ('error' in result) toast.error(result.error) + }) + } return (
@@ -111,6 +128,19 @@ export default function JobDetailPane({ job, isDemo: _isDemo }: JobDetailPanePro

Geen beschrijving.

)}
+ {canRestart && ( +
+ + + +
+ )}
) }