refactor: update command filter to use name instead of id and remove date range handling
parent
56a8c563ff
commit
639f55edb3
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue