Compare commits

...

2 Commits

Author SHA1 Message Date
root
ef601d0a88 Fix WAF type column and improve URI display 2026-01-30 23:38:13 +02:00
root
4eed9f2b5c Render WAF whitelist rules as a table 2026-01-30 23:37:33 +02:00

View File

@@ -9,6 +9,7 @@ use App\Services\Agent\AgentClient;
use BackedEnum;
use Exception;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Repeater\TableColumn as RepeaterTableColumn;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
@@ -127,6 +128,13 @@ class Waf extends Page implements HasForms, HasTable
->schema([
Repeater::make('whitelist_rules')
->label(__('Whitelist Entries'))
->table([
RepeaterTableColumn::make(__('Name'))->width('18%'),
RepeaterTableColumn::make(__('Match Type'))->width('16%'),
RepeaterTableColumn::make(__('Match Value'))->width('28%'),
RepeaterTableColumn::make(__('Rule IDs'))->width('26%'),
RepeaterTableColumn::make(__('Enabled'))->width('12%')->alignCenter(),
])
->schema([
TextInput::make('label')
->label(__('Name'))
@@ -510,7 +518,7 @@ class Waf extends Page implements HasForms, HasTable
TextColumn::make('event_type')
->label(__('Type'))
->badge()
->formatStateUsing(function (array $record): string {
->getStateUsing(function (array $record): string {
if (!empty($record['blocked'])) {
return __('Blocked');
}
@@ -543,6 +551,32 @@ class Waf extends Page implements HasForms, HasTable
->searchable(),
TextColumn::make('uri')
->label(__('URI'))
->getStateUsing(function (array $record): string {
$host = (string) ($record['host'] ?? '');
$uri = (string) ($record['uri'] ?? '');
if ($host !== '' && $uri !== '') {
return $host.$uri;
}
return $uri !== '' ? $uri : $host;
})
->tooltip(function (array $record): string {
$host = (string) ($record['host'] ?? '');
$uri = (string) ($record['uri'] ?? '');
if ($host !== '' && $uri !== '') {
return $host.$uri;
}
return $uri !== '' ? $uri : $host;
})
->limit(60)
->copyable()
->copyableState(function (array $record): string {
$host = (string) ($record['host'] ?? '');
$uri = (string) ($record['uri'] ?? '');
if ($host !== '' && $uri !== '') {
return $host.$uri;
}
return $uri !== '' ? $uri : $host;
})
->wrap()
->searchable(),
TextColumn::make('remote_ip')