refactor: add date filters to task logs component and improve validation
testing/ogGui-multibranch/pipeline/head There was a failure building this commit Details

pull/24/head
Lucas Lara García 2025-05-20 13:59:10 +02:00
parent 9d21a6fefc
commit c824953b1e
2 changed files with 25 additions and 1 deletions

View File

@ -47,6 +47,22 @@
<mat-icon>close</mat-icon>
</button>
</mat-form-field>
<mat-form-field appearance="fill" class="search-date">
<mat-label>Desde</mat-label>
<input matInput [matDatepicker]="fromPicker" [(ngModel)]="filters['startDate']" (dateChange)="onDateFilterChange()"
placeholder="Fecha inicio">
<mat-datepicker-toggle matSuffix [for]="fromPicker"></mat-datepicker-toggle>
<mat-datepicker #fromPicker></mat-datepicker>
</mat-form-field>
<mat-form-field appearance="fill" class="search-date">
<mat-label>Hasta</mat-label>
<input matInput [matDatepicker]="toPicker" [(ngModel)]="filters['endDate']" (dateChange)="onDateFilterChange()"
placeholder="Fecha fin">
<mat-datepicker-toggle matSuffix [for]="toPicker"></mat-datepicker-toggle>
<mat-datepicker #toPicker></mat-datepicker>
</mat-form-field>
</div>
<app-loading [isLoading]="loading"></app-loading>

View File

@ -71,7 +71,7 @@ export class ClientTaskLogsComponent implements OnInit {
];
displayedColumns = [...this.columns.map(column => column.columnDef), 'information'];
filters: { [key: string]: string } = {};
filters: { [key: string]: any } = {};
filteredCommands!: Observable<any[]>;
commandControl = new FormControl();
@ -143,6 +143,14 @@ export class ClientTaskLogsComponent implements OnInit {
this.loadTraces();
}
onDateFilterChange(): void {
if (this.filters['startDate'] && this.filters['endDate'] && this.filters['startDate'] > this.filters['endDate']) {
this.toastService.warning('La fecha de inicio no puede ser mayor que la fecha de fin');
return;
}
this.loadTraces();
}
openInputModal(inputData: any): void {
this.dialog.open(InputDialogComponent, {
width: '70vw',