diff --git a/js/apps/admin-ui/src/groups/GroupTable.tsx b/js/apps/admin-ui/src/groups/GroupTable.tsx index fca12ae5e2..c6e3cc3346 100644 --- a/js/apps/admin-ui/src/groups/GroupTable.tsx +++ b/js/apps/admin-ui/src/groups/GroupTable.tsx @@ -97,7 +97,7 @@ export const GroupTable = ({ {rename && ( { refresh(); viewRefresh(); diff --git a/js/apps/admin-ui/src/groups/GroupsModal.tsx b/js/apps/admin-ui/src/groups/GroupsModal.tsx index 84f188a07d..55bde6f554 100644 --- a/js/apps/admin-ui/src/groups/GroupsModal.tsx +++ b/js/apps/admin-ui/src/groups/GroupsModal.tsx @@ -18,7 +18,7 @@ import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTex type GroupsModalProps = { id?: string; - rename?: string; + rename?: GroupRepresentation; handleModalToggle: () => void; refresh: (group?: GroupRepresentation) => void; }; @@ -36,7 +36,7 @@ export const GroupsModal = ({ handleSubmit, formState: { errors }, } = useForm({ - defaultValues: { name: rename }, + defaultValues: { name: rename?.name }, }); const submitForm = async (group: GroupRepresentation) => { @@ -46,14 +46,17 @@ export const GroupsModal = ({ if (!id) { await adminClient.groups.create(group); } else if (rename) { - await adminClient.groups.update({ id }, group); + await adminClient.groups.update( + { id }, + { ...rename, name: group.name } + ); } else { await (group.id ? adminClient.groups.updateChildGroup({ id }, group) : adminClient.groups.createChildGroup({ id }, group)); } - refresh(rename ? group : undefined); + refresh(rename ? { ...rename, name: group.name } : undefined); handleModalToggle(); addAlert( t(rename ? "groupUpdated" : "groupCreated"), diff --git a/js/apps/admin-ui/src/groups/GroupsSection.tsx b/js/apps/admin-ui/src/groups/GroupsSection.tsx index ab83a6dbc1..2767304ec2 100644 --- a/js/apps/admin-ui/src/groups/GroupsSection.tsx +++ b/js/apps/admin-ui/src/groups/GroupsSection.tsx @@ -46,7 +46,7 @@ export default function GroupsSection() { const { subGroups, setSubGroups, currentGroup } = useSubGroups(); const { realm } = useRealm(); - const [rename, setRename] = useState(); + const [rename, setRename] = useState(); const [deleteOpen, toggleDeleteOpen] = useToggle(); const navigate = useNavigate(); @@ -140,7 +140,7 @@ export default function GroupsSection() { setRename(currentGroup()?.name)} + onClick={() => setRename(currentGroup())} > {t("renameGroup")} , diff --git a/js/apps/admin-ui/src/groups/components/GroupTree.tsx b/js/apps/admin-ui/src/groups/components/GroupTree.tsx index 98391c7bc0..37d6557d76 100644 --- a/js/apps/admin-ui/src/groups/components/GroupTree.tsx +++ b/js/apps/admin-ui/src/groups/components/GroupTree.tsx @@ -56,7 +56,7 @@ const GroupTreeContextMenu = ({ {renameOpen && ( { refresh(); }}