Show persistent operations queue

This commit is contained in:
wuyang
2026-11-04 10:11:04 +08:00
parent 830d5b722a
commit 713c3cd0a2
3 changed files with 33 additions and 1 deletions
+10
View File
@@ -118,6 +118,16 @@ async function openDaily() {
try {
const data = await api('/api/daily');
host.replaceChildren();
try {
const queue = await api('/api/workqueue');
const work = el('section', undefined, 'report-section');
work.append(el('h2', '持续工作'));
const status = { pending: '待继续', running: '进行中', done: '已完成', blocked: '需要处理' };
const tasks = Array.isArray(queue.tasks) ? queue.tasks : [];
if (!tasks.length) work.append(el('p', '暂无任务。', 'muted'));
else { const list = el('ul'); for (const task of tasks) list.append(el('li', `${task.title} · ${status[task.status] || task.status} · ${task.updated_at ? dateTime(task.updated_at) : '时间待确认'}`)); work.append(list); }
host.append(work);
} catch { host.append(el('p', '暂时无法读取持续工作状态。', 'error')); }
if (data.invalid_count) host.append(el('p', `${data.invalid_count} 条记录无法读取,请检查数据文件。`, 'error'));
if (!data.records.length) host.append(el('p', '暂无每日记录。', 'empty'));
for (const record of data.records) {