feat: add replay button for download detection jobs and color-coded job type badges

Add download_detection to replayable job types and replay route handler.
Give each job type a unique colored background badge for better visual
distinction in the jobs table.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 06:27:04 +01:00
parent 0460ea7c1f
commit d81d941a34
3 changed files with 24 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
import { NextRequest, NextResponse } from "next/server";
import { apiFetch, IndexJobDto, rebuildIndex, rebuildThumbnails, regenerateThumbnails, startMetadataBatch, startMetadataRefresh, startReadingStatusMatch, startReadingStatusPush } from "@/lib/api";
import { apiFetch, IndexJobDto, rebuildIndex, rebuildThumbnails, regenerateThumbnails, startMetadataBatch, startMetadataRefresh, startReadingStatusMatch, startReadingStatusPush, startDownloadDetection } from "@/lib/api";
export async function POST(
_request: NextRequest,
@@ -35,6 +35,9 @@ export async function POST(
case "reading_status_push":
if (!libraryId) return NextResponse.json({ error: "Library ID required for reading status push" }, { status: 400 });
return NextResponse.json(await startReadingStatusPush(libraryId));
case "download_detection":
if (!libraryId) return NextResponse.json({ error: "Library ID required for download detection" }, { status: 400 });
return NextResponse.json(await startDownloadDetection(libraryId));
default:
return NextResponse.json({ error: `Cannot replay job type: ${job.type}` }, { status: 400 });
}