refactor: update Proxmox Firewall component to use a page reload for refreshing logs, simplifying the log management process and enhancing user experience
This commit is contained in:
@@ -302,8 +302,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
wire:click="loadFirewallLogs"
|
||||
wire:loading.attr="disabled"
|
||||
@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
|
||||
@@ -323,23 +322,12 @@
|
||||
|
||||
@if(count($firewallLogs) > 0)
|
||||
<div
|
||||
wire:ignore
|
||||
x-data="{
|
||||
logs: [],
|
||||
logs: @js($firewallLogs),
|
||||
searchTerm: '',
|
||||
sortField: 'timestamp_iso',
|
||||
sortDirection: 'desc',
|
||||
init() {
|
||||
// Use window storage to persist logs across Livewire updates
|
||||
if (!window.firewallLogsCache) {
|
||||
window.firewallLogsCache = @js($firewallLogs);
|
||||
}
|
||||
this.logs = window.firewallLogsCache;
|
||||
},
|
||||
refreshLogs() {
|
||||
// Update cache when refresh button is clicked
|
||||
window.firewallLogsCache = @js($firewallLogs);
|
||||
this.logs = window.firewallLogsCache;
|
||||
},
|
||||
sort(field) {
|
||||
if (this.sortField === field) {
|
||||
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
||||
@@ -384,7 +372,6 @@
|
||||
});
|
||||
},
|
||||
}"
|
||||
@logs-refreshed.window="refreshLogs()"
|
||||
class="space-y-4"
|
||||
>
|
||||
<div class="flex flex-col md:flex-row md:items-center md:justify-between gap-3">
|
||||
|
||||
Reference in New Issue
Block a user