UI: show distill schedule next-run times in settings panel
Fetches /distill/status when the ⚙ panel opens and renders next run times below the distill buttons (monospace, muted). Shows "today", "tomorrow", or "Mar 18" format depending on how far away. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -813,9 +813,39 @@
|
||||
document.getElementById('mem-short-btn').classList.toggle('mem-on', memShort);
|
||||
}
|
||||
|
||||
function formatNextRun(iso) {
|
||||
if (!iso) return 'n/a';
|
||||
const dt = new Date(iso);
|
||||
const now = new Date();
|
||||
const diffMs = dt - now;
|
||||
const diffDays = Math.floor(diffMs / 86400000);
|
||||
const time = dt.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
||||
if (diffDays === 0) return `today ${time}`;
|
||||
if (diffDays === 1) return `tomorrow ${time}`;
|
||||
return dt.toLocaleDateString([], { month: 'short', day: 'numeric' }) + ' ' + time;
|
||||
}
|
||||
|
||||
async function loadSchedule() {
|
||||
const schedEl = document.getElementById('ctx-schedule');
|
||||
try {
|
||||
const res = await fetch('/distill/status');
|
||||
const d = await res.json();
|
||||
if (!d.enabled || !d.jobs.length) {
|
||||
schedEl.textContent = 'auto-distill disabled';
|
||||
return;
|
||||
}
|
||||
schedEl.innerHTML = d.jobs
|
||||
.map(j => `${j.id.replace('distill_', '').padEnd(6)} → ${formatNextRun(j.next_run)}`)
|
||||
.join('<br>');
|
||||
} catch {
|
||||
schedEl.textContent = '';
|
||||
}
|
||||
}
|
||||
|
||||
ctxOpenBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
ctxPanel.classList.toggle('open');
|
||||
if (ctxPanel.classList.contains('open')) loadSchedule();
|
||||
});
|
||||
|
||||
document.addEventListener('click', (e) => {
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<button class="ctx-btn" id="distill-all-btn" title="Run all three steps in sequence">all</button>
|
||||
</div>
|
||||
<div id="ctx-distill-status"></div>
|
||||
<div id="ctx-schedule"></div>
|
||||
</div>
|
||||
<div class="ctx-section">
|
||||
<div class="ctx-section-title">Backend</div>
|
||||
|
||||
@@ -766,6 +766,14 @@
|
||||
#ctx-distill-status.show { opacity: 1; }
|
||||
#ctx-distill-status.err { color: var(--error-text); }
|
||||
|
||||
#ctx-schedule {
|
||||
margin-top: 6px;
|
||||
font-size: 0.66rem;
|
||||
color: var(--muted);
|
||||
line-height: 1.7;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
|
||||
/* Ctx header button — shows current tier as a dim superscript */
|
||||
#ctx-open-btn .tier-badge {
|
||||
font-size: 0.6em;
|
||||
|
||||
Reference in New Issue
Block a user