refactor: update Proxmox Firewall view to clarify log loading behavior in the UI, enhancing user understanding of recent activity

This commit is contained in:
2025-12-02 16:10:43 -05:00
parent fef69f2dca
commit b6864b2666
2 changed files with 3 additions and 14 deletions

View File

@@ -58,7 +58,7 @@ class Firewall extends Component
$this->loadFirewallOptions();
$this->loadFirewallRules();
$this->loadNetworkAdapters();
$this->loadFirewallLogs(false); // Don't dispatch event on initial load
$this->loadFirewallLogs();
}
protected function loadAvailableIps(): void
@@ -797,7 +797,7 @@ class Firewall extends Component
}
}
public function loadFirewallLogs(bool $dispatchEvent = true): void
public function loadFirewallLogs(): void
{
$this->logError = '';
try {
@@ -937,11 +937,6 @@ 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 only when manually refreshed (not on mount)
if ($dispatchEvent) {
$this->dispatch('logs-refreshed');
}
} catch (\Exception $e) {
$errorMessage = $e->getMessage();
if (method_exists($e, 'response') && $e->response()) {

View File

@@ -298,15 +298,9 @@
</div>
<div>
<h2 class="text-xl font-semibold">Firewall Logs</h2>
<p class="text-sm text-base/60 mt-1">Recent firewall activity and blocked/allowed connections</p>
<p class="text-sm text-base/60 mt-1">Recent firewall activity and blocked/allowed connections (loaded on page load)</p>
</div>
</div>
<button
@click="window.location.reload()"
class="px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors text-sm font-medium">
<x-ri-refresh-line class="size-4 inline mr-1" />
Refresh
</button>
</div>
@if(!empty($logError))