refs #2049 enhance date filtering in task logs with max date constraint and validation
testing/ogGui-multibranch/pipeline/head There was a failure building this commit
Details
testing/ogGui-multibranch/pipeline/head There was a failure building this commit
Details
parent
c824953b1e
commit
b55f15f16b
|
@ -50,8 +50,8 @@
|
||||||
|
|
||||||
<mat-form-field appearance="fill" class="search-date">
|
<mat-form-field appearance="fill" class="search-date">
|
||||||
<mat-label>Desde</mat-label>
|
<mat-label>Desde</mat-label>
|
||||||
<input matInput [matDatepicker]="fromPicker" [(ngModel)]="filters['startDate']" (dateChange)="onDateFilterChange()"
|
<input matInput [matDatepicker]="fromPicker" [(ngModel)]="filters['startDate']"
|
||||||
placeholder="Fecha inicio">
|
(dateChange)="onDateFilterChange()" [max]="today">
|
||||||
<mat-datepicker-toggle matSuffix [for]="fromPicker"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="fromPicker"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #fromPicker></mat-datepicker>
|
<mat-datepicker #fromPicker></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -59,10 +59,11 @@
|
||||||
<mat-form-field appearance="fill" class="search-date">
|
<mat-form-field appearance="fill" class="search-date">
|
||||||
<mat-label>Hasta</mat-label>
|
<mat-label>Hasta</mat-label>
|
||||||
<input matInput [matDatepicker]="toPicker" [(ngModel)]="filters['endDate']" (dateChange)="onDateFilterChange()"
|
<input matInput [matDatepicker]="toPicker" [(ngModel)]="filters['endDate']" (dateChange)="onDateFilterChange()"
|
||||||
placeholder="Fecha fin">
|
[max]="today">
|
||||||
<mat-datepicker-toggle matSuffix [for]="toPicker"></mat-datepicker-toggle>
|
<mat-datepicker-toggle matSuffix [for]="toPicker"></mat-datepicker-toggle>
|
||||||
<mat-datepicker #toPicker></mat-datepicker>
|
<mat-datepicker #toPicker></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<app-loading [isLoading]="loading"></app-loading>
|
<app-loading [isLoading]="loading"></app-loading>
|
||||||
|
|
|
@ -35,6 +35,7 @@ export class ClientTaskLogsComponent implements OnInit {
|
||||||
mode: ProgressBarMode = 'buffer';
|
mode: ProgressBarMode = 'buffer';
|
||||||
progress = 0;
|
progress = 0;
|
||||||
bufferValue = 0;
|
bufferValue = 0;
|
||||||
|
today = new Date();
|
||||||
|
|
||||||
filteredCommands2 = Object.keys(COMMAND_TYPES).map(key => ({
|
filteredCommands2 = Object.keys(COMMAND_TYPES).map(key => ({
|
||||||
name: key,
|
name: key,
|
||||||
|
@ -144,12 +145,15 @@ export class ClientTaskLogsComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
onDateFilterChange(): void {
|
onDateFilterChange(): void {
|
||||||
if (this.filters['startDate'] && this.filters['endDate'] && this.filters['startDate'] > this.filters['endDate']) {
|
const start = this.filters['startDate'];
|
||||||
this.toastService.warning('La fecha de inicio no puede ser mayor que la fecha de fin');
|
const end = this.filters['endDate'];
|
||||||
return;
|
|
||||||
|
if (start && end && start > end) {
|
||||||
|
this.toastService.warning('La fecha de inicio no puede ser mayor que la fecha de fin');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.loadTraces();
|
||||||
}
|
}
|
||||||
this.loadTraces();
|
|
||||||
}
|
|
||||||
|
|
||||||
openInputModal(inputData: any): void {
|
openInputModal(inputData: any): void {
|
||||||
this.dialog.open(InputDialogComponent, {
|
this.dialog.open(InputDialogComponent, {
|
||||||
|
@ -196,9 +200,17 @@ export class ClientTaskLogsComponent implements OnInit {
|
||||||
'client.id': clientId,
|
'client.id': clientId,
|
||||||
page: this.page + 1,
|
page: this.page + 1,
|
||||||
itemsPerPage: this.itemsPerPage,
|
itemsPerPage: this.itemsPerPage,
|
||||||
...this.filters
|
...this.filters
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (params['startDate']) {
|
||||||
|
params['executed_at[after]'] = this.datePipe.transform(params['startDate'], 'yyyy-MM-dd');
|
||||||
|
delete params['startDate'];
|
||||||
|
}
|
||||||
|
if (params['endDate']) {
|
||||||
|
params['executed_at[before]'] = this.datePipe.transform(params['endDate'], 'yyyy-MM-dd');
|
||||||
|
delete params['endDate'];
|
||||||
|
}
|
||||||
console.log('🌐 GET', `${this.baseUrl}/traces`, params);
|
console.log('🌐 GET', `${this.baseUrl}/traces`, params);
|
||||||
|
|
||||||
const url = `${this.baseUrl}/traces`;
|
const url = `${this.baseUrl}/traces`;
|
||||||
|
|
Loading…
Reference in New Issue