fix(web): remove duplicate inline runtime status notes (2.0.9)

This commit is contained in:
AttilaNet
2026-11-13 10:36:23 +08:00
parent 048be71ed1
commit cfce3e0bc5
14 changed files with 125 additions and 58 deletions
+2 -26
View File
@@ -116,7 +116,6 @@ export class PageView {
this.subtabs = el('div', {class: 'subtabs', role: 'tablist', 'aria-label': '子页面', hidden: true});
this.filterHost = el('div', {class: 'filter-bar'});
this.summary = el('p', {class: 'page-summary'});
this.runtimeStatus=el('div',{class:'page-summary',hidden:true});
this.formHost = el('div', {class: 'policy-form'});
this.actionsHost = el('div', {class: 'page-toolbar'});
this.content = el('div', {class: 'page-content'});
@@ -124,7 +123,7 @@ export class PageView {
dirty: path => account.edits.has(pathKey(path)), onError: this.error, onSelection: () => this.syncActions(),
onContext: (event, selected, row) => this.openContext(event, selected, row), onDetail: row => this.showDetail(row)};
this.form = new PolicyForm(this.formHost, this.context);
this.surface = el('div', {class: 'page-surface'}, this.errorBox, this.subtabs, this.filterHost, this.summary, this.runtimeStatus, this.formHost, this.actionsHost, this.content);
this.surface = el('div', {class: 'page-surface'}, this.errorBox, this.subtabs, this.filterHost, this.summary, this.formHost, this.actionsHost, this.content);
this.body = el('div', {class: 'page-body'}, this.surface, this.loading);
this.root.append(this.header, this.body);
if (key === 'login') this.login = new LoginPage(this.content, this);
@@ -248,7 +247,7 @@ export class PageView {
this.updateFilters(data.filters || []);
this.summary.textContent = typeof data.summary === 'string' ? data.summary : textValue(data.summary || '');
this.summary.hidden = !data.summary;
this.updateRuntimeStatus(data.details || {}, data.battle_mode);
if (data.details?.statistics_error) this.showError(textValue(data.details.statistics_error));
let fields = data.form || this.options.schema(this.key);
if (this.key === 'login') fields = fields.filter(field => !(field.path?.[0] === 'auto_relogin' && field.path[1] === 'enabled'));
fields=fields.map(field=>field.path?.[0]==='policy'&&field.path[1]==='buy_ten'?{...field,disabled:!this.account.config?.policy?.allow_single_draw}:field);
@@ -276,29 +275,6 @@ export class PageView {
} else this.table.update(data.columns || [], data.rows || []);
}
updateRuntimeStatus(details, battleMode) {
const lines=[];
if(this.key==='hatching'){
if(this.activeSubtab==='喂养策略' && Array.isArray(details.feed_status))lines.push(['feed_status','当前喂养状态:'+textValue(details.feed_status[1])]);
if(this.activeSubtab==='孵蛋策略' && details.last_draw!==undefined)lines.push(['last_draw','最近抽蛋:'+textValue(details.last_draw)]);
}
if(this.key==='gifts' && Object.hasOwn(details,'next_ready_at')){
const ready=details.next_ready_at;
lines.push(['next_ready_at',ready===null?'下次赠礼:当前没有符合条件的目标或物品,等待状态更新':'下次可赠礼:'+chinaTime(ready,{date:true})+'(北京时间)']);
}
// Planner notes are current execution/wait reasons, unlike DTO help text.
const notes = Array.isArray(details.notes) ? [...new Set(details.notes.filter(note => typeof note === 'string' && note.trim()))] : [];
if(notes.length)lines.push(['planner_notes',notes.join('\n')]);
if(details.statistics_error)lines.push(['statistics_error',textValue(details.statistics_error)]);
if(battleMode?.label)lines.push(['battle_mode',battleMode.label]);
const signature=JSON.stringify(lines);
if(signature!==this.runtimeSignature){
this.runtimeStatus.replaceChildren(...lines.map(([key,text])=>el('p',{'data-view-status':key,text})));
this.runtimeSignature=signature;
}
this.runtimeStatus.hidden=!lines.length;
}
showDetail(row) {
const data = this.data.details?.[row.id] || row.details;
if (!data) return;