feat: update bandwidth threshold logic in Proxmox server component to ensure a minimum of 10 GiB and adjust view to reflect new threshold calculation for improved clarity

This commit is contained in:
2025-12-04 08:11:35 -05:00
parent b04dd667a7
commit c437519bde
2 changed files with 9 additions and 6 deletions

View File

@@ -52,7 +52,7 @@ class Server extends Component
$allServers = ServerModel::all();
if ($allServers->isEmpty()) {
return 0;
return 10; // Minimum threshold of 10 GiB
}
$totalTraffic = 0;
@@ -83,14 +83,17 @@ class Server extends Component
}
if ($serverCount === 0) {
return 0;
return 10; // Minimum threshold of 10 GiB
}
// Calculate average bandwidth across all servers
$averageBandwidth = $totalTraffic / $serverCount;
// Return 95% of average
return round($averageBandwidth * 0.95, 2);
// Calculate 95% of average
$threshold95Percent = $averageBandwidth * 0.95;
// Return the maximum of 95% average or 10 GiB minimum
return round(max($threshold95Percent, 10), 2);
});
}

View File

@@ -120,10 +120,10 @@
<span class="text-xs text-base/50">Bandwidth</span>
</div>
<span class="text-base font-medium">
{{ $this->monthlyTraffic }} GiB / {{ $this->bandwidthThreshold95 }} GiB (95%)
{{ $this->monthlyTraffic }} GiB / {{ $this->bandwidthThreshold95 }} GiB
</span>
<span class="text-base text-xs leading-relaxed text-base/60 mt-1">
Connection reduced to 1 MiB/s if usage exceeds the 95% threshold.
Threshold: 95% of average usage or 10 GiB minimum. Connection reduced to 1 MiB/s if exceeded.
</span>
</div>
</div>