jobs: Stop now cancels queued jobs; add remove/stop button on list rows
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -288,6 +288,17 @@ export function stopJob(jobId: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Stop a running job (cooperative abort) OR cancel a queued one (mark stopped so it won't promote).
|
||||
export async function requestStop(jobId: string): Promise<'stopped' | 'cancelled' | 'noop'> {
|
||||
if (stopJob(jobId)) return 'stopped';
|
||||
const job = await getPipelineJob(jobId);
|
||||
if (job && job.status === 'pending') {
|
||||
await updatePipelineJob(jobId, { status: 'stopped', completedAt: new Date() });
|
||||
return 'cancelled';
|
||||
}
|
||||
return 'noop';
|
||||
}
|
||||
|
||||
export function isJobLive(jobId: string): boolean {
|
||||
return liveJobs.has(jobId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user