From fbd2f2a8c033f353c65593662327c91c319dc722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A1=E5=8F=A3=E6=B5=AA=E4=BA=BA?= Date: Sat, 17 Oct 2026 23:45:14 +0800 Subject: [PATCH] Keep alert scope visible consistently with NAS --- DEPLOYMENT.md | 4 ++++ plugin/ui/index.js | 3 ++- tests/ui.cjs | 5 +++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index b36d8bc..70e6193 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -25,3 +25,7 @@ 2026-10-17(Asia/Shanghai):删除中间资源分组框,指标直接平铺;相框名称使用 Console 现有 `host-title` / `device-details` 结构显示在 Frame Flow 下方,与 Docker 的 Server 副标题一致。轮播任务合并为“轮播任务 / 启用”,最近运行成功时右上角显示蓝色“正常”,失败和未确认保留对应状态。 生产旧插件备份:`/srv/pigway/apps/pigway-device-console/backups/frame-flat-20261017-153104`;仅重启 Console 容器以加载插件版本。中英文与三尺寸生产浏览器检查共 6 次通过,确认无嵌套指标卡、任务状态颜色使用 Console 的 `--status-normal`、无横向溢出及脚本错误。四台设备在线。 + +## 告警空态统一 + +2026-10-17:Frame Flow 沿用 NAS 的常驻折叠“已读取范围内的告警”区域及共享 summaryStatus/scopeAlertHealth;仅完整且当前的快照确认“正常 / 无告警”,采集过期或范围不完整则显示未确认。生产中英文三尺寸共 6 次检查通过。 diff --git a/plugin/ui/index.js b/plugin/ui/index.js index 1b97bb4..915df83 100644 --- a/plugin/ui/index.js +++ b/plugin/ui/index.js @@ -1,3 +1,4 @@ +import { scopeAlertHealth, summaryStatus } from '/assets/js/overview-health.js'; import { state } from '/assets/js/state.js'; import { esc, pluginText as text } from '/assets/js/shared.js'; @@ -45,5 +46,5 @@ export function hostCard(entry) { }); }).join(''); const frames = resources.filter(resource => resource.type === 'device'); - return `

${esc(entry.host.name || 'Frame Flow')}

${frames.map(frame => `${esc(frame.name || text('画框', 'Frame'))}`).join('')}
${current ? text('在线', 'Online') : text('状态未确认', 'Unconfirmed')}
${!current ? `

${text('以下为上次采集数据', 'Showing the last collected data')}

` : ''}
${cards}
${alertRows ? `

${text('当前告警', 'Current alerts')}

${alertRows}
` : ''}
`; + return `

${esc(entry.host.name || 'Frame Flow')}

${frames.map(frame => `${esc(frame.name || text('画框', 'Frame'))}`).join('')}
${current ? text('在线', 'Online') : text('状态未确认', 'Unconfirmed')}
${!current ? `

${text('以下为上次采集数据', 'Showing the last collected data')}

` : ''}
${cards}
${text('已读取范围内的告警', 'Alerts within monitored scope')}${summaryStatus(scopeAlertHealth(snapshot.alerts, snapshot.alerts_complete, current), state.LANG)}
${alertRows || (current && snapshot.alerts_complete ? text('无告警', 'No alerts') : text('状态未确认', 'Unconfirmed'))}
`; } diff --git a/tests/ui.cjs b/tests/ui.cjs index b5dfac9..4f52aa6 100644 --- a/tests/ui.cjs +++ b/tests/ui.cjs @@ -9,9 +9,10 @@ const entry={host:{name:'Frame Flow'},dataCurrent:true,snapshot:{resources:[{id: entry.snapshot.resources.push({id:'job:slideshow',name:'家庭照片轮播',type:'job'}); entry.snapshot.metrics.push({resource_id:'job:slideshow',key:'job_enabled',value:1,unit:'boolean'},{resource_id:'job:slideshow',key:'last_run_success',value:1,unit:'boolean'}); for(const lang of ['zh','en'])for(const width of [1440,820,390]) { -const page=await browser.newPage({viewport:{width,height:1000}}); +const page=await browser.newPage({bypassCSP:true,viewport:{width,height:1000}}); await page.goto('http://192.168.89.19/'); -const result=await page.evaluate(({source,entry,lang})=>{ +const result=await page.evaluate(async ({source,entry,lang})=>{ + const {scopeAlertHealth,summaryStatus}=await import('/assets/js/overview-health.js'); const state={LANG:lang};const text=(zh,en)=>lang==='zh'?zh:en; const esc=v=>String(v??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); const html=eval(source+'\nhostCard(entry)');