Fix WAF URI truncation

This commit is contained in:
root
2026-01-31 00:13:46 +02:00
parent dbf3544d22
commit 1b7b0a46d2

View File

@@ -374,6 +374,18 @@ class Waf extends Page implements HasForms, HasTable
return ($ipLong & $mask) === ($subnetLong & $mask);
}
protected function formatUriForDisplay(array $record): string
{
$host = (string) ($record['host'] ?? '');
$uri = (string) ($record['uri'] ?? '');
if ($host !== '' && $uri !== '') {
return $host.$uri;
}
return $uri !== '' ? $uri : $host;
}
public function whitelistEntry(array $record): void
{
$rules = $this->getWhitelistRules();
@@ -552,33 +564,15 @@ 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)
->getStateUsing(fn (array $record): string => $this->formatUriForDisplay($record))
->formatStateUsing(fn (string $state): string => Str::limit($state, 52, ''))
->tooltip(fn (array $record): string => $this->formatUriForDisplay($record))
->copyable()
->copyableState(function (array $record): string {
$host = (string) ($record['host'] ?? '');
$uri = (string) ($record['uri'] ?? '');
if ($host !== '' && $uri !== '') {
return $host.$uri;
}
return $uri !== '' ? $uri : $host;
})
->extraAttributes(['class' => 'max-w-[240px] truncate'])
->copyableState(fn (array $record): string => $this->formatUriForDisplay($record))
->extraAttributes([
'class' => 'inline-block max-w-[240px] truncate',
'style' => 'max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;',
])
->wrap(false)
->searchable(),
TextColumn::make('remote_ip')