Update ashboard (~1)
This commit is contained in:
@@ -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 `
|
||||
<div class="cron-item ${statusClass}">
|
||||
<i data-lucide="${icon}" class="cron-icon ${statusClass}"></i>
|
||||
<span class="cron-time">${job.time}</span>
|
||||
<span class="cron-time">${job.time}${dateStr ? ` <span style="color:#6b7280;font-size:11px">(${dateStr})</span>` : ''}</span>
|
||||
<span class="cron-name">${job.name}</span>
|
||||
<span class="cron-agent" style="color: var(--text-muted); font-size: 0.75rem; margin-left: auto;">${job.agentId || ''}</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user