feat(ui): show host status, simplex and absent protocols
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uc9V1v7iXruubpoLiSE24M
This commit is contained in:
@@ -456,7 +456,7 @@
|
||||
</tr></thead><tbody>`;
|
||||
for (const c of data.connections) {
|
||||
const st = escHtml(c.state || '—');
|
||||
const stCls = c.state === 'up' ? 'status-up' : (c.state ? 'status-down' : '');
|
||||
const stCls = c.state === 'up' ? 'status-up' : (c.state === 'absent' ? '' : (c.state ? 'status-down' : ''));
|
||||
const rtt = (c.state === 'up' && c.rtt) ? Math.round(c.rtt) + ' ms' : '—';
|
||||
const chg = c.statetime ? new Date(c.statetime * 1000).toLocaleString() : '—';
|
||||
const seen = c.lastbeat ? new Date(c.lastbeat * 1000).toLocaleString() : '—';
|
||||
@@ -1143,6 +1143,24 @@
|
||||
function renderNetworkTables(d) {
|
||||
let html = '';
|
||||
|
||||
if (d.connectivity) {
|
||||
let t = '<table class="data-table"><thead><tr><th>Protocol</th><th>Internet</th>'
|
||||
+ '<th>Address</th><th>Gateway</th><th class="num">RTT</th></tr></thead><tbody>';
|
||||
for (const fam of ['ipv4', 'ipv6']) {
|
||||
const c = d.connectivity[fam];
|
||||
if (!c) continue;
|
||||
const known = c.present === true || c.present === false;
|
||||
const cls = c.present === true ? 'status-up' : '';
|
||||
const txt = c.present === true ? '✓ present' : (c.present === false ? 'absent' : '?');
|
||||
t += `<tr><td>${fam === 'ipv4' ? 'IPv4' : 'IPv6'}</td>
|
||||
<td class="${cls}">${txt}</td>
|
||||
<td>${escHtml(c.addr || '—')}</td><td>${escHtml(c.gateway || '—')}</td>
|
||||
<td class="num">${known && c.rtt != null ? Math.round(c.rtt) + ' ms' : '—'}</td></tr>`;
|
||||
}
|
||||
t += '</tbody></table>';
|
||||
html += `<div class="table-section-label">Connectivity</div>${t}`;
|
||||
}
|
||||
|
||||
if (d.interfaces && Object.keys(d.interfaces).length) {
|
||||
const sample = Object.values(d.interfaces)[0];
|
||||
const hasDelta = 'bytes_sent_delta' in sample;
|
||||
|
||||
Reference in New Issue
Block a user