From 3d2934dfe8d2e3724ce416efb09b3a72f7189ae7 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Mon, 1 Dec 2025 08:59:07 -0500 Subject: [PATCH] feat: implement numeric sorting for the "Traffic" column in network connections table to enhance data analysis --- .../Proxmox/views/statistics.blade.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/extensions/Servers/Proxmox/views/statistics.blade.php b/extensions/Servers/Proxmox/views/statistics.blade.php index c22f829c7..2c146fb28 100644 --- a/extensions/Servers/Proxmox/views/statistics.blade.php +++ b/extensions/Servers/Proxmox/views/statistics.blade.php @@ -3919,6 +3919,43 @@ console.warn('Table not found:', tableId); return; } + + // Fast path: simple numeric sort for Network Analysis "Traffic" column + if (tableId === 'network-connections-table' && column === 'traffic') { + var tbody = table.tBodies && table.tBodies[0] ? table.tBodies[0] : table.querySelector('tbody'); + if (!tbody) { + console.warn('No tbody found for network-connections-table'); + return; + } + + // Toggle sort direction + if (component.sortColumn === column) { + component.sortDirection = component.sortDirection === 'asc' ? 'desc' : 'asc'; + } else { + component.sortColumn = column; + component.sortDirection = 'desc'; // default to highest traffic first + } + + var rows = Array.from(tbody.querySelectorAll('tr.table-row')).filter(function (row) { + return row.style.display !== 'none'; + }); + + rows.sort(function (a, b) { + var aBytes = parseFloat(a.getAttribute('data-traffic') || '0') || 0; + var bBytes = parseFloat(b.getAttribute('data-traffic') || '0') || 0; + + if (component.sortDirection === 'asc') { + return aBytes - bBytes; + } + return bBytes - aBytes; + }); + + rows.forEach(function (row) { + tbody.appendChild(row); + }); + + return; + } if (component.sortColumn === column) { component.sortDirection = component.sortDirection === 'asc' ? 'desc' : 'asc';