diff --git a/ui/src/components/LayoutShell.tsx b/ui/src/components/LayoutShell.tsx index a503f673..d868ae86 100644 --- a/ui/src/components/LayoutShell.tsx +++ b/ui/src/components/LayoutShell.tsx @@ -533,17 +533,23 @@ function LayoutContent() { const handlePaletteSubmit = useCallback((query: string) => { if (isAdminPage) { - // Navigate to top result — CommandPalette calls onSelect for the top result - // when Enter is pressed, so this is only reached if there are no results. - // Navigate to RBAC page as fallback. - navigate('/admin/rbac'); + // Find first matching admin result and navigate to it + const q = query.toLowerCase(); + const match = adminSearchData.find( + (r) => r.title.toLowerCase().includes(q) || r.meta.toLowerCase().includes(q), + ); + if (match) { + handlePaletteSelect(match); + } else { + navigate('/admin/rbac'); + } } else { const baseParts = ['/exchanges']; if (scope.appId) baseParts.push(scope.appId); if (scope.routeId) baseParts.push(scope.routeId); navigate(`${baseParts.join('/')}?text=${encodeURIComponent(query)}`); } - }, [isAdminPage, navigate, scope.appId, scope.routeId]); + }, [isAdminPage, adminSearchData, handlePaletteSelect, navigate, scope.appId, scope.routeId]); const handleSidebarNavigate = useCallback((path: string) => { const state = { sidebarReveal: path }; @@ -658,6 +664,7 @@ function LayoutContent() { onLogout={handleLogout} /> setPaletteOpen(false)} onOpen={() => setPaletteOpen(true)}