From e5f179d539fdc152ae5b4be79448ed61f11b21a7 Mon Sep 17 00:00:00 2001 From: "Joseph.Rawlings" Date: Mon, 1 Dec 2025 09:02:11 -0500 Subject: [PATCH] refactor: streamline numeric sorting for network connections by utilizing raw byte values from the backend --- .../Proxmox/views/statistics.blade.php | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/extensions/Servers/Proxmox/views/statistics.blade.php b/extensions/Servers/Proxmox/views/statistics.blade.php index 2c146fb28..9083c394b 100644 --- a/extensions/Servers/Proxmox/views/statistics.blade.php +++ b/extensions/Servers/Proxmox/views/statistics.blade.php @@ -2138,23 +2138,8 @@ @foreach($networkAnalysis['connections'] as $index => $connection) @php - // Calculate bytes for sorting (extract numeric value) - $bytesForSort = 0; - if (isset($connection['bytes_human'])) { - $bytesHuman = $connection['bytes_human']; - // Extract number and unit, convert to bytes - if (preg_match('/([\d.]+)\s*(Bytes|KiB|MiB|GiB|TiB)/i', $bytesHuman, $matches)) { - $value = (float)$matches[1]; - $unit = strtoupper($matches[2]); - $bytesForSort = match($unit) { - 'KIB' => $value * 1024, - 'MIB' => $value * 1024 * 1024, - 'GIB' => $value * 1024 * 1024 * 1024, - 'TIB' => $value * 1024 * 1024 * 1024 * 1024, - default => $value - }; - } - } + // Use raw bytes value from backend for reliable numeric sorting + $bytesForSort = (int)($connection['bytes'] ?? 0); @endphp