Fix WAF type column and improve URI display

This commit is contained in:
root
2026-01-30 23:38:13 +02:00
parent 4eed9f2b5c
commit ef601d0a88

View File

@@ -518,7 +518,7 @@ class Waf extends Page implements HasForms, HasTable
TextColumn::make('event_type') TextColumn::make('event_type')
->label(__('Type')) ->label(__('Type'))
->badge() ->badge()
->formatStateUsing(function (array $record): string { ->getStateUsing(function (array $record): string {
if (!empty($record['blocked'])) { if (!empty($record['blocked'])) {
return __('Blocked'); return __('Blocked');
} }
@@ -551,6 +551,32 @@ class Waf extends Page implements HasForms, HasTable
->searchable(), ->searchable(),
TextColumn::make('uri') TextColumn::make('uri')
->label(__('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() ->wrap()
->searchable(), ->searchable(),
TextColumn::make('remote_ip') TextColumn::make('remote_ip')