네트워크 현재 품질 요약 보강
This commit is contained in:
+19
-13
@@ -2571,18 +2571,24 @@
|
||||
return Math.max(0, Math.round(numeric)).toLocaleString();
|
||||
}
|
||||
|
||||
function networkQualitySummary(elementId, totals, direction) {
|
||||
function networkQualitySummary(elementId, totals, direction, rows = []) {
|
||||
const el = $('#' + elementId);
|
||||
if (!el) return;
|
||||
|
||||
const errorKey = direction === 'rx' ? 'rx_errors_total' : 'tx_errors_total';
|
||||
const dropKey = direction === 'rx' ? 'rx_dropped_total' : 'tx_dropped_total';
|
||||
const title = direction === 'rx' ? t('rxErrorsDrops') : t('txErrorsDrops');
|
||||
const row = totals || {};
|
||||
const speedKey = direction === 'rx' ? 'rx_mbytes' : 'tx_mbytes';
|
||||
const packetKey = direction === 'rx' ? 'rx_pps' : 'tx_pps';
|
||||
const qualityTitle = direction === 'rx' ? t('rxErrorsDrops') : t('txErrorsDrops');
|
||||
const currentTitle = direction === 'rx' ? t('downloadRxPackets') : t('uploadTxPackets');
|
||||
const totalRow = totals || {};
|
||||
const currentRow = rows.length ? rows[rows.length - 1] : {};
|
||||
|
||||
el.innerHTML = `
|
||||
<span>${escapeHtml(title)}</span>
|
||||
<span><strong>${escapeHtml(formatCount(row[errorKey]))}</strong> ${escapeHtml(t('errorsLine'))} / <strong>${escapeHtml(formatCount(row[dropKey]))}</strong> ${escapeHtml(t('dropsLine'))}</span>
|
||||
<span>${escapeHtml(currentTitle)}</span>
|
||||
<span><strong>${escapeHtml(formatChartNumber(currentRow[speedKey], ' MB/s'))}</strong> / <strong>${escapeHtml(formatChartNumber(currentRow[packetKey], ' pps'))}</strong></span>
|
||||
<span>${escapeHtml(qualityTitle)}</span>
|
||||
<span><strong>${escapeHtml(formatCount(totalRow[errorKey]))}</strong> ${escapeHtml(t('errorsLine'))} / <strong>${escapeHtml(formatCount(totalRow[dropKey]))}</strong> ${escapeHtml(t('dropsLine'))}</span>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -2778,20 +2784,20 @@
|
||||
const networkQualityTotals = data.network_quality_totals || {};
|
||||
networkChart('netWanRxChart', wanRows, 'rx_mbytes', t('downloadLine'), 'rx_pps', t('rxPacketsLine'), '#0ea5e9');
|
||||
networkChart('netWanTxChart', wanRows, 'tx_mbytes', t('uploadLine'), 'tx_pps', t('txPacketsLine'), '#22c55e');
|
||||
networkQualitySummary('netWanRxQualitySummary', networkQualityTotals[wanIface], 'rx');
|
||||
networkQualitySummary('netWanTxQualitySummary', networkQualityTotals[wanIface], 'tx');
|
||||
networkQualitySummary('netWanRxQualitySummary', networkQualityTotals[wanIface], 'rx', wanRows);
|
||||
networkQualitySummary('netWanTxQualitySummary', networkQualityTotals[wanIface], 'tx', wanRows);
|
||||
networkChart('netLanRxChart', lanRows, 'rx_mbytes', t('downloadLine'), 'rx_pps', t('rxPacketsLine'), '#0ea5e9');
|
||||
networkChart('netLanTxChart', lanRows, 'tx_mbytes', t('uploadLine'), 'tx_pps', t('txPacketsLine'), '#22c55e');
|
||||
networkQualitySummary('netLanRxQualitySummary', networkQualityTotals.eth1, 'rx');
|
||||
networkQualitySummary('netLanTxQualitySummary', networkQualityTotals.eth1, 'tx');
|
||||
networkQualitySummary('netLanRxQualitySummary', networkQualityTotals.eth1, 'rx', lanRows);
|
||||
networkQualitySummary('netLanTxQualitySummary', networkQualityTotals.eth1, 'tx', lanRows);
|
||||
networkChart('netWifi24RxChart', wifi24Rows, 'rx_mbytes', t('downloadLine'), 'rx_pps', t('rxPacketsLine'), '#0ea5e9');
|
||||
networkChart('netWifi24TxChart', wifi24Rows, 'tx_mbytes', t('uploadLine'), 'tx_pps', t('txPacketsLine'), '#22c55e');
|
||||
networkQualitySummary('netWifi24RxQualitySummary', networkQualityTotals.wlan0, 'rx');
|
||||
networkQualitySummary('netWifi24TxQualitySummary', networkQualityTotals.wlan0, 'tx');
|
||||
networkQualitySummary('netWifi24RxQualitySummary', networkQualityTotals.wlan0, 'rx', wifi24Rows);
|
||||
networkQualitySummary('netWifi24TxQualitySummary', networkQualityTotals.wlan0, 'tx', wifi24Rows);
|
||||
networkChart('netWifi5RxChart', wifi5Rows, 'rx_mbytes', t('downloadLine'), 'rx_pps', t('rxPacketsLine'), '#0ea5e9');
|
||||
networkChart('netWifi5TxChart', wifi5Rows, 'tx_mbytes', t('uploadLine'), 'tx_pps', t('txPacketsLine'), '#22c55e');
|
||||
networkQualitySummary('netWifi5RxQualitySummary', networkQualityTotals.wlan1, 'rx');
|
||||
networkQualitySummary('netWifi5TxQualitySummary', networkQualityTotals.wlan1, 'tx');
|
||||
networkQualitySummary('netWifi5RxQualitySummary', networkQualityTotals.wlan1, 'rx', wifi5Rows);
|
||||
networkQualitySummary('netWifi5TxQualitySummary', networkQualityTotals.wlan1, 'tx', wifi5Rows);
|
||||
}
|
||||
|
||||
function resizeChartsSoon() {
|
||||
|
||||
Reference in New Issue
Block a user