Refactor resetFilters method to accept input parameters for command and status filters
testing/ogGui-multibranch/pipeline/head There was a failure building this commit Details

pull/22/head
Lucas Lara García 2025-05-08 14:11:45 +02:00
parent 60684d2c50
commit 28336603ad
4 changed files with 26 additions and 23 deletions

View File

@ -10,7 +10,7 @@
</div> </div>
<div class="images-button-row"> <div class="images-button-row">
<button class="action-button" (click)="resetFilters()" joyrideStep="resetFiltersStep" <button class="action-button" (click)="resetFilters(commandSearchInput, commandStatusInput)" joyrideStep="resetFiltersStep"
text="{{ 'resetFiltersStepText' | translate }}"> text="{{ 'resetFiltersStepText' | translate }}">
{{ 'resetFilters' | translate }} {{ 'resetFilters' | translate }}
</button> </button>

View File

@ -218,8 +218,10 @@ export class ClientTaskLogsComponent implements OnInit {
); );
} }
resetFilters() { resetFilters(clientSearchCommandInput: any, clientSearchStatusInput: any) {
this.loading = true; this.loading = true;
clientSearchCommandInput.value = null;
clientSearchStatusInput.value = null;
this.filters = {}; this.filters = {};
this.loadTraces(); this.loadTraces();
} }

View File

