feat(TRUEREF-0020): add job status page with pause/resume/cancel controls
- Extend indexing_jobs schema to support 'paused' and 'cancelled' status
- Add JobQueue methods: pauseJob(), resumeJob(), cancelJob()
- Create POST /api/v1/jobs/[id]/{pause,resume,cancel} endpoints
- Implement /admin/jobs page with auto-refresh (3s polling)
- Add JobStatusBadge component with color-coded status display
- Action buttons appear contextually based on job status
- Optimistic UI updates with error handling
- All 477 existing tests pass, no regressions
This commit is contained in:
22
src/lib/components/admin/JobStatusBadge.svelte
Normal file
22
src/lib/components/admin/JobStatusBadge.svelte
Normal file
@@ -0,0 +1,22 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
status: 'queued' | 'running' | 'paused' | 'cancelled' | 'done' | 'failed';
|
||||
}
|
||||
|
||||
let { status }: Props = $props();
|
||||
|
||||
const statusConfig: Record<typeof status, { bg: string; text: string; label: string }> = {
|
||||
queued: { bg: 'bg-blue-100', text: 'text-blue-800', label: 'Queued' },
|
||||
running: { bg: 'bg-yellow-100', text: 'text-yellow-800', label: 'Running' },
|
||||
paused: { bg: 'bg-orange-100', text: 'text-orange-800', label: 'Paused' },
|
||||
cancelled: { bg: 'bg-gray-100', text: 'text-gray-800', label: 'Cancelled' },
|
||||
done: { bg: 'bg-green-100', text: 'text-green-800', label: 'Done' },
|
||||
failed: { bg: 'bg-red-100', text: 'text-red-800', label: 'Failed' }
|
||||
};
|
||||
|
||||
const config = $derived(statusConfig[status]);
|
||||
</script>
|
||||
|
||||
<span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium {config.bg} {config.text}">
|
||||
{config.label}
|
||||
</span>
|
||||
Reference in New Issue
Block a user