Fix NIC port count handling and apply pending exporter updates
This commit is contained in:
@@ -994,9 +994,16 @@ function renderConfig(data) {
|
||||
// Network tab
|
||||
html += '<div class="config-tab-content" id="config-network">';
|
||||
const networkRows = networkAdapters;
|
||||
const normalizeNetworkPortCount = (value) => {
|
||||
const num = Number(value);
|
||||
if (!Number.isFinite(num) || num <= 0 || num > 256) {
|
||||
return null;
|
||||
}
|
||||
return Math.trunc(num);
|
||||
};
|
||||
if (networkRows.length > 0) {
|
||||
const nicCount = networkRows.length;
|
||||
const totalPorts = networkRows.reduce((sum, n) => sum + (n.port_count || 0), 0);
|
||||
const totalPorts = networkRows.reduce((sum, n) => sum + (normalizeNetworkPortCount(n.port_count) || 0), 0);
|
||||
const nicTypes = [...new Set(networkRows.map(n => n.port_type).filter(t => t))];
|
||||
const nicModels = [...new Set(networkRows.map(n => n.model).filter(m => m))];
|
||||
html += `<h3>Сетевые адаптеры</h3>
|
||||
@@ -1010,11 +1017,12 @@ function renderConfig(data) {
|
||||
networkRows.forEach(nic => {
|
||||
const macs = nic.mac_addresses ? nic.mac_addresses.join(', ') : '-';
|
||||
const statusClass = nic.status === 'OK' ? '' : 'status-warning';
|
||||
const displayPortCount = normalizeNetworkPortCount(nic.port_count);
|
||||
html += `<tr>
|
||||
<td>${escapeHtml(nic.location || nic.slot || '-')}</td>
|
||||
<td>${escapeHtml(nic.model || '-')}</td>
|
||||
<td>${escapeHtml(nic.manufacturer || nic.vendor || '-')}</td>
|
||||
<td>${nic.port_count || '-'}</td>
|
||||
<td>${displayPortCount ?? '-'}</td>
|
||||
<td>${escapeHtml(nic.port_type || '-')}</td>
|
||||
<td><code>${escapeHtml(macs)}</code></td>
|
||||
<td class="${statusClass}">${escapeHtml(nic.status || '-')}</td>
|
||||
|
||||
Reference in New Issue
Block a user