fix: cmd-k context key for tab reset and Enter-to-navigate on admin pages
Some checks failed
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m10s
CI / docker (push) Successful in 1m27s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 51s
SonarQube / sonarqube (push) Failing after 2m22s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-02 23:53:09 +02:00
parent 146398b183
commit 44a37317d1

View File

@@ -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}
/>
<CommandPalette
key={isAdminPage ? 'admin' : 'ops'}
open={paletteOpen}
onClose={() => setPaletteOpen(false)}
onOpen={() => setPaletteOpen(true)}