diff --git a/frontend/src/components/admin/JobControls.tsx b/frontend/src/components/admin/JobControls.tsx index 959c4df..4faa2ee 100644 --- a/frontend/src/components/admin/JobControls.tsx +++ b/frontend/src/components/admin/JobControls.tsx @@ -13,6 +13,22 @@ function formatNextRun(iso: string | null): string { return `in ${hrs}h`; } +function formatAgo(iso: string | null | undefined): string { + if (!iso) return ''; + const mins = Math.floor((Date.now() - new Date(iso).getTime()) / 60_000); + if (mins < 1) return 'just now'; + if (mins < 60) return `${mins}m ago`; + const hrs = Math.floor(mins / 60); + if (hrs < 24) return `${hrs}h ago`; + return `${Math.floor(hrs / 24)}d ago`; +} + +function lastRunColor(status: string | null | undefined): string { + if (status === 'error') return 'text-red-300'; + if (status === 'rate_limited') return 'text-amber-300'; + return 'text-gray-500'; +} + export function JobControls() { const { data: jobs, isLoading } = useJobs(); const toggleJob = useToggleJob(); @@ -139,6 +155,13 @@ export function JobControls() { Not registered )} + {!job.running && job.runtime_finished_at && ( +