diff --git a/resources/views/components/application/configuration-sidebar.blade.php b/resources/views/components/application/configuration-sidebar.blade.php index bae8abd555..b77e369d94 100644 --- a/resources/views/components/application/configuration-sidebar.blade.php +++ b/resources/views/components/application/configuration-sidebar.blade.php @@ -182,9 +182,6 @@ // Group that holds the current page โ€” the only one expanded by default. $activeGroup = (string) $groupedMenuItems->search(fn ($items) => $items->contains(fn ($item) => $item['active'] ?? false)); - // All item labels, so the search box can show a "no results" state. - $allLabels = collect($configurationMenuItems)->pluck('label')->values()->all(); - // In-page sections (cards) shown as sub-items under the active page $isComposeApp = $application->build_pack === 'dockercompose'; $pageSections = [ @@ -248,6 +245,34 @@ ['id' => 'move-resource-section', 'label' => 'Move resource'], ], ]; + + // Flat, searchable index: every page plus its in-page sub-sections. Each + // entry carries a breadcrumb (its category, and parent page for a + // sub-section) and combined text so the query matches sub-pages too. + $searchIndex = []; + foreach ($groupedMenuItems as $groupLabel => $groupItems) { + foreach ($groupItems as $item) { + $searchIndex[] = [ + 'label' => $item['label'], + 'breadcrumb' => $groupLabel, + 'searchText' => $item['label'].' '.$groupLabel, + 'href' => route($item['route'], $applicationRouteParameters), + 'icon' => $menuIcons[$item['label']] ?? 'settings', + 'navigate' => $item['navigate'] ?? true, + ]; + foreach ($pageSections[$item['route']] ?? [] as $section) { + $searchIndex[] = [ + 'label' => $section['label'], + 'breadcrumb' => $groupLabel.' ยท '.$item['label'], + 'searchText' => $section['label'].' '.$item['label'].' '.$groupLabel, + 'href' => route($item['route'], $applicationRouteParameters).'#'.$section['id'], + 'icon' => $menuIcons[$item['label']] ?? 'settings', + 'navigate' => true, + ]; + } + } + } + $searchTexts = array_column($searchIndex, 'searchText'); @endphp