feat(ui): improve global search with uuid and pr support (#7901)
This commit is contained in:
parent
4c3253fdf8
commit
bedaed3ae6
1 changed files with 26 additions and 12 deletions
|
|
@ -257,7 +257,7 @@ private function loadSearchableItems()
|
|||
|
||||
// Get all applications
|
||||
$applications = Application::ownedByCurrentTeam()
|
||||
->with(['environment.project'])
|
||||
->with(['environment.project', 'previews:id,application_id,pull_request_id'])
|
||||
->get()
|
||||
->map(function ($app) {
|
||||
// Collect all FQDNs from the application
|
||||
|
|
@ -286,6 +286,16 @@ private function loadSearchableItems()
|
|||
|
||||
$fqdnsString = $fqdns->implode(' ');
|
||||
|
||||
// Add PR search terms if preview is enabled
|
||||
$prSearchTerms = '';
|
||||
if ($app->preview_enabled ?? false) {
|
||||
$prIds = collect($app->previews ?? [])
|
||||
->pluck('pull_request_id')
|
||||
->map(fn ($id) => "pr-{$id} pr{$id} {$id}")
|
||||
->implode(' ');
|
||||
$prSearchTerms = $prIds;
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $app->id,
|
||||
'name' => $app->name,
|
||||
|
|
@ -296,13 +306,13 @@ private function loadSearchableItems()
|
|||
'project' => $app->environment->project->name ?? null,
|
||||
'environment' => $app->environment->name ?? null,
|
||||
'fqdns' => $fqdns->take(2)->implode(', '), // Show first 2 FQDNs in UI
|
||||
'search_text' => strtolower($app->name.' '.$app->description.' '.$fqdnsString.' application applications app apps'),
|
||||
'search_text' => strtolower($app->name.' '.$app->description.' '.$fqdnsString.' '.$app->uuid.' '.$prSearchTerms.' application applications app apps'),
|
||||
];
|
||||
});
|
||||
|
||||
// Get all services
|
||||
$services = Service::ownedByCurrentTeam()
|
||||
->with(['environment.project', 'applications'])
|
||||
->with(['environment.project', 'applications', 'databases'])
|
||||
->get()
|
||||
->map(function ($service) {
|
||||
// Collect all FQDNs from service applications
|
||||
|
|
@ -315,6 +325,10 @@ private function loadSearchableItems()
|
|||
}
|
||||
$fqdnsString = $fqdns->implode(' ');
|
||||
|
||||
// Collect service component names for container search
|
||||
$serviceAppNames = collect($service->applications ?? [])->pluck('name')->implode(' ');
|
||||
$serviceDbNames = collect($service->databases ?? [])->pluck('name')->implode(' ');
|
||||
|
||||
return [
|
||||
'id' => $service->id,
|
||||
'name' => $service->name,
|
||||
|
|
@ -325,7 +339,7 @@ private function loadSearchableItems()
|
|||
'project' => $service->environment->project->name ?? null,
|
||||
'environment' => $service->environment->name ?? null,
|
||||
'fqdns' => $fqdns->take(2)->implode(', '), // Show first 2 FQDNs in UI
|
||||
'search_text' => strtolower($service->name.' '.$service->description.' '.$fqdnsString.' service services'),
|
||||
'search_text' => strtolower($service->name.' '.$service->description.' '.$fqdnsString.' '.$service->uuid.' '.$serviceAppNames.' '.$serviceDbNames.' service services'),
|
||||
];
|
||||
});
|
||||
|
||||
|
|
@ -348,7 +362,7 @@ private function loadSearchableItems()
|
|||
'link' => $db->link(),
|
||||
'project' => $db->environment->project->name ?? null,
|
||||
'environment' => $db->environment->name ?? null,
|
||||
'search_text' => strtolower($db->name.' postgresql '.$db->description.' database databases db'),
|
||||
'search_text' => strtolower($db->name.' '.$db->uuid.' postgresql '.$db->description.' database databases db'),
|
||||
];
|
||||
})
|
||||
);
|
||||
|
|
@ -369,7 +383,7 @@ private function loadSearchableItems()
|
|||
'link' => $db->link(),
|
||||
'project' => $db->environment->project->name ?? null,
|
||||
'environment' => $db->environment->name ?? null,
|
||||
'search_text' => strtolower($db->name.' mysql '.$db->description.' database databases db'),
|
||||
'search_text' => strtolower($db->name.' '.$db->uuid.' mysql '.$db->description.' database databases db'),
|
||||
];
|
||||
})
|
||||
);
|
||||
|
|
@ -390,7 +404,7 @@ private function loadSearchableItems()
|
|||
'link' => $db->link(),
|
||||
'project' => $db->environment->project->name ?? null,
|
||||
'environment' => $db->environment->name ?? null,
|
||||
'search_text' => strtolower($db->name.' mariadb '.$db->description.' database databases db'),
|
||||
'search_text' => strtolower($db->name.' '.$db->uuid.' mariadb '.$db->description.' database databases db'),
|
||||
];
|
||||
})
|
||||
);
|
||||
|
|
@ -411,7 +425,7 @@ private function loadSearchableItems()
|
|||
'link' => $db->link(),
|
||||
'project' => $db->environment->project->name ?? null,
|
||||
'environment' => $db->environment->name ?? null,
|
||||
'search_text' => strtolower($db->name.' mongodb '.$db->description.' database databases db'),
|
||||
'search_text' => strtolower($db->name.' '.$db->uuid.' mongodb '.$db->description.' database databases db'),
|
||||
];
|
||||
})
|
||||
);
|
||||
|
|
@ -432,7 +446,7 @@ private function loadSearchableItems()
|
|||
'link' => $db->link(),
|
||||
'project' => $db->environment->project->name ?? null,
|
||||
'environment' => $db->environment->name ?? null,
|
||||
'search_text' => strtolower($db->name.' redis '.$db->description.' database databases db'),
|
||||
'search_text' => strtolower($db->name.' '.$db->uuid.' redis '.$db->description.' database databases db'),
|
||||
];
|
||||
})
|
||||
);
|
||||
|
|
@ -453,7 +467,7 @@ private function loadSearchableItems()
|
|||
'link' => $db->link(),
|
||||
'project' => $db->environment->project->name ?? null,
|
||||
'environment' => $db->environment->name ?? null,
|
||||
'search_text' => strtolower($db->name.' keydb '.$db->description.' database databases db'),
|
||||
'search_text' => strtolower($db->name.' '.$db->uuid.' keydb '.$db->description.' database databases db'),
|
||||
];
|
||||
})
|
||||
);
|
||||
|
|
@ -474,7 +488,7 @@ private function loadSearchableItems()
|
|||
'link' => $db->link(),
|
||||
'project' => $db->environment->project->name ?? null,
|
||||
'environment' => $db->environment->name ?? null,
|
||||
'search_text' => strtolower($db->name.' dragonfly '.$db->description.' database databases db'),
|
||||
'search_text' => strtolower($db->name.' '.$db->uuid.' dragonfly '.$db->description.' database databases db'),
|
||||
];
|
||||
})
|
||||
);
|
||||
|
|
@ -495,7 +509,7 @@ private function loadSearchableItems()
|
|||
'link' => $db->link(),
|
||||
'project' => $db->environment->project->name ?? null,
|
||||
'environment' => $db->environment->name ?? null,
|
||||
'search_text' => strtolower($db->name.' clickhouse '.$db->description.' database databases db'),
|
||||
'search_text' => strtolower($db->name.' '.$db->uuid.' clickhouse '.$db->description.' database databases db'),
|
||||
];
|
||||
})
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue