Add connection error handling and improve modal component structure
This commit is contained in:
@@ -276,6 +276,10 @@ class Component extends BaseComponent
|
||||
]);
|
||||
$this->status = null;
|
||||
}
|
||||
} catch (\Illuminate\Http\Client\ConnectionException $e) {
|
||||
// Timeout or connection error - don't log as error, just set status to null
|
||||
\Log::info('Connection timeout loading VM status for server ' . $this->server->id);
|
||||
$this->status = null;
|
||||
} catch (\Throwable $e) {
|
||||
\Log::error('Exception loading VM status for server ' . $this->server->id, [
|
||||
'server_id' => $this->server->id,
|
||||
|
||||
@@ -79,7 +79,7 @@ class Proxmox extends ClassServer
|
||||
'Content-Type' => 'application/json',
|
||||
])->withOptions([
|
||||
'verify' => $this->config('verify_ssl') ? true : false,
|
||||
])->$method($url, $data)->throw();
|
||||
])->timeout(15)->connectTimeout(5)->$method($url, $data)->throw();
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -6,47 +6,46 @@
|
||||
'width' => 'max-w-3xl'
|
||||
])
|
||||
<div x-data="{ open: {{ $open ? 'true' : 'false' }} }">
|
||||
<template x-teleport="body">
|
||||
{{-- Backdrop with separate fade animation --}}
|
||||
<div class="fixed inset-0 z-30 flex items-center justify-center overflow-auto"
|
||||
x-show="open" x-cloak>
|
||||
|
||||
{{-- Backdrop overlay --}}
|
||||
<div class="absolute inset-0 bg-black/60 backdrop-blur-sm"
|
||||
x-show="open"
|
||||
x-transition:enter="transition ease-out duration-300"
|
||||
x-transition:enter-start="opacity-0"
|
||||
x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="transition ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0"
|
||||
@click="{{ $closable ? 'open = false' : '' }}"></div>
|
||||
|
||||
{{-- Modal content with scale animation --}}
|
||||
<div class="relative px-6 py-4 w-full mx-2 md:mx-auto text-left bg-background-secondary rounded-xl shadow-2xl border border-neutral/50 {{ $width }}"
|
||||
x-show="open"
|
||||
x-transition:enter="transition ease-out duration-300 delay-75"
|
||||
x-transition:enter-start="opacity-0 scale-95 translate-y-4"
|
||||
x-transition:enter-end="opacity-100 scale-100 translate-y-0"
|
||||
x-transition:leave="transition ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100 scale-100 translate-y-0"
|
||||
x-transition:leave-end="opacity-0 scale-95 translate-y-4"
|
||||
@click.stop>
|
||||
<div class="flex justify-between items-center">
|
||||
<h2 class="text-2xl font-semibold text-color-base">{{ $title }}</h2>
|
||||
@if ($closable && !$closeTrigger)
|
||||
<button @click="open = false" class="text-color-muted hover:text-color-base hover:bg-neutral/20 p-2 rounded-lg transition-all duration-200">
|
||||
<x-ri-close-fill class="size-5" />
|
||||
</button>
|
||||
@elseif ($closable && $closeTrigger)
|
||||
{{ $closeTrigger }}
|
||||
@endif
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
{{-- Modal container with backdrop --}}
|
||||
<div class="fixed inset-0 z-30 flex items-center justify-center overflow-auto"
|
||||
x-show="open" x-cloak
|
||||
x-transition:enter="transition ease-out duration-200"
|
||||
x-transition:enter-start="opacity-0"
|
||||
x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="transition ease-in duration-150"
|
||||
x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0">
|
||||
|
||||
{{-- Backdrop overlay --}}
|
||||
<div class="absolute inset-0 bg-black/50 backdrop-blur-sm"
|
||||
@click="{{ $closable ? 'open = false' : '' }}"></div>
|
||||
|
||||
{{-- Modal content --}}
|
||||
<div class="relative px-6 py-4 w-full mx-2 md:mx-auto text-left bg-background-secondary rounded-xl shadow-2xl border border-neutral/50 {{ $width }}"
|
||||
x-show="open"
|
||||
x-transition:enter="transition ease-out duration-200"
|
||||
x-transition:enter-start="opacity-0 scale-95"
|
||||
x-transition:enter-end="opacity-100 scale-100"
|
||||
x-transition:leave="transition ease-in duration-150"
|
||||
x-transition:leave-start="opacity-100 scale-100"
|
||||
x-transition:leave-end="opacity-0 scale-95"
|
||||
@click.stop>
|
||||
<div class="flex justify-between items-center">
|
||||
<h2 class="text-2xl font-semibold text-color-base">{{ $title }}</h2>
|
||||
@if ($closable && !$closeTrigger)
|
||||
<button @click="open = false" class="text-color-muted hover:text-color-base hover:bg-neutral/20 p-2 rounded-lg transition-all duration-200">
|
||||
<x-ri-close-fill class="size-5" />
|
||||
</button>
|
||||
@elseif ($closable && $closeTrigger)
|
||||
{{ $closeTrigger }}
|
||||
@endif
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user