From 1949186e2a0d8ed2c0c5d6a7e8aa09884cc79062 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Tue, 14 Jan 2025 09:19:31 +0100 Subject: [PATCH] refs #1314. Fixed tree groups bugs. --- .../app/components/groups/groups.component.ts | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts index 422d7dd..10ad8ae 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.ts @@ -63,7 +63,7 @@ export class GroupsComponent implements OnInit, OnDestroy { syncingClientId: string | null = null; private originalTreeData: TreeNode[] = []; - displayedColumns: string[] = ['status','sync', 'name', 'oglive', 'subnet', 'pxeTemplate', 'parentName', 'actions']; + displayedColumns: string[] = ['status','sync', 'name', 'oglive', 'subnet', 'pxeTemplate', 'actions']; private _sort!: MatSort; private _paginator!: MatPaginator; @@ -151,13 +151,13 @@ export class GroupsComponent implements OnInit, OnDestroy { (data) => { this.organizationalUnits = data; this.loading = false; - + if (this.organizationalUnits.length > 0) { const treeData = this.organizationalUnits.map((unidad) => this.convertToTreeData(unidad)); this.treeDataSource.data = treeData.flat(); - + this.isTreeViewActive = true; - + const firstNode = this.treeDataSource.data[0]; if (firstNode) { this.selectedNode = firstNode; @@ -176,7 +176,7 @@ export class GroupsComponent implements OnInit, OnDestroy { } ); } - + toggleView(view: 'card' | 'list'): void { this.currentView = view; @@ -239,24 +239,6 @@ export class GroupsComponent implements OnInit, OnDestroy { ); } - private collectAllClients(node: UnidadOrganizativa): Client[] { - let clients = (node.clients || []).map(client => ({ - ...client, - parentName: node.name - })); - - if (node.children) { - node.children.forEach((child) => { - clients = clients.concat(this.collectAllClients(child).map(client => ({ - ...client, - parentName: client.parentName || '' - }))); - }); - } - return clients; - } - - private async loadChildrenAndClients(id: string): Promise { try { const childrenData = await this.dataService.getChildren(id).toPromise();