fix(cloud): trim completed task metadata

go
codex 4 weeks ago
parent b14b5a76fc
commit 5d766449de

@ -1,4 +1,4 @@
import { initializeTaskCenter } from './task-center.js?v=2026102401';
import { initializeTaskCenter } from './task-center.js?v=2026102402';
const pageModules = Object.freeze({
instances: '/cloud/instances.js',

@ -137,7 +137,6 @@ html.panel-task-open .panel-sidebar { transform: translate3d(0, calc(0px - var(-
.panel-task-status.is-succeeded { background: #eaf7ef; color: #28804b; }
.panel-task-status.is-failed { background: #fff0f1; color: #b94b57; }
.panel-task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; margin-top: 8px; color: #8495a4; font-size: 10px; }
.panel-task-meta code { max-width: 100%; padding: 2px 5px; border-radius: 4px; background: #f1f5f7; color: #5d7385; overflow-wrap: anywhere; }
.panel-task-error,.panel-task-warning { margin: 11px 0 0; font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; }
.panel-task-error { color: #a4414d; }
.panel-task-warning { padding: 9px 11px; border-radius: 7px; background: #fff4e5; color: #835d22; }

@ -194,11 +194,11 @@ function renderItems(emptyMessage = '暂无任务记录。') {
const normalized = state.items.map(raw => ({ raw, task: normalizeTask(raw) }));
for (const group of [
{ title: '进行中', items: normalized.filter(item => !item.task.terminal) },
{ title: '已完成', items: normalized.filter(item => item.task.terminal) },
{ title: '', items: normalized.filter(item => item.task.terminal) },
]) {
if (!group.items.length) continue;
const section = element('section', 'panel-task-group');
section.append(element('h2', 'panel-task-group-title', group.title));
const groupNode = element('div', 'panel-task-group');
if (group.title) groupNode.append(element('h2', 'panel-task-group-title', group.title));
for (const { raw, task } of group.items) {
const article = element('article', `panel-task-item is-${statusClass(task)}${raw?.unread === true ? ' is-unread' : ''}`);
if (task.id) article.dataset.taskId = task.id;
@ -208,7 +208,6 @@ function renderItems(emptyMessage = '暂无任务记录。') {
const meta = element('div', 'panel-task-meta');
const recordedAt = dateText(raw.updated_at || raw.completed_at || raw.created_at);
if (recordedAt) meta.append(element('time', '', recordedAt));
if (task.id) meta.append(element('code', '', task.id));
if (meta.children.length) article.append(meta);
const recoveryNotice = recoveryTaskFailureNotice(task);
if (task.status !== 'failed' && recoveryNotice) {
@ -232,9 +231,9 @@ function renderItems(emptyMessage = '暂无任务记录。') {
}
}
article.append(detailBlock(task, raw));
section.append(article);
groupNode.append(article);
}
list.append(section);
list.append(groupNode);
}
if (!state.items.length) list.append(element('p', 'panel-task-empty', emptyMessage));
}

@ -1,2 +1,2 @@
{* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *}
{assign var=venix_asset_version value='2026102401' scope='global'}
{assign var=venix_asset_version value='2026102402' scope='global'}

@ -418,11 +418,14 @@ const protocolFailure = task => {
assert.match(source, /fetch\('\/api\/v1\/tasks\/read'/);
assert.match(source, /body:\s*JSON\.stringify\(\{ ids \}\)/);
assert.match(source, /\{ title: '进行中'/);
assert.match(source, /\{ title: '已完成'/);
assert.doesNotMatch(source, /\{ title: '已完成'/);
assert.match(source,
/element\('h2', 'panel-task-group-title', group\.title\)/);
/if \(group\.title\) groupNode\.append\(element\('h2', 'panel-task-group-title', group\.title\)\)/);
assert.doesNotMatch(source,
/panel-task-group-title', `\$\{group\.title\}(\$\{group\.items\.length\})`/);
assert.match(source, /append\('任务编号', task\.id\)/);
assert.doesNotMatch(source,
/meta\.append\(element\('code', '', task\.id\)\)/);
assert.match(source,
/`已显示 \$\{state\.items\.length\} 条`/);
assert.match(source,

Loading…
Cancel
Save