Refresh WAF whitelist table on changes

This commit is contained in:
root
2026-01-31 00:50:49 +02:00
parent c73d332c6f
commit 135e71d563
2 changed files with 9 additions and 2 deletions

View File

@@ -399,7 +399,6 @@ class Waf extends Page implements HasForms, HasTable
]; ];
Setting::set('waf_whitelist_rules', json_encode(array_values($rules), JSON_UNESCAPED_SLASHES)); Setting::set('waf_whitelist_rules', json_encode(array_values($rules), JSON_UNESCAPED_SLASHES));
$this->wafFormData['whitelist_rules'] = $rules;
try { try {
$agent = new AgentClient; $agent = new AgentClient;
@@ -419,6 +418,7 @@ class Waf extends Page implements HasForms, HasTable
$this->loadAuditLogs(false); $this->loadAuditLogs(false);
$this->resetTable(); $this->resetTable();
$this->dispatch('waf-whitelist-updated');
Notification::make() Notification::make()
->title(__('Rule whitelisted')) ->title(__('Rule whitelisted'))
@@ -454,7 +454,6 @@ class Waf extends Page implements HasForms, HasTable
} }
Setting::set('waf_whitelist_rules', json_encode(array_values($rules), JSON_UNESCAPED_SLASHES)); Setting::set('waf_whitelist_rules', json_encode(array_values($rules), JSON_UNESCAPED_SLASHES));
$this->wafFormData['whitelist_rules'] = $rules;
try { try {
$agent = new AgentClient; $agent = new AgentClient;
@@ -474,6 +473,7 @@ class Waf extends Page implements HasForms, HasTable
$this->loadAuditLogs(false); $this->loadAuditLogs(false);
$this->resetTable(); $this->resetTable();
$this->dispatch('waf-whitelist-updated');
Notification::make() Notification::make()
->title(__('Whitelist removed')) ->title(__('Whitelist removed'))

View File

@@ -20,6 +20,7 @@ use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable; use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Livewire\Attributes\On;
use Livewire\Component; use Livewire\Component;
class WafWhitelistTable extends Component implements HasTable, HasSchemas, HasActions class WafWhitelistTable extends Component implements HasTable, HasSchemas, HasActions
@@ -28,6 +29,12 @@ class WafWhitelistTable extends Component implements HasTable, HasSchemas, HasAc
use InteractsWithSchemas; use InteractsWithSchemas;
use InteractsWithActions; use InteractsWithActions;
#[On('waf-whitelist-updated')]
public function refreshWhitelist(): void
{
$this->resetTable();
}
public function makeFilamentTranslatableContentDriver(): ?\Filament\Support\Contracts\TranslatableContentDriver public function makeFilamentTranslatableContentDriver(): ?\Filament\Support\Contracts\TranslatableContentDriver
{ {
return null; return null;