Add advanced menu on job to allow user to do things like make a job as stopped if the status ever gets hung
This commit is contained in:
26
ui/src/app/api/jobs/[jobID]/mark_stopped/route.ts
Normal file
26
ui/src/app/api/jobs/[jobID]/mark_stopped/route.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export async function GET(request: NextRequest, { params }: { params: { jobID: string } }) {
|
||||
const { jobID } = await params;
|
||||
|
||||
const job = await prisma.job.findUnique({
|
||||
where: { id: jobID },
|
||||
});
|
||||
|
||||
// update job status to 'running'
|
||||
await prisma.job.update({
|
||||
where: { id: jobID },
|
||||
data: {
|
||||
stop: true,
|
||||
status: 'stopped',
|
||||
info: 'Job stopped',
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`Job ${jobID} marked as stopped`);
|
||||
|
||||
return NextResponse.json(job);
|
||||
}
|
||||
Reference in New Issue
Block a user