Add clear search functionality for tree and client filters
testing/ogGui-multibranch/pipeline/head This commit looks good Details

pull/12/head
Lucas Lara García 2025-01-28 14:26:26 +01:00
parent 22ee53e9db
commit ab5cf647a1
2 changed files with 31 additions and 2 deletions

View File

@ -31,11 +31,29 @@
<div class="filters-container">
<mat-form-field appearance="outline">
<mat-label>{{ 'searchTree' | translate }}</mat-label>
<input matInput (input)="onTreeFilterInput($event)" placeholder="Centro, aula, grupos ..." />
<input matInput #treeSearchInput (input)="onTreeFilterInput($event)" placeholder="Centro, aula, grupos ..." />
<button
*ngIf="treeSearchInput.value"
mat-icon-button
matSuffix
aria-label="Clear tree search"
(click)="clearTreeSearch(treeSearchInput)"
>
<mat-icon>close</mat-icon>
</button>
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>{{ 'searchClient' | translate }}</mat-label>
<input matInput (input)="onClientFilterInput($event)" placeholder="Nombre, IP, estado o MAC">
<input matInput #clientSearchInput (input)="onClientFilterInput($event)" placeholder="Nombre, IP, estado o MAC" />
<button
*ngIf="clientSearchInput.value"
mat-icon-button
matSuffix
aria-label="Clear client search"
(click)="clearClientSearch(clientSearchInput)"
>
<mat-icon>close</mat-icon>
</button>
</mat-form-field>
<!-- Funcionalidad actualmente deshabilitada-->

View File

@ -628,4 +628,15 @@ export class GroupsComponent implements OnInit, OnDestroy {
private extractUuid(idPath: string | undefined): string | null {
return idPath ? idPath.split('/').pop() || null : null;
}
clearTreeSearch(inputElement: HTMLInputElement): void {
inputElement.value = '';
this.filterTree('');
}
clearClientSearch(inputElement: HTMLInputElement): void {
inputElement.value = '';
this.filterClients('');
}
}