feat: Update Proxmox extension with various improvements and bug fixes

- Change listStates method to accept nullable integer for limit parameter.
- Modify TechnitiumDns class to return structured error messages on failure.
- Enhance VNC and xterm popup routes with user authorization checks.
- Update backups view to improve loading states and add unique keys for dynamic elements.
- Refactor cloud-init view to ensure proper data binding and improve user experience.
- Add wire:key attributes to various elements in views for better Livewire performance.
- Improve error handling and user feedback in the firewall view.
- Update server overview and statistics views to handle potential null values gracefully.
- Add new migration files to extend database schema with user-set icons and notes for Proxmox nodes.
This commit is contained in:
2026-02-23 17:23:01 -05:00
parent 9aff64be93
commit f394483daa
48 changed files with 442 additions and 268 deletions

View File

@@ -79,8 +79,8 @@ class Statistics extends Component
'error' => null,
];
protected array $cachedServerIps = [];
protected array $serverIpCidrs = [];
public array $cachedServerIps = [];
public array $serverIpCidrs = [];
// Historical comparison settings
public string $historicalPeriod = '1_hour_ago'; // Options: 1_hour_ago, 2_hours_ago, 6_hours_ago, 12_hours_ago, 24_hours_ago, custom
@@ -152,14 +152,6 @@ class Statistics extends Component
{
parent::mount($server);
// Retry loading VM status if initial load failed (important for chart rendering)
$retries = 0;
while ($this->status === null && $retries < 3) {
usleep(100000); // 100ms delay between retries
$this->loadVmStatus();
$retries++;
}
$this->server->loadMissing('ipAddresses');
// Network Analysis is loaded lazily via JavaScript to improve page load speed
// Initialize error state if not configured to prevent infinite loading
@@ -864,11 +856,14 @@ class Statistics extends Component
return $connections;
}
protected function fetchGraphData(string $graphType, string $timeRange, string $aggregation): void
protected function fetchGraphData(string $graphType, string $timeRange, string $aggregation, bool $forceRefresh = false): void
{
$cacheKey = 'proxmox-stats-' . $this->server->id . '-' . $graphType . '-' . $timeRange . '-' . $aggregation;
try {
if ($forceRefresh) {
Cache::forget($cacheKey);
}
// Reduced cache TTL from 60 to 30 seconds for fresher data and faster updates
$data = Cache::remember($cacheKey, 30, function () use ($timeRange, $aggregation) {
$proxmox = new Proxmox;
@@ -2101,15 +2096,20 @@ class Statistics extends Component
]);
}
public function formatBytes($bytes)
public function formatBytes(int|float $bytes): string
{
if ($bytes == 0 || $bytes < 0) return '0 B';
if ($bytes == 0) return '0 B';
$prefix = '';
if ($bytes < 0) {
$prefix = '-';
$bytes = abs($bytes);
}
$k = 1024;
$sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
$i = floor(log($bytes) / log($k));
if ($i < 0) $i = 0;
if ($i >= count($sizes)) $i = count($sizes) - 1;
return round($bytes / pow($k, $i), 2) . ' ' . $sizes[$i];
return $prefix . round($bytes / pow($k, $i), 2) . ' ' . $sizes[$i];
}
public function getGraphData(string $type): array