feat: RBAC page reads cmd-k navigation state for tab switch and highlight

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-02 23:40:03 +02:00
parent 69ca52b25e
commit 146398b183
4 changed files with 66 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
import { useState, useMemo } from 'react';
import { useState, useMemo, useEffect } from 'react';
import {
Avatar,
Badge,
@@ -35,7 +35,7 @@ import styles from './UserManagement.module.css';
const BUILTIN_ADMINS_ID = '00000000-0000-0000-0000-000000000010';
export default function GroupsTab() {
export default function GroupsTab({ highlightId, onHighlightConsumed }: { highlightId?: string | null; onHighlightConsumed?: () => void }) {
const { toast } = useToast();
const { data: groups = [], isLoading: groupsLoading } = useGroups();
const { data: users = [] } = useUsers();
@@ -47,6 +47,17 @@ export default function GroupsTab() {
const [deleteTarget, setDeleteTarget] = useState<GroupDetail | null>(null);
const [removeRoleTarget, setRemoveRoleTarget] = useState<string | null>(null);
// Auto-select highlighted item from cmd-k navigation
useEffect(() => {
if (highlightId && groups) {
const match = groups.find((g) => g.id === highlightId);
if (match) {
setSelectedId(match.id);
onHighlightConsumed?.();
}
}
}, [highlightId, groups]); // eslint-disable-line react-hooks/exhaustive-deps
// Create form state
const [newName, setNewName] = useState('');
const [newParent, setNewParent] = useState('');