Hide healthy alert sections consistently with other device cards

This commit is contained in:
way
2026-10-17 23:51:23 +08:00
parent fbd2f2a8c0
commit 58d706d00b
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -29,3 +29,7 @@
## 告警空态统一 ## 告警空态统一
2026-10-17:Frame Flow 沿用 NAS 的常驻折叠“已读取范围内的告警”区域及共享 summaryStatus/scopeAlertHealth;仅完整且当前的快照确认“正常 / 无告警”,采集过期或范围不完整则显示未确认。生产中英文三尺寸共 6 次检查通过。 2026-10-17:Frame Flow 沿用 NAS 的常驻折叠“已读取范围内的告警”区域及共享 summaryStatus/scopeAlertHealth;仅完整且当前的快照确认“正常 / 无告警”,采集过期或范围不完整则显示未确认。生产中英文三尺寸共 6 次检查通过。
## 隐藏正常告警空态
2026-10-17 按用户最终偏好统一树莓派、Ubuntu、NAS 与 Frame Flow:新鲜完整快照没有告警时隐藏告警区域;有告警显示,数据过期或采集范围不完整仍显示未确认提示。Docker 沿用现有容器异常与采集错误显示。仅更新四个插件 UI,无服务重启。旧 UI 备份于 `/srv/pigway/apps/pigway-device-console/backups/hide-empty-alerts-20261017-155017`。中英文三尺寸覆盖 4 插件×3状态共 72 项生产渲染检查通过,无脚本错误和横向溢出。
+1 -1
View File
@@ -46,5 +46,5 @@ export function hostCard(entry) {
}); });
}).join(''); }).join('');
const frames = resources.filter(resource => resource.type === 'device'); const frames = resources.filter(resource => resource.type === 'device');
return `<article class="panel host-panel"><div class="host-head"><div><div class="host-title"><h2>${esc(entry.host.name || 'Frame Flow')}</h2></div><div class="device-details">${frames.map(frame => `<span>${esc(frame.name || text('画框', 'Frame'))}</span>`).join('')}</div></div><span class="badge semantic-status" data-semantic="${current ? 'online' : 'unknown'}">${current ? text('在线', 'Online') : text('状态未确认', 'Unconfirmed')}</span></div>${!current ? `<p class="muted">${text('以下为上次采集数据', 'Showing the last collected data')}</p>` : ''}<div class="host-grid">${cards}</div><details class="group" data-overview-details="alerts"><summary class="smart-summary"><strong class="smart-summary-title">${text('已读取范围内的告警', 'Alerts within monitored scope')}</strong>${summaryStatus(scopeAlertHealth(snapshot.alerts, snapshot.alerts_complete, current), state.LANG)}</summary><div style="margin-top:12px">${alertRows || (current && snapshot.alerts_complete ? text('无告警', 'No alerts') : text('状态未确认', 'Unconfirmed'))}</div></details></article>`; return `<article class="panel host-panel"><div class="host-head"><div><div class="host-title"><h2>${esc(entry.host.name || 'Frame Flow')}</h2></div><div class="device-details">${frames.map(frame => `<span>${esc(frame.name || text('画框', 'Frame'))}</span>`).join('')}</div></div><span class="badge semantic-status" data-semantic="${current ? 'online' : 'unknown'}">${current ? text('在线', 'Online') : text('状态未确认', 'Unconfirmed')}</span></div>${!current ? `<p class="muted">${text('以下为上次采集数据', 'Showing the last collected data')}</p>` : ''}<div class="host-grid">${cards}</div>${(snapshot.alerts || []).length || !current || snapshot.alerts_complete !== true ? `<details class="group" data-overview-details="alerts"><summary class="smart-summary"><strong class="smart-summary-title">${text('已读取范围内的告警', 'Alerts within monitored scope')}</strong>${summaryStatus(scopeAlertHealth(snapshot.alerts, snapshot.alerts_complete, current), state.LANG)}</summary><div style="margin-top:12px">${alertRows || (current && snapshot.alerts_complete ? text('无告警', 'No alerts') : text('状态未确认', 'Unconfirmed'))}</div></details>` : ""}</article>`;
} }