@ -9,8 +9,8 @@
</div> </div>
<div class="images-button-row"> <div class="images-button-row">
<button class="action-button" (click)="resetFilters()" joyrideStep="resetFiltersStep" <button class="action-button" (click)="resetFilters(commandSearchInput, commandStatusInput)"
text="{{ 'resetFiltersStepText' | translate }}"> joyrideStep="resetFiltersStep" text="{{ 'resetFiltersStepText' | translate }}">
{{ 'resetFilters' | translate }} {{ 'resetFilters' | translate }}
</button> </button>
</div> </div>
@ -34,7 +34,7 @@
</mat-autocomplete> </mat-autocomplete>
<button *ngIf="commandClientInput.value" mat-icon-button matSuffix aria-label="Clear input search" <button *ngIf="commandClientInput.value" mat-icon-button matSuffix aria-label="Clear input search"
(click)="clearClientFilter($event, commandClientInput)"> (click)="clearClientFilter($event, commandClientInput)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
<mat-hint>Por favor, ingrese el nombre del cliente</mat-hint> <mat-hint>Por favor, ingrese el nombre del cliente</mat-hint>
@ -48,7 +48,7 @@
</mat-option> </mat-option>
</mat-select> </mat-select>
<button *ngIf="commandSearchInput.value" mat-icon-button matSuffix aria-label="Clear input search" <button *ngIf="commandSearchInput.value" mat-icon-button matSuffix aria-label="Clear input search"
(click)="clearCommandFilter($event, commandSearchInput)"> (click)="clearCommandFilter($event, commandSearchInput)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</mat-form-field> </mat-form-field>
@ -56,7 +56,8 @@
<mat-form-field appearance="fill" class="search-boolean"> <mat-form-field appearance="fill" class="search-boolean">
<mat-label i18n="@@searchLabel">Estado</mat-label> <mat-label i18n="@@searchLabel">Estado</mat-label>
<mat-select (selectionChange)="onOptionStatusSelected($event.value)" placeholder="Seleccionar opción" #commandStatusInput> <mat-select (selectionChange)="onOptionStatusSelected($event.value)" placeholder="Seleccionar opción"
#commandStatusInput>
<mat-option [value]="'failed'">Fallido</mat-option> <mat-option [value]="'failed'">Fallido</mat-option>
<mat-option [value]="'pending'">Pendiente de ejecutar</mat-option> <mat-option [value]="'pending'">Pendiente de ejecutar</mat-option>
<mat-option [value]="'in-progress'">Ejecutando</mat-option> <mat-option [value]="'in-progress'">Ejecutando</mat-option>
@ -64,7 +65,7 @@
<mat-option [value]="'cancelled'">Cancelado</mat-option> <mat-option [value]="'cancelled'">Cancelado</mat-option>
</mat-select> </mat-select>
<button *ngIf="commandStatusInput.value" mat-icon-button matSuffix aria-label="Clear input search" <button *ngIf="commandStatusInput.value" mat-icon-button matSuffix aria-label="Clear input search"
(click)="clearStatusFilter($event, commandStatusInput)"> (click)="clearStatusFilter($event, commandStatusInput)">
<mat-icon>close</mat-icon> <mat-icon>close</mat-icon>
</button> </button>
</mat-form-field> </mat-form-field>
@ -83,7 +84,8 @@
<ng-container *ngSwitchCase="'status'"> <ng-container *ngSwitchCase="'status'">
<ng-container *ngIf="trace.status === 'in-progress' && trace.progress; else statusChip"> <ng-container *ngIf="trace.status === 'in-progress' && trace.progress; else statusChip">
<div class="progress-container"> <div class="progress-container">
<mat-progress-bar class="example-margin" [mode]="mode" [value]="trace.progress" [bufferValue]="bufferValue"> <mat-progress-bar class="example-margin" [mode]="mode" [value]="trace.progress"
[bufferValue]="bufferValue">
</mat-progress-bar> </mat-progress-bar>
<span>{{trace.progress}}%</span> <span>{{trace.progress}}%</span>
</div> </div>
@ -98,19 +100,16 @@
'chip-cancelled': trace.status === 'cancelled' 'chip-cancelled': trace.status === 'cancelled'
}"> }">
{{ {{
trace.status === 'failed' ? 'Error' : trace.status === 'failed' ? 'Error' :
trace.status === 'in-progress' ? 'En ejecución' : trace.status === 'in-progress' ? 'En ejecución' :
trace.status === 'success' ? 'Completado' : trace.status === 'success' ? 'Completado' :
trace.status === 'pending' ? 'Pendiente' : trace.status === 'pending' ? 'Pendiente' :
trace.status === 'cancelled' ? 'Cancelado' : trace.status === 'cancelled' ? 'Cancelado' :
trace.status trace.status
}} }}
</mat-chip> </mat-chip>
<button *ngIf="trace.status === 'in-progress' && trace.command === 'deploy-image'" <button *ngIf="trace.status === 'in-progress' && trace.command === 'deploy-image'" mat-icon-button
mat-icon-button (click)="cancelTrace(trace)" class="cancel-button" matTooltip="Cancelar transmisión de imagen">
(click)="cancelTrace(trace)"
class="cancel-button"
matTooltip="Cancelar transmisión de imagen">
<mat-icon>cancel</mat-icon> <mat-icon>cancel</mat-icon>
</button> </button>
</div> </div>
@ -161,7 +160,7 @@
</span> </span>
</mat-icon> </mat-icon>
</button> </button>
<button mat-icon-button color="primary" [disabled]="!trace.output" (click)="openOutputModal(trace.output)"> <button mat-icon-button color="primary" [disabled]="!trace.output" (click)="openOutputModal(trace.output)">
<mat-icon> <mat-icon>
<span class="material-symbols-outlined"> <span class="material-symbols-outlined">
info info
@ -180,4 +179,4 @@
<mat-paginator [length]="length" [pageSize]="itemsPerPage" [pageIndex]="page" [pageSizeOptions]="pageSizeOptions" <mat-paginator [length]="length" [pageSize]="itemsPerPage" [pageIndex]="page" [pageSizeOptions]="pageSizeOptions"
(page)="onPageChange($event)"> (page)="onPageChange($event)">
</mat-paginator> </mat-paginator>
</div> </div>

View File

@ -262,8 +262,10 @@ export class TaskLogsComponent implements OnInit {
} }
resetFilters() { resetFilters(clientSearchCommandInput: any, clientSearchStatusInput: any) {
this.loading = true; this.loading = true;
clientSearchCommandInput.value = null;
clientSearchStatusInput.value = null;
this.filters = {}; this.filters = {};
this.loadTraces(); this.loadTraces();
} }