Files
WebApp/src/app/governance/components/experiments-panel/experiments-panel.html
T
2026-11-13 11:52:42 -06:00

108 lines
4.7 KiB
HTML

<div class="experiments">
<div class="experiments__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="experiments__spacer"></span>
<button mat-icon-button type="button" (click)="reload()" aria-label="Recargar" matTooltip="Recargar">
<mat-icon aria-hidden="true">refresh</mat-icon>
</button>
<button mat-flat-button type="button" (click)="start()">
<mat-icon aria-hidden="true">upload_file</mat-icon>Correr un notebook
</button>
</div>
@if (loading()) {
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
}
@if (loadError(); as error) {
<p class="experiments__alert" role="alert"><mat-icon aria-hidden="true">error</mat-icon>{{ error }}</p>
}
<table mat-table [dataSource]="experiments()" multiTemplateDataRows class="experiments__table">
<ng-container matColumnDef="notebook">
<th mat-header-cell *matHeaderCellDef>Notebook</th>
<td mat-cell *matCellDef="let run">
<div class="experiments__name">{{ run.notebook }}</div>
@if (run.version) {
<div class="experiments__muted">con la versión {{ run.version }}</div>
}
@if (run.sandbox === 'local') {
<div class="experiments__warning" matTooltip="Corrió en el proceso de la API, sin contenedor aislado">
<mat-icon aria-hidden="true">warning</mat-icon>Sin aislar
</div>
}
</td>
</ng-container>
<ng-container matColumnDef="scenario">
<th mat-header-cell *matHeaderCellDef>Dominio · escenario</th>
<td mat-cell *matCellDef="let run">{{ run.domain }} · {{ run.scenario }}</td>
</ng-container>
<ng-container matColumnDef="cohort">
<th mat-header-cell *matHeaderCellDef>Cohorte</th>
<td mat-cell *matCellDef="let run">{{ run.cohort.url }} · {{ run.cohort.source }} {{ run.cohort.build }}</td>
</ng-container>
<ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef>Estatus</th>
<td mat-cell *matCellDef="let run">
<span class="experiments__status" [class]="'experiments__status experiments__status--' + run.status">
<mat-icon aria-hidden="true">{{ status(run.status).icon }}</mat-icon>{{ status(run.status).label }}
</span>
</td>
</ng-container>
<ng-container matColumnDef="started_at">
<th mat-header-cell *matHeaderCellDef>Inicio</th>
<td mat-cell *matCellDef="let run">{{ run.started_at | date: 'short' }}</td>
</ng-container>
<ng-container matColumnDef="acciones">
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let run" class="experiments__actions">
@if (run.status !== 'en_curso') {
<a mat-button [href]="api.experimentPageUrl(run.run_id)" target="_blank" rel="noopener">
<mat-icon aria-hidden="true">open_in_new</mat-icon>Ver resultados
</a>
}
<button mat-icon-button type="button" (click)="toggle(run)" [attr.aria-expanded]="!!details()[run.run_id]"
aria-label="Archivos de la corrida" matTooltip="Archivos de la corrida">
<mat-icon aria-hidden="true">{{ details()[run.run_id] ? 'expand_less' : 'expand_more' }}</mat-icon>
</button>
</td>
</ng-container>
<ng-container matColumnDef="detail">
<td mat-cell *matCellDef="let run" [attr.colspan]="displayedColumns.length" class="experiments__detail">
@if (details()[run.run_id]; as detail) {
@if (detail.error) {
<pre class="experiments__error">{{ detail.error }}</pre>
}
<ul class="experiments__files">
@for (file of detail.artifacts; track file.path) {
<li>
<a [href]="api.experimentArtifactUrl(run.run_id, file.path)" download>
<mat-icon aria-hidden="true">download</mat-icon>{{ file.path }}
</a>
</li>
}
</ul>
<p class="experiments__muted">Huella del notebook {{ detail.notebook_sha256.slice(0, 12) }}…</p>
}
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: ['detail']" class="experiments__detail-row" [class.experiments__detail-row--open]="!!details()[row.run_id]"></tr>
</table>
@if (!loading() && experiments().length === 0) {
<p class="experiments__empty"><mat-icon aria-hidden="true">science</mat-icon>Aún no se ha corrido ningún notebook.</p>
}
</div>