feat(search): refresh global search UI and align qa/docs updates
This commit is contained in:
@@ -14,14 +14,14 @@ final class AuditSearchResourceProvider implements SearchResourceProvider
|
||||
return [
|
||||
'api-audit' => [
|
||||
'label' => t('API audit'),
|
||||
'permission' => 'api_audit.view',
|
||||
'permission' => 'audit.api.view',
|
||||
'count_sql' => "select count(*) from api_audit_log where (request_id like ? escape '\\\\' or path like ? escape '\\\\' or error_code like ? escape '\\\\' or ip like ? escape '\\\\')",
|
||||
'preview_sql' => "select id, request_id, method, path, status_code, created_at from api_audit_log where (request_id like ? escape '\\\\' or path like ? escape '\\\\' or error_code like ? escape '\\\\' or ip like ? escape '\\\\') order by created_at desc limit ?",
|
||||
'result_sql' => "select id, request_id, method, path, status_code, created_at from api_audit_log where (request_id like ? escape '\\\\' or path like ? escape '\\\\' or error_code like ? escape '\\\\' or ip like ? escape '\\\\') order by created_at desc",
|
||||
],
|
||||
'system-audit' => [
|
||||
'label' => t('System audit'),
|
||||
'permission' => 'system_audit.view',
|
||||
'permission' => 'audit.system.view',
|
||||
'count_sql' => "select count(*) from system_audit_log where (request_id like ? escape '\\\\' or event_type like ? escape '\\\\' or error_code like ? escape '\\\\' or path like ? escape '\\\\')",
|
||||
'preview_sql' => "select id, request_id, event_type, outcome, created_at from system_audit_log where (request_id like ? escape '\\\\' or event_type like ? escape '\\\\' or error_code like ? escape '\\\\' or path like ? escape '\\\\') order by created_at desc limit ?",
|
||||
'result_sql' => "select id, request_id, event_type, outcome, created_at from system_audit_log where (request_id like ? escape '\\\\' or event_type like ? escape '\\\\' or error_code like ? escape '\\\\' or path like ? escape '\\\\') order by created_at desc",
|
||||
@@ -60,21 +60,27 @@ final class AuditSearchResourceProvider implements SearchResourceProvider
|
||||
$method = strtoupper(trim((string) ($row['method'] ?? '')));
|
||||
$path = trim((string) ($row['path'] ?? ''));
|
||||
$statusCode = (int) ($row['status_code'] ?? 0);
|
||||
$requestId = trim((string) ($row['request_id'] ?? ''));
|
||||
$createdAt = trim((string) ($row['created_at'] ?? ''));
|
||||
|
||||
$title = trim($method . ' ' . $path);
|
||||
if ($title === '') {
|
||||
$title = $requestId;
|
||||
$title = trim((string) ($row['request_id'] ?? ''));
|
||||
}
|
||||
if ($title === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$subtitle = trim(($statusCode > 0 ? (string) $statusCode : '') . ($requestId !== '' ? ' — ' . $requestId : ''));
|
||||
$subtitleParts = [];
|
||||
if ($statusCode > 0) {
|
||||
$subtitleParts[] = (string) $statusCode;
|
||||
}
|
||||
if ($createdAt !== '') {
|
||||
$subtitleParts[] = $createdAt;
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => $title,
|
||||
'subtitle' => $subtitle,
|
||||
'subtitle' => implode(' — ', $subtitleParts),
|
||||
'url' => lurl('admin/api-audit/view/' . ($row['id'] ?? '')),
|
||||
'icon' => 'bi-shield-check',
|
||||
];
|
||||
@@ -88,18 +94,24 @@ final class AuditSearchResourceProvider implements SearchResourceProvider
|
||||
{
|
||||
$eventType = trim((string) ($row['event_type'] ?? ''));
|
||||
$outcome = strtolower(trim((string) ($row['outcome'] ?? '')));
|
||||
$requestId = trim((string) ($row['request_id'] ?? ''));
|
||||
$createdAt = trim((string) ($row['created_at'] ?? ''));
|
||||
|
||||
$title = $eventType !== '' ? $eventType : $requestId;
|
||||
$title = $eventType !== '' ? $eventType : trim((string) ($row['request_id'] ?? ''));
|
||||
if ($title === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$subtitle = trim(($outcome !== '' ? strtoupper($outcome) : '') . ($requestId !== '' ? ' — ' . $requestId : ''));
|
||||
$subtitleParts = [];
|
||||
if ($outcome !== '') {
|
||||
$subtitleParts[] = strtoupper($outcome);
|
||||
}
|
||||
if ($createdAt !== '') {
|
||||
$subtitleParts[] = $createdAt;
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => $title,
|
||||
'subtitle' => $subtitle,
|
||||
'subtitle' => implode(' — ', $subtitleParts),
|
||||
'url' => lurl('admin/system-audit/view/' . ($row['id'] ?? '')),
|
||||
'icon' => 'bi-journal-lock',
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user