From 4d529a2e5214993262d0160e216ae4b44f6d68e0 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 31 Jan 2026 02:50:18 +0200 Subject: [PATCH] Fix WAF whitelist table + stabilize notifications --- app/Livewire/Admin/WafWhitelistTable.php | 26 ++++++------------- app/Providers/AppServiceProvider.php | 7 +++++ .../partials/notifications-refresh.blade.php | 17 ++++++++++++ 3 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 resources/views/filament/partials/notifications-refresh.blade.php diff --git a/app/Livewire/Admin/WafWhitelistTable.php b/app/Livewire/Admin/WafWhitelistTable.php index 75019c9..8107241 100644 --- a/app/Livewire/Admin/WafWhitelistTable.php +++ b/app/Livewire/Admin/WafWhitelistTable.php @@ -8,14 +8,14 @@ use App\Models\Setting; use App\Services\Agent\AgentClient; use Exception; use Filament\Actions\Action; -use Filament\Forms\Components\Select; -use Filament\Forms\Components\TextInput; -use Filament\Notifications\Notification; -use Filament\Tables\Columns\TextColumn; use Filament\Actions\Concerns\InteractsWithActions; use Filament\Actions\Contracts\HasActions; -use Filament\Schemas\Concerns\InteractsWithSchemas; -use Filament\Schemas\Contracts\HasSchemas; +use Filament\Forms\Components\Select; +use Filament\Forms\Components\TextInput; +use Filament\Forms\Concerns\InteractsWithForms; +use Filament\Forms\Contracts\HasForms; +use Filament\Notifications\Notification; +use Filament\Tables\Columns\TextColumn; use Filament\Tables\Concerns\InteractsWithTable; use Filament\Tables\Contracts\HasTable; use Filament\Tables\Table; @@ -23,28 +23,18 @@ use Illuminate\Support\Arr; use Livewire\Attributes\On; use Livewire\Component; -class WafWhitelistTable extends Component implements HasTable, HasSchemas, HasActions +class WafWhitelistTable extends Component implements HasTable, HasForms, HasActions { use InteractsWithTable; - use InteractsWithSchemas { cacheSchema as protected filamentCacheSchema; } + use InteractsWithForms; use InteractsWithActions; - protected function cacheSchema(string $name, \Filament\Schemas\Schema|\Closure|null $schema = null): ?\Filament\Schemas\Schema - { - return $this->filamentCacheSchema($name, $schema); - } - #[On('waf-whitelist-updated')] public function refreshWhitelist(): void { $this->resetTable(); } - public function makeFilamentTranslatableContentDriver(): ?\Filament\Support\Contracts\TranslatableContentDriver - { - return null; - } - public function render() { return view('livewire.admin.waf-whitelist-table'); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 099234e..64b9b48 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -4,6 +4,8 @@ namespace App\Providers; use App\Models\Domain; use App\Observers\DomainObserver; +use Filament\Support\Facades\FilamentView; +use Filament\View\PanelsRenderHook; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -25,5 +27,10 @@ class AppServiceProvider extends ServiceProvider // Note: AuthEventListener is auto-discovered by Laravel 11+ // Do not manually subscribe - it causes duplicate audit log entries + + FilamentView::registerRenderHook( + PanelsRenderHook::SCRIPTS_AFTER, + fn (): string => view('filament.partials.notifications-refresh')->render(), + ); } } diff --git a/resources/views/filament/partials/notifications-refresh.blade.php b/resources/views/filament/partials/notifications-refresh.blade.php new file mode 100644 index 0000000..8fcd516 --- /dev/null +++ b/resources/views/filament/partials/notifications-refresh.blade.php @@ -0,0 +1,17 @@ +