Refactor modal close behavior and improve styling
- Changed modal close event from `@click.away` to `@click.self` for better control over closing modals. - Updated various modal button styles for consistency and improved accessibility. - Adjusted transition durations for modal animations to enhance user experience. - Added aria-labels to close buttons for better screen reader support.
This commit is contained in:
@@ -65,8 +65,7 @@ class Server extends Component
|
||||
return 10; // Minimum threshold of 10 GiB
|
||||
}
|
||||
|
||||
$totalTraffic = 0;
|
||||
$serverCount = 0;
|
||||
$trafficValues = [];
|
||||
|
||||
foreach ($allServers as $server) {
|
||||
// Get the earliest and latest statistics for this month for each server
|
||||
@@ -86,23 +85,21 @@ class Server extends Component
|
||||
$netoutDiff = max(0, $latestStat->netout - $firstStat->netout);
|
||||
$totalBytes = $netinDiff + $netoutDiff;
|
||||
|
||||
// Convert to GiB and add to total
|
||||
$totalTraffic += $totalBytes / (1024 * 1024 * 1024);
|
||||
$serverCount++;
|
||||
// Convert to GiB and collect
|
||||
$trafficValues[] = $totalBytes / (1024 * 1024 * 1024);
|
||||
}
|
||||
}
|
||||
|
||||
if ($serverCount === 0) {
|
||||
if (empty($trafficValues)) {
|
||||
return 10; // Minimum threshold of 10 GiB
|
||||
}
|
||||
|
||||
// Calculate average bandwidth across all servers
|
||||
$averageBandwidth = $totalTraffic / $serverCount;
|
||||
// Calculate actual 95th percentile by sorting and taking the value at the 95th rank
|
||||
sort($trafficValues);
|
||||
$index = (int) ceil(0.95 * count($trafficValues)) - 1;
|
||||
$threshold95Percent = $trafficValues[$index];
|
||||
|
||||
// Calculate 95% of average
|
||||
$threshold95Percent = $averageBandwidth * 0.95;
|
||||
|
||||
// Return the maximum of 95% average or 10 GiB minimum
|
||||
// Return the maximum of 95th percentile or 10 GiB minimum
|
||||
return round(max($threshold95Percent, 10), 2);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user