refactor: rename log fetching method and enhance event dispatching for firewall logs in Proxmox component
This commit is contained in:
@@ -813,7 +813,7 @@ class Firewall extends Component
|
||||
#[\Livewire\Attributes\On('fetchFirewallLogsAction')]
|
||||
public function handleFetchFirewallLogs(): void
|
||||
{
|
||||
$this->fetchFirewallLogs();
|
||||
$this->loadFirewallLogs();
|
||||
}
|
||||
|
||||
public function loadFirewallLogs(): void
|
||||
@@ -956,6 +956,9 @@ class Firewall extends Component
|
||||
} elseif (empty($this->firewallLogs)) {
|
||||
$this->logError = 'No firewall logs available. Ensure firewall logging is enabled in Proxmox (Datacenter > Firewall > Options).';
|
||||
}
|
||||
|
||||
// Dispatch event to frontend with logs data
|
||||
$this->dispatch('firewall-logs-loaded', logs: $this->firewallLogs, error: '');
|
||||
} catch (\Exception $e) {
|
||||
$errorMessage = $e->getMessage();
|
||||
if (method_exists($e, 'response') && $e->response()) {
|
||||
@@ -976,6 +979,9 @@ class Firewall extends Component
|
||||
'vm_id' => $this->server->vm_id,
|
||||
]);
|
||||
$this->firewallLogs = [];
|
||||
|
||||
// Dispatch error event to frontend
|
||||
$this->dispatch('firewall-logs-loaded', logs: [], error: $this->logError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -394,7 +394,7 @@
|
||||
});
|
||||
},
|
||||
}"
|
||||
@load="initializeLogs()"
|
||||
x-init="initializeLogs()"
|
||||
>
|
||||
<div x-show="loading" x-cloak class="text-center py-8 text-base/60">
|
||||
<div class="animate-spin inline-block">
|
||||
|
||||
Reference in New Issue
Block a user