feat: add next scheduled run time to job metadata and implement detailed job view template

This commit is contained in:
Rizqi 2026-06-26 13:02:09 +07:00
parent 0edb707f77
commit bd6fac2815
3 changed files with 26 additions and 0 deletions

View File

@ -445,6 +445,16 @@ def job_to_display(jid, info):
vm_display = f"{len(vm_names)} VMs ({', '.join(vm_names[:3])}{'...' if len(vm_names) > 3 else ''})"
else:
vm_display = info.get('vm_name', '')
next_run = None
if HAS_SCHEDULER and scheduler and info.get('schedule_id'):
try:
sched_job = scheduler.get_job(f'backup-{jid}')
if sched_job and sched_job.next_run_time:
next_run = sched_job.next_run_time.strftime('%Y-%m-%d %H:%M:%S')
except Exception:
pass
return {
'id': jid,
'label': info.get('label', ''),
@ -468,6 +478,7 @@ def job_to_display(jid, info):
'weekly_day': info.get('weekly_day'),
'vm_names': vm_names,
'use_cbt': info.get('use_cbt', False),
'next_run': next_run,
}

View File

@ -233,6 +233,15 @@
{% endif %}
</div>
</div>
{% if job.schedule_type and job.schedule_type != 'now' and job.next_run %}
<div class="detail-item">
<div class="detail-item-label">Next Run Time</div>
<div class="detail-item-val mono" style="font-size:13.5px; color: var(--accent-2); display: flex; align-items: center; gap: 6px;">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="color: var(--accent-2);"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
{{ job.next_run }}
</div>
</div>
{% endif %}
<div class="detail-item">
<div class="detail-item-label">Started</div>
<div class="detail-item-val mono" style="font-size:13px;">{{ job.started_fmt }}</div>

View File

@ -177,6 +177,12 @@
</span>
{% if job.schedule_id %}
<span class="badge badge-green" style="font-size: 10px; padding: 2px 6px; display: inline-block;">Active</span>
{% if job.next_run %}
<div style="font-size: 11px; color: var(--accent-2); margin-top: 4px; font-weight: 600; display: flex; align-items: center; gap: 4px;">
<span style="font-size: 11px; line-height: 1;">&#x23F1;&#xFE0E;</span>
Next: {{ job.next_run }}
</div>
{% endif %}
{% else %}
<span class="badge badge-red" style="font-size: 10px; padding: 2px 6px; display: inline-block;">Cancelled</span>
{% endif %}