Polish DHCP inactive time display

This commit is contained in:
seo
2026-07-20 23:37:18 +09:00
parent 34bb82b750
commit 2d79ee3de4
3 changed files with 28 additions and 4 deletions
+20 -2
View File
@@ -1226,7 +1226,7 @@
function wifiRateCells(row) {
if (row?.band === 'LAN') {
return `<td colspan="2">${escapeHtml(wifiCellValue(row, 'tx_bitrate'))}</td>`;
return `<td colspan="2" class="lan-link-speed">${escapeHtml(wifiCellValue(row, 'tx_bitrate'))}</td>`;
}
return `${wifiMetricCell(row, 'tx_bitrate')}${wifiMetricCell(row, 'rx_bitrate')}`;
@@ -1354,6 +1354,24 @@
return formatDhms(parseWifiDurationSeconds(value)) || value;
}
function wifiInactiveTime(value) {
const text = String(value ?? '').trim();
if (text === '' || text.toUpperCase() === 'N/A' || text === '-') {
return '-';
}
const msMatch = text.match(/^(\d+(?:\.\d+)?)\s*ms$/i);
if (msMatch) {
const ms = Number(msMatch[1]);
if (Number.isFinite(ms) && ms <= 1000) {
return `${Math.round(ms)} ms`;
}
return formatDhms(ms / 1000) || text;
}
return formatDhms(parseWifiDurationSeconds(text)) || text;
}
function wifiCellValue(row, key) {
const value = row?.[key];
const text = String(value ?? '').trim();
@@ -1440,7 +1458,7 @@
${wifiMetricCell(row, 'signal')}
${wifiRateCells(row)}
${td(wifiConnectedCellValue(row))}
${td(wifiCellValue(row, 'inactive_time'))}
${td(wifiInactiveTime(row.inactive_time))}
</tr>
`).join('')
: `<tr><td colspan="9">${escapeHtml(t('noWifiClients'))}</td></tr>`;