187 lines
8.3 KiB
HTML
187 lines
8.3 KiB
HTML
<mat-dialog-content class="modal-content">
|
|
<div class="header-container">
|
|
<button mat-icon-button color="primary" (click)="iniciarTour()">
|
|
<mat-icon>help</mat-icon>
|
|
</button>
|
|
|
|
<div class="header-container-title">
|
|
<h2 joyrideStep="tracesTitleStep" text="{{ 'tracesTitleStepText' | translate }}">{{ 'adminCommandsTitle' |
|
|
translate }}</h2>
|
|
</div>
|
|
|
|
<div class="header-right">
|
|
<button class="action-button" (click)="resetFilters(commandSearchInput, commandStatusInput)"
|
|
joyrideStep="resetFiltersStep" text="{{ 'resetFiltersStepText' | translate }}">
|
|
{{ 'resetFilters' | translate }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="search-container" joyrideStep="filtersStep" text="{{ 'filtersStepText' | translate }}">
|
|
<mat-form-field appearance="fill" class="search-select">
|
|
<mat-label>{{ 'commandSelectStepText' | translate }}</mat-label>
|
|
<mat-select (selectionChange)="onOptionCommandSelected($event.value)" #commandSearchInput>
|
|
<mat-option *ngFor="let command of filteredCommands2" [value]="command">
|
|
{{ translateCommand(command.name) }}
|
|
</mat-option>
|
|
</mat-select>
|
|
<button *ngIf="commandSearchInput.value" mat-icon-button matSuffix aria-label="Clear input search"
|
|
(click)="clearCommandFilter($event, commandSearchInput)">
|
|
<mat-icon>close</mat-icon>
|
|
</button>
|
|
</mat-form-field>
|
|
|
|
|
|
<mat-form-field appearance="fill" class="search-boolean">
|
|
<mat-label i18n="@@searchLabel">Estado</mat-label>
|
|
<mat-select (selectionChange)="onOptionStatusSelected($event.value)" placeholder="Seleccionar opción"
|
|
#commandStatusInput>
|
|
<mat-option [value]="'failed'">Fallido</mat-option>
|
|
<mat-option [value]="'pending'">Pendiente de ejecutar</mat-option>
|
|
<mat-option [value]="'in-progress'">Ejecutando</mat-option>
|
|
<mat-option [value]="'success'">Completado con éxito</mat-option>
|
|
<mat-option [value]="'cancelled'">Cancelado</mat-option>
|
|
</mat-select>
|
|
<button *ngIf="commandStatusInput.value" mat-icon-button matSuffix aria-label="Clear input search"
|
|
(click)="clearStatusFilter($event, commandStatusInput)">
|
|
<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()" [max]="today">
|
|
<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()"
|
|
[max]="today">
|
|
<mat-datepicker-toggle matSuffix [for]="toPicker"></mat-datepicker-toggle>
|
|
<mat-datepicker #toPicker></mat-datepicker>
|
|
</mat-form-field>
|
|
|
|
</div>
|
|
|
|
<app-loading [isLoading]="loading"></app-loading>
|
|
|
|
<div *ngIf="!loading">
|
|
<table mat-table [dataSource]="traces" class="mat-elevation-z8">
|
|
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
|
|
<th mat-header-cell *matHeaderCellDef> {{ column.header }} </th>
|
|
<td mat-cell *matCellDef="let trace">
|
|
|
|
<ng-container [ngSwitch]="column.columnDef">
|
|
<ng-container *ngSwitchCase="'status'">
|
|
<ng-container *ngIf="trace.status === 'in-progress' && trace.progress; else statusChip">
|
|
<div class="progress-container">
|
|
<mat-progress-bar class="example-margin" [mode]="mode" [value]="trace.progress"
|
|
[bufferValue]="bufferValue">
|
|
</mat-progress-bar>
|
|
<span>{{trace.progress}}%</span>
|
|
<button mat-icon-button
|
|
(click)="cancelTrace(trace)" class="cancel-button" matTooltip="Cancelar tarea">
|
|
<mat-icon>cancel</mat-icon>
|
|
</button>
|
|
</div>
|
|
</ng-container>
|
|
<ng-template #statusChip>
|
|
<div class="status-progress-flex" joyrideStep="tracesProgressStep"
|
|
text="{{ 'tracesProgressStepText' | translate }}">
|
|
<mat-chip [ngClass]="{
|
|
'chip-failed': trace.status === 'failed',
|
|
'chip-success': trace.status === 'success',
|
|
'chip-pending': trace.status === 'pending',
|
|
'chip-in-progress': trace.status === 'in-progress',
|
|
'chip-cancelled': trace.status === 'cancelled'
|
|
}">
|
|
{{
|
|
trace.status === 'failed' ? 'Error' :
|
|
trace.status === 'in-progress' ? 'En ejecución' :
|
|
trace.status === 'success' ? 'Completado' :
|
|
trace.status === 'pending' ? 'Pendiente' :
|
|
trace.status === 'cancelled' ? 'Cancelado' :
|
|
trace.status
|
|
}}
|
|
</mat-chip>
|
|
<button *ngIf="trace.status === 'in-progress'" mat-icon-button
|
|
(click)="cancelTrace(trace)" class="cancel-button" matTooltip="Cancelar tarea">
|
|
<mat-icon>cancel</mat-icon>
|
|
</button>
|
|
</div>
|
|
</ng-template>
|
|
</ng-container>
|
|
|
|
<ng-container *ngSwitchCase="'command'">
|
|
<div style="display: flex; flex-direction: column;">
|
|
<span>{{ translateCommand(trace.command) }}</span>
|
|
<span style="font-size: 0.75rem; color: gray;">{{ trace.jobId }}</span>
|
|
</div>
|
|
</ng-container>
|
|
|
|
<ng-container *ngSwitchCase="'client'">
|
|
<div style="display: flex; flex-direction: column;">
|
|
<span>{{ trace.client?.name }}</span>
|
|
<span style="font-size: 0.75rem; color: gray;">{{ trace.client?.ip }}</span>
|
|
</div>
|
|
</ng-container>
|
|
|
|
|
|
<ng-container *ngSwitchCase="'executedAt'">
|
|
<div style="display: flex; flex-direction: column;">
|
|
<span style="font-size: 0.8rem;"> {{ trace.executedAt |date: 'dd/MM/yyyy hh:mm:ss'}}</span>
|
|
</div>
|
|
</ng-container>
|
|
|
|
<ng-container *ngSwitchCase="'finishedAt'">
|
|
<div style="display: flex; flex-direction: column;">
|
|
<span style="font-size: 0.8rem;"> {{ trace.finishedAt |date: 'dd/MM/yyyy hh:mm:ss'}}</span>
|
|
</div>
|
|
</ng-container>
|
|
<ng-container *ngSwitchDefault>
|
|
{{ column.cell(trace) }}
|
|
</ng-container>
|
|
|
|
</ng-container>
|
|
</td>
|
|
</ng-container>
|
|
|
|
<ng-container matColumnDef="information">
|
|
<th mat-header-cell *matHeaderCellDef style="text-align: center;">{{ 'informationLabel' | translate }}</th>
|
|
<td mat-cell *matCellDef="let trace" style="text-align: center;" joyrideStep="tracesInfoStep"
|
|
text="{{ 'tracesInfoStepText' | translate }}">
|
|
<button mat-icon-button color="primary" [disabled]="!trace.input" (click)="openInputModal(trace.input)">
|
|
<mat-icon>
|
|
<span class="material-symbols-outlined">
|
|
mode_comment
|
|
</span>
|
|
</mat-icon>
|
|
</button>
|
|
<button mat-icon-button color="primary" [disabled]="!trace.output" (click)="openOutputModal(trace.output)">
|
|
<mat-icon>
|
|
<span class="material-symbols-outlined">
|
|
info
|
|
</span>
|
|
</mat-icon>
|
|
</button>
|
|
</td>
|
|
</ng-container>
|
|
|
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="paginator-container" joyrideStep="paginationStep" text="{{ 'paginationStepText' | translate }}">
|
|
<mat-paginator [length]="length" [pageSize]="itemsPerPage" [pageIndex]="page" [pageSizeOptions]="pageSizeOptions"
|
|
(page)="onPageChange($event)">
|
|
</mat-paginator>
|
|
</div>
|
|
</mat-dialog-content>
|
|
|
|
<mat-dialog-actions align="end" style="padding: 16px 24px;">
|
|
<button class="ordinary-button" (click)="closeDialog()">{{ 'closeButton' | translate }}</button>
|
|
</mat-dialog-actions> |