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 -2
View File
@@ -415,7 +415,7 @@ async function exportYields(account=current()) {
async function command(name,account=current()) {
try {
if(name==='add-account'||name==='add-demo')return await addAccount(name==='add-demo');
if(name==='about')return dialog('关于牧场助手',el('div',{},el('p',{text:`牧羊人之心牧场助手 Web ${state.meta?.version || '2.0.8'}`}),el('p',{text:`游戏数据版本 ${state.meta?.gameVersion || '1.9.68'}`})),{info:true});
if(name==='about')return dialog('关于牧场助手',el('div',{},el('p',{text:`牧羊人之心牧场助手 Web ${state.meta?.version || '2.0.9'}`}),el('p',{text:`游戏数据版本 ${state.meta?.gameVersion || '1.9.68'}`})),{info:true});
if(name==='updates')return await showUpdates();
if(name==='admin-logout'){hideWorkbench();try{await api.logout();}finally{requireAuth();}return;}
if(!account)throw new Error('请先新增或选择账号。');
@@ -640,7 +640,7 @@ async function bootstrap() {
$('#app').hidden=false;
const [meta,schema]=await Promise.all([api.meta(),api.schema()]);state.meta=meta;state.schema=schema;
if(state.redirecting)return;
$('#app-version').textContent=meta.version || '2.0.8';$('#game-version').textContent=meta.gameVersion || '1.9.68';$('#access-mode').textContent=auth.access_mode==='local'||auth.access_mode==='loopback'?'本机工作台':auth.required?'管理工作台':'本机工作台';
$('#app-version').textContent=meta.version || '2.0.9';$('#game-version').textContent=meta.gameVersion || '1.9.68';$('#access-mode').textContent=auth.access_mode==='local'||auth.access_mode==='loopback'?'本机工作台':auth.required?'管理工作台':'本机工作台';
await syncAccounts();if(state.redirecting)return;state.ready=true;setStatus('工作台已连接');
}catch(failure){if(failure.status===401||$('#app').hidden){requireAuth();return;}if(state.redirecting)return;setStatus(failure.message);$('#page-host').replaceChildren(el('div',{class:'initial-state'},el('p',{text:failure.message}),el('button',{text:'重新连接',onClick:bootstrap})));}
}
+1 -1
View File
@@ -26,7 +26,7 @@
</div></details>
<details class="menu"><summary accesskey="h">帮助<span class="access-key">(H)</span></summary><div class="menu-popup"><button data-command="updates">检查版本更新…</button><button data-command="debug">调试日志</button><button data-command="about">关于…</button></div></details>
</nav>
<span class="window-title">牧羊人之心牧场助手 <span id="app-version">2.0.8</span></span>
<span class="window-title">牧羊人之心牧场助手 <span id="app-version">2.0.9</span></span>
<span id="access-mode" class="muted"></span>
</header>
<div class="account-bar"><div id="account-tabs" class="account-tabs" role="tablist" aria-label="账号"></div><button id="add-account" class="compact" title="新增账号">+ 新增账号</button></div>
+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;