refs #1283 Fix mat-tree close on object refresh
testing/ogGui-multibranch/pipeline/head This commit looks good Details

pull/10/head
Alvaro Puente Mella 2024-12-17 14:04:19 +01:00
parent f15920a016
commit 4c45e51493
1 changed files with 16 additions and 0 deletions

View File

@ -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();