62 lines
2.4 KiB
HTML
62 lines
2.4 KiB
HTML
<h2 mat-dialog-title class="explorer__title">
|
|
<mat-icon aria-hidden="true">travel_explore</mat-icon>Explorar la base de datos
|
|
<button mat-icon-button type="button" (click)="refresh()" aria-label="Actualizar"><mat-icon aria-hidden="true">refresh</mat-icon></button>
|
|
</h2>
|
|
<mat-dialog-content class="explorer">
|
|
<mat-nav-list class="explorer__tables" aria-label="Tablas">
|
|
@for (target of data.targets; track target.key) {
|
|
<a mat-list-item [activated]="selected() === target" (click)="open(target)" role="button">
|
|
<mat-icon matListItemIcon aria-hidden="true">table_chart</mat-icon>
|
|
<span matListItemTitle>{{ target.table }}</span>
|
|
<span matListItemLine>
|
|
@if (totals().get(target.key); as total) {
|
|
{{ total | number }} filas
|
|
} @else if (totals().has(target.key)) {
|
|
{{ totals().get(target.key) === 0 ? 'vacía' : 'no disponible' }}
|
|
} @else {
|
|
…
|
|
}
|
|
</span>
|
|
</a>
|
|
}
|
|
</mat-nav-list>
|
|
|
|
<section class="explorer__rows">
|
|
@if (loading()) {
|
|
<mat-progress-bar mode="indeterminate" aria-label="Cargando filas"></mat-progress-bar>
|
|
}
|
|
@if (error(); as message) {
|
|
<p class="explorer__error" role="alert">{{ message }}</p>
|
|
}
|
|
@if (page(); as p) {
|
|
@if (p.rows.length === 0) {
|
|
<p class="explorer__empty">La tabla está vacía.</p>
|
|
} @else {
|
|
<div class="explorer__scroll">
|
|
<table mat-table [dataSource]="p.rows" class="explorer__table">
|
|
@for (column of allColumns(); track column) {
|
|
<ng-container [matColumnDef]="column">
|
|
<th mat-header-cell *matHeaderCellDef>{{ column }}</th>
|
|
<td mat-cell *matCellDef="let row" [class.explorer__null]="row[column] === null">{{ display(row[column]) }}</td>
|
|
</ng-container>
|
|
}
|
|
<tr mat-header-row *matHeaderRowDef="allColumns(); sticky: true"></tr>
|
|
<tr mat-row *matRowDef="let row; columns: allColumns()"></tr>
|
|
</table>
|
|
</div>
|
|
<mat-paginator
|
|
[length]="p.total"
|
|
[pageIndex]="pageIndex()"
|
|
[pageSize]="pageSize()"
|
|
[pageSizeOptions]="[25, 50, 100]"
|
|
(page)="onPage($event)"
|
|
aria-label="Paginación de filas"
|
|
></mat-paginator>
|
|
}
|
|
}
|
|
</section>
|
|
</mat-dialog-content>
|
|
<mat-dialog-actions align="end">
|
|
<button mat-button mat-dialog-close type="button">Cerrar</button>
|
|
</mat-dialog-actions>
|