refactor: update command filter to use name instead of id and remove date range handling

pull/23/head
Lucas Lara García 2025-05-14 10:07:19 +02:00
parent 56a8c563ff
commit 639f55edb3
1 changed files with 4 additions and 13 deletions

View File

@ -35,7 +35,6 @@ export class ClientTaskLogsComponent implements OnInit {
mode: ProgressBarMode = 'buffer';
progress = 0;
bufferValue = 0;
dateRange = new FormControl();
filteredCommands2 = Object.keys(COMMAND_TYPES).map(key => ({
name: key,
@ -135,7 +134,9 @@ export class ClientTaskLogsComponent implements OnInit {
}
onOptionCommandSelected(selectedCommand: any): void {
this.filters['command'] = selectedCommand.id;
this.filters['command'] = selectedCommand.name;
console.log('Comando seleccionado:', selectedCommand);
console.log('Valor que se usará para el filtro:', selectedCommand.name);
this.loadTraces();
}
@ -191,22 +192,13 @@ export class ClientTaskLogsComponent implements OnInit {
.set('itemsPerPage', this.itemsPerPage.toString());
if (this.filters['command']) {
params = params.set('command.id', this.filters['command']);
params = params.set('command.name', this.filters['command']);
}
if (this.filters['status']) {
params = params.set('status', this.filters['status']);
}
const range = this.dateRange?.value;
if (range?.start && range?.end) {
const fromDate = this.datePipe.transform(range.start, 'yyyy-MM-dd');
const toDate = this.datePipe.transform(range.end, 'yyyy-MM-dd');
params = params.set('executedAt[after]', fromDate!);
params = params.set('executedAt[before]', toDate!);
}
const url = `${this.baseUrl}/traces`;
this.http.get<any>(url, { params }).subscribe(
@ -240,7 +232,6 @@ export class ClientTaskLogsComponent implements OnInit {
this.loading = true;
clientSearchCommandInput.value = null;
clientSearchStatusInput.value = null;
this.dateRange.reset();
this.filters = {};
this.loadTraces();
}