diff --git a/dashboard/index.html b/dashboard/index.html index 5e2ba0e..c26f0ed 100644 --- a/dashboard/index.html +++ b/dashboard/index.html @@ -1427,6 +1427,22 @@ ? `Următorul: ${nextJob.time} ${nextJob.name}` : 'Toate job-urile au rulat azi'; + // Sort jobs: today first (by time), then other days (by date+time) + const today = new Date().toDateString(); + jobs.sort((a, b) => { + const aDate = new Date(a.nextRunAtMs || 0); + const bDate = new Date(b.nextRunAtMs || 0); + const aIsToday = aDate.toDateString() === today; + const bIsToday = bDate.toDateString() === today; + + // Today jobs come first + if (aIsToday && !bIsToday) return -1; + if (!aIsToday && bIsToday) return 1; + + // Within same category, sort by time + return (a.nextRunAtMs || 0) - (b.nextRunAtMs || 0); + }); + // Update details const details = document.getElementById('cronDetails'); details.innerHTML = jobs.map(job => { @@ -1435,10 +1451,15 @@ const statusClass = failed ? 'failed' : (done ? 'done' : 'pending'); const icon = failed ? 'x-circle' : (done ? 'check-circle' : 'clock'); + // Check if job is today + const jobDate = new Date(job.nextRunAtMs || 0); + const isToday = jobDate.toDateString() === today; + const dateStr = isToday ? '' : jobDate.toLocaleDateString('ro-RO', { day: 'numeric', month: 'short' }); + return `
- ${job.time} + ${job.time}${dateStr ? ` (${dateStr})` : ''} ${job.name} ${job.agentId || ''}