From c063e0f50fd7425f84601b430ae30dc504058a08 Mon Sep 17 00:00:00 2001 From: Lucas Lara Date: Thu, 23 Jan 2025 14:27:44 +0100 Subject: [PATCH] refs #1375 Remove TreeViewComponent and associated files from groups component. --- ogWebconsole/src/app/app.module.ts | 2 - .../components/groups/groups.component.html | 4 -- .../app/components/groups/groups.component.ts | 8 --- .../shared/tree-view/tree-view.component.css | 40 ----------- .../shared/tree-view/tree-view.component.html | 54 -------------- .../shared/tree-view/tree-view.component.ts | 70 ------------------- 6 files changed, 178 deletions(-) delete mode 100644 ogWebconsole/src/app/components/groups/shared/tree-view/tree-view.component.css delete mode 100644 ogWebconsole/src/app/components/groups/shared/tree-view/tree-view.component.html delete mode 100644 ogWebconsole/src/app/components/groups/shared/tree-view/tree-view.component.ts diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts index 633da32..da98482 100644 --- a/ogWebconsole/src/app/app.module.ts +++ b/ogWebconsole/src/app/app.module.ts @@ -52,7 +52,6 @@ import { DragDropModule } from '@angular/cdk/drag-drop'; import { ToastrModule } from 'ngx-toastr'; import { ShowOrganizationalUnitComponent } from './components/groups/shared/organizational-units/show-organizational-unit/show-organizational-unit.component'; import { MatGridList, MatGridTile } from "@angular/material/grid-list"; -import { TreeViewComponent } from './components/groups/shared/tree-view/tree-view.component'; import { MatNestedTreeNode, MatTree, @@ -152,7 +151,6 @@ export function HttpLoaderFactory(http: HttpClient) { ClassroomViewComponent, ClientViewComponent, ShowOrganizationalUnitComponent, - TreeViewComponent, LegendComponent, ClassroomViewDialogComponent, SaveFiltersDialogComponent, diff --git a/ogWebconsole/src/app/components/groups/groups.component.html b/ogWebconsole/src/app/components/groups/groups.component.html index 4bcee04..d1634f8 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.html +++ b/ogWebconsole/src/app/components/groups/groups.component.html @@ -132,10 +132,6 @@ edit {{ 'edit' | translate }} - -
- - apartment - meeting_room - school - computer - lan - help_outline - - {{ node.name }} -
- - -
- - - - computer - {{ client.name }} - {{ client.ip }} | {{ client.mac }} - - -
- - - - - - - diff --git a/ogWebconsole/src/app/components/groups/shared/tree-view/tree-view.component.ts b/ogWebconsole/src/app/components/groups/shared/tree-view/tree-view.component.ts deleted file mode 100644 index 4f6d76e..0000000 --- a/ogWebconsole/src/app/components/groups/shared/tree-view/tree-view.component.ts +++ /dev/null @@ -1,70 +0,0 @@ -import {Component, Inject, OnInit} from '@angular/core'; -import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; -import {NestedTreeControl} from "@angular/cdk/tree"; -import {MatTreeNestedDataSource} from "@angular/material/tree"; - -interface OrganizationalUnit { - id: number; - name: string; - type: string; - clients?: Client[]; - children?: OrganizationalUnit[]; -} - -interface Client { - id: number; - name: string; - ip: string; - mac: string; - serialNumber: string; -} - -@Component({ - selector: 'app-tree-view', - templateUrl: './tree-view.component.html', - styleUrl: './tree-view.component.css' -}) -export class TreeViewComponent implements OnInit { - treeControl = new NestedTreeControl(node => node.children); - dataSource = new MatTreeNestedDataSource(); - - constructor( - private dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: any - ) { - } - ngOnInit() { - this.dataSource.data = [this.mapData(this.data.data)]; - } - - hasChild = (_: number, node: OrganizationalUnit) => (!!node.children && node.children.length > 0 || !!node.clients && node.clients.length > 0); - - private mapData(data: any): OrganizationalUnit { - const mapClients = (clients: any[]): Client[] => { - console.log(clients) - return clients.map(client => ({ - id: client.id, - name: client.name, - ip: client.ip, - mac: client.mac, - serialNumber: client.serialNumber, - })); - }; - - const mapChildren = (children: any[]): OrganizationalUnit[] => { - return children.map(child => this.mapData(child)); - }; - - return { - id: data.id, - name: data.name, - type: data.type, - clients: data.clients ? mapClients(data.clients) : [], - children: data.children ? mapChildren(data.children) : [] - }; - } - - close(): void { - this.dialogRef.close(); - } -}