Keep alert scope visible consistently with NAS

This commit is contained in:
way
2026-10-17 23:45:14 +08:00
parent 242b0d223f
commit fbd2f2a8c0
3 changed files with 9 additions and 3 deletions
+2 -1
View File
@@ -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 `<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>${alertRows ? `<div><h3>${text('当前告警', 'Current alerts')}</h3>${alertRows}</div>` : ''}</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><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>`;
}