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