diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts index 6560654..b7d54d8 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.ts @@ -352,6 +352,12 @@ export class GroupsComponent implements OnInit, OnDestroy { } private refreshOrganizationalUnits(): void { + const expandedNodeIds = this.treeControl.dataNodes + ? this.treeControl.dataNodes + .filter(node => this.treeControl.isExpanded(node)) + .map(node => this.extractUuid(node['@id'])) + : []; + this.subscriptions.add( this.dataService.getOrganizationalUnits().subscribe( (data) => { @@ -362,6 +368,15 @@ export class GroupsComponent implements OnInit, OnDestroy { const treeData = this.convertToTreeData(updatedData); this.originalTreeData = treeData[0]?.children || []; this.treeDataSource.data = [...this.originalTreeData]; + + setTimeout(() => { + this.treeControl.dataNodes.forEach(node => { + const nodeId = this.extractUuid(node['@id']); + if (nodeId && expandedNodeIds.includes(nodeId)) { + this.treeControl.expand(node); + } + }); + }); }); } }, @@ -369,6 +384,7 @@ export class GroupsComponent implements OnInit, OnDestroy { ) ); } + onEditNode(event: MouseEvent, node: TreeNode | null): void { event.stopPropagation();