From ab2309c958d38c959f55b37d4a48f03217d6f394 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 27 Jan 2025 16:50:45 +0100 Subject: [PATCH] refs #1354. Added multiple commands logic. Updated endpoints --- .../app/components/groups/groups.component.ts | 39 +++---------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts index 7ac10c8..775caca 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.ts @@ -151,7 +151,6 @@ export class GroupsComponent implements OnInit, OnDestroy { this.cols = width <= 600 ? 1 : width <= 960 ? 2 : width <= 1280 ? 3 : 4; }; -<<<<<<< Updated upstream clearSelection(): void { this.selectedUnidad = null; this.selectedDetail = null; @@ -172,7 +171,6 @@ export class GroupsComponent implements OnInit, OnDestroy { // ) // ); // } -======= getFilters(): void { this.subscriptions.add( this.dataService.getFilters().subscribe( @@ -185,23 +183,6 @@ export class GroupsComponent implements OnInit, OnDestroy { ) ); } ->>>>>>> Stashed changes - - // Función para cargar un filtro seleccionado actu - // loadSelectedFilter(savedFilter: [string, string]): void { - // this.subscriptions.add( - // this.dataService.getFilter(savedFilter[1]).subscribe( - // (response) => { - // if (response) { - // console.log('Filter:', response.filters); - // } - // }, - // (error) => { - // console.error('Error:', error); - // } - // ) - // ); - // } search(): void { this.loading = true; @@ -238,14 +219,9 @@ export class GroupsComponent implements OnInit, OnDestroy { this.dataService.getOrganizationalUnits().subscribe({ next: (data) => { -<<<<<<< Updated upstream this.originalTreeData = data.map((unidad) => this.convertToTreeData(unidad)); this.treeDataSource.data = [...this.originalTreeData]; - -======= - this.treeDataSource.data = data.map((unidad) => this.convertToTreeData(unidad)); ->>>>>>> Stashed changes if (selectedNodeIdOrUuid) { this.selectedNode = this.findNodeByIdOrUuid(this.treeDataSource.data, selectedNodeIdOrUuid); @@ -276,13 +252,8 @@ export class GroupsComponent implements OnInit, OnDestroy { }, }); } -<<<<<<< Updated upstream - - public expandPathToNode(node: TreeNode): void { -======= private expandPathToNode(node: TreeNode): void { ->>>>>>> Stashed changes const path: TreeNode[] = []; let currentNode: TreeNode | null = node; @@ -574,13 +545,13 @@ export class GroupsComponent implements OnInit, OnDestroy { filterTree(searchTerm: string): void { const expandPaths: TreeNode[][] = []; - + const filterNodes = (nodes: TreeNode[], parentPath: TreeNode[] = []): TreeNode[] => { return nodes .map((node) => { const matchesName = node.name.toLowerCase().includes(searchTerm.toLowerCase()); const filteredChildren = node.children ? filterNodes(node.children, [...parentPath, node]) : []; - + if (matchesName) { expandPaths.push([...parentPath, node]); return { @@ -595,9 +566,9 @@ export class GroupsComponent implements OnInit, OnDestroy { } return null; }) - .filter((node): node is TreeNode => node !== null); + .filter((node): node is TreeNode => node !== null); }; - + if (!searchTerm) { this.treeDataSource.data = [...this.originalTreeData]; this.treeControl.collapseAll(); @@ -606,7 +577,7 @@ export class GroupsComponent implements OnInit, OnDestroy { expandPaths.forEach((path) => this.expandPath(path)); } } - + private expandPath(path: TreeNode[]): void { path.forEach((pathNode) => { const flatNode = this.treeControl.dataNodes?.find((n) => n.id === pathNode.id);