Files
WebApp/src/app/governance/components/model-versions-panel/model-versions-panel.html
T

113 lines
4.7 KiB
HTML

<div class="models">
<div class="models__toolbar">
<mat-button-toggle-group hideSingleSelectionIndicator [value]="domain()" (change)="setDomain($event.value)" aria-label="Dominio">
@for (option of domains(); track option.id) {
<mat-button-toggle [value]="option.id">{{ option.label }}</mat-button-toggle>
}
</mat-button-toggle-group>
<span class="models__spacer"></span>
@if (offered().length) {
<mat-form-field class="models__scenario" subscriptSizing="dynamic">
<mat-label>Modelo a entrenar</mat-label>
<mat-select [value]="selected() ?? (offered().length === 1 ? keyOf(offered()[0]) : null)" (selectionChange)="selected.set($event.value)">
@for (s of offered(); track keyOf(s)) {
<mat-option [value]="keyOf(s)">{{ keyOf(s) }}{{ s.produccion ? ' · en producción v' + s.produccion : '' }}</mat-option>
}
</mat-select>
</mat-form-field>
<button mat-stroked-button type="button" [disabled]="starting() || !(selected() || offered().length === 1)" (click)="train()"
matTooltip="Exporta la cohorte vigente de dbt, entrena una versión y la promueve si ya tiene sus informes">
<mat-icon aria-hidden="true">model_training</mat-icon>Entrenar
</button>
}
<button mat-icon-button type="button" (click)="reload()" aria-label="Recargar" matTooltip="Recargar">
<mat-icon aria-hidden="true">refresh</mat-icon>
</button>
</div>
@if (loading() || starting() || running()) {
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
}
@if (loadError(); as error) {
<p class="models__alert" role="alert"><mat-icon aria-hidden="true">error</mat-icon>{{ error }}</p>
}
@if (jobs().length) {
<section class="models__jobs" aria-label="Entrenamientos recientes">
<h3>Entrenamientos recientes</h3>
<ul>
@for (job of jobs(); track job.id) {
<li [class.models__job--failed]="job.estado === 'fallido' || job.estado === 'interrumpido'">
<strong>{{ job.domain }}/{{ job.scenario }}</strong> · {{ job.iniciado | date: 'short' }} · {{ estados[job.estado] }}
@if (job.salida || job.error) {
<details>
<summary>Salida</summary>
<pre>{{ job.error || job.salida }}</pre>
</details>
}
</li>
}
</ul>
</section>
}
<table mat-table [dataSource]="versions()" class="models__table">
<ng-container matColumnDef="version">
<th mat-header-cell *matHeaderCellDef>Versión</th>
<td mat-cell *matCellDef="let v">
<div class="models__tag">{{ v.name }}:{{ v.version }}</div>
@if (metrics(v).length) {
<mat-chip-set>
@for (metric of metrics(v); track metric.key) {
<mat-chip>{{ metric.key }}: {{ metric.value }}</mat-chip>
}
</mat-chip-set>
}
</td>
</ng-container>
<ng-container matColumnDef="scenario">
<th mat-header-cell *matHeaderCellDef>Dominio · escenario</th>
<td mat-cell *matCellDef="let v">{{ v.tags.domain }} · {{ v.tags.scenario }}</td>
</ng-container>
<ng-container matColumnDef="environment">
<th mat-header-cell *matHeaderCellDef>Entorno</th>
<td mat-cell *matCellDef="let v">
<span class="models__env" [class.models__env--prod]="v.tags.environment === 'PROD'">{{ v.tags.environment }}</span>
</td>
</ng-container>
<ng-container matColumnDef="armado">
<th mat-header-cell *matHeaderCellDef>Armado de cohorte</th>
<td mat-cell *matCellDef="let v">{{ v.tags['kit.armado_id'] ?? 'Sin enlazar' }}</td>
</ng-container>
<ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef>Estatus</th>
<td mat-cell *matCellDef="let v"><app-model-status [status]="v.status"></app-model-status></td>
</ng-container>
<ng-container matColumnDef="created_at">
<th mat-header-cell *matHeaderCellDef>Creada</th>
<td mat-cell *matCellDef="let v">{{ v.created_at | date: 'short' }}</td>
</ng-container>
<ng-container matColumnDef="acciones">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let v">
<button mat-button type="button" (click)="open(v)">
<mat-icon aria-hidden="true">info</mat-icon>Detalle
</button>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
@if (!loading() && versions().length === 0) {
<p class="models__empty"><mat-icon aria-hidden="true">model_training</mat-icon>Aún no hay versiones entrenadas para este filtro.</p>
}
</div>