feat(search): refresh global search UI and align qa/docs updates
This commit is contained in:
@@ -6,11 +6,14 @@ class SearchItemMapperProvider
|
||||
{
|
||||
public static function mapPreviewItem(string $key, array $data, string $query): ?array
|
||||
{
|
||||
$subtitle = '';
|
||||
|
||||
if ($key === 'users') {
|
||||
$label = trim(($data['first_name'] ?? '') . ' ' . ($data['last_name'] ?? ''));
|
||||
$email = trim((string) ($data['email'] ?? ''));
|
||||
if ($email !== '') {
|
||||
$label = $label === '' ? $email : ($label . ' — ' . $email);
|
||||
$subtitle = trim((string) ($data['email'] ?? ''));
|
||||
if ($label === '' && $subtitle !== '') {
|
||||
$label = $subtitle;
|
||||
$subtitle = '';
|
||||
}
|
||||
$url = lurl('admin/users/edit/' . ($data['uuid'] ?? '')) . '?search=' . urlencode($query);
|
||||
} elseif ($key === 'permissions') {
|
||||
@@ -22,7 +25,7 @@ class SearchItemMapperProvider
|
||||
$status = trim((string) ($data['last_run_status'] ?? ''));
|
||||
$label = $jobLabel !== '' ? $jobLabel : $jobKey;
|
||||
if ($status !== '') {
|
||||
$label = trim($label . ' — ' . strtoupper($status));
|
||||
$subtitle = strtoupper($status);
|
||||
}
|
||||
$url = lurl('admin/scheduled-jobs/edit/' . ($data['id'] ?? '')) . '?search=' . urlencode($query);
|
||||
} elseif ($key === 'mail-log') {
|
||||
@@ -30,9 +33,14 @@ class SearchItemMapperProvider
|
||||
$subject = trim((string) ($data['subject'] ?? ''));
|
||||
$status = trim((string) ($data['status'] ?? ''));
|
||||
$label = $subject !== '' ? $subject : $toEmail;
|
||||
$subtitleParts = [];
|
||||
if ($status !== '') {
|
||||
$label = trim($label . ' — ' . strtoupper($status));
|
||||
$subtitleParts[] = strtoupper($status);
|
||||
}
|
||||
if ($toEmail !== '' && $subject !== '') {
|
||||
$subtitleParts[] = $toEmail;
|
||||
}
|
||||
$subtitle = implode(' — ', $subtitleParts);
|
||||
$url = lurl('admin/mail-log/view/' . ($data['id'] ?? '')) . '?search=' . urlencode($query);
|
||||
} elseif ($key === 'pages') {
|
||||
$label = (string) ($data['slug'] ?? '');
|
||||
@@ -46,7 +54,12 @@ class SearchItemMapperProvider
|
||||
return null;
|
||||
}
|
||||
|
||||
return ['label' => $label, 'url' => $url];
|
||||
$item = ['label' => $label, 'url' => $url];
|
||||
if ($subtitle !== '') {
|
||||
$item['subtitle'] = $subtitle;
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function mapResultItem(string $key, string $label, array $data): ?array
|
||||
|
||||
Reference in New Issue
Block a user