139 lines
6.3 KiB
HTML
139 lines
6.3 KiB
HTML
<h2 mat-dialog-title class="gallery__title">
|
|
@if (view() !== 'catalog') {
|
|
<button mat-icon-button type="button" (click)="back()" aria-label="Volver a los conectores">
|
|
<mat-icon aria-hidden="true">arrow_back</mat-icon>
|
|
</button>
|
|
}
|
|
<span>{{ view() === 'catalog' ? 'Obtener datos' : entry()?.name }}</span>
|
|
</h2>
|
|
|
|
<mat-dialog-content class="gallery__content">
|
|
@switch (view()) {
|
|
@case ('catalog') {
|
|
<div class="gallery">
|
|
<mat-nav-list class="gallery__categories" aria-label="Categorías de conectores">
|
|
@for (item of visibleCategories(); track item.id) {
|
|
<a mat-list-item [activated]="category() === item.id" (click)="category.set(item.id)" role="button">
|
|
<mat-icon matListItemIcon aria-hidden="true">{{ item.icon }}</mat-icon>
|
|
<span matListItemTitle>{{ item.label }}</span>
|
|
</a>
|
|
}
|
|
</mat-nav-list>
|
|
|
|
<section class="gallery__main">
|
|
<mat-form-field appearance="outline" class="gallery__search" subscriptSizing="dynamic">
|
|
<mat-icon matPrefix aria-hidden="true">search</mat-icon>
|
|
<mat-label>Buscar conector</mat-label>
|
|
<input matInput (input)="onSearch($event)" />
|
|
</mat-form-field>
|
|
|
|
@if (catalogError(); as error) {
|
|
<p class="db-test db-test--error" role="alert"><mat-icon aria-hidden="true">error</mat-icon>{{ error }}</p>
|
|
}
|
|
<div class="gallery__grid" role="list">
|
|
@for (item of visibleEntries(); track item.id) {
|
|
<button
|
|
type="button"
|
|
class="connector-card"
|
|
matRipple
|
|
role="listitem"
|
|
[disabled]="!item.available"
|
|
[matTooltip]="item.available ? '' : 'No disponible en este servidor'"
|
|
(click)="pick(item)"
|
|
>
|
|
<mat-icon class="connector-card__icon" aria-hidden="true">{{ item.icon }}</mat-icon>
|
|
<span class="connector-card__name">{{ item.name }}</span>
|
|
<span class="connector-card__description">{{ item.description }}</span>
|
|
</button>
|
|
} @empty {
|
|
<p class="gallery__empty">Ningún conector coincide con la búsqueda.</p>
|
|
}
|
|
</div>
|
|
</section>
|
|
</div>
|
|
}
|
|
|
|
@case ('files') {
|
|
<p class="gallery__hint">
|
|
@switch (entry()?.connector?.kind) {
|
|
@case ('document') {
|
|
Agrega todos los documentos juntos: reportes, formatos o notas en PDF o imagen. Se separan por paciente aunque
|
|
uno ocupe varias páginas o varios archivos, y los campos se extraen del texto, incluido el texto libre.
|
|
}
|
|
@case ('edf') {
|
|
Agrega todos los registros juntos; cada archivo será una fila con los datos del estudio y el archivo original.
|
|
}
|
|
@default {
|
|
Puedes agregar varios archivos a la vez; cada uno se convierte en una conexión y sus tablas (las hojas de un
|
|
libro de Excel, las tablas de un PDF) quedan disponibles para mapear.
|
|
}
|
|
}
|
|
</p>
|
|
<app-file-dropzone [accept]="entry()?.connector?.extensions ?? []" (filesChange)="files.set($event)"></app-file-dropzone>
|
|
}
|
|
|
|
@case ('database') {
|
|
<p class="gallery__hint">
|
|
Solo lectura: la conexión se abre en modo de solo lectura y únicamente se permiten consultas SELECT.
|
|
</p>
|
|
@if (engine() === 'url') {
|
|
<form [formGroup]="urlForm" class="db-form" (ngSubmit)="connectDatabase()">
|
|
<mat-form-field appearance="outline" class="db-form__wide">
|
|
<mat-label>Cadena de conexión</mat-label>
|
|
<input matInput formControlName="url" placeholder="postgresql+psycopg2://usuario:contraseña@host:5432/base" autocomplete="off" />
|
|
<mat-hint>Formato SQLAlchemy: dialecto+driver://usuario:contraseña@host:puerto/base</mat-hint>
|
|
</mat-form-field>
|
|
</form>
|
|
} @else {
|
|
<form [formGroup]="serverForm" class="db-form" (ngSubmit)="connectDatabase()">
|
|
<mat-form-field appearance="outline" class="db-form__host">
|
|
<mat-label>Servidor</mat-label>
|
|
<input matInput formControlName="host" placeholder="10.0.10.41" autocomplete="off" />
|
|
</mat-form-field>
|
|
<mat-form-field appearance="outline" class="db-form__port">
|
|
<mat-label>Puerto</mat-label>
|
|
<input matInput type="number" formControlName="port" />
|
|
<mat-hint>Predeterminado: {{ serverEngine()?.default_port }}</mat-hint>
|
|
</mat-form-field>
|
|
<mat-form-field appearance="outline" class="db-form__wide">
|
|
<mat-label>Base de datos</mat-label>
|
|
<input matInput formControlName="database" autocomplete="off" />
|
|
</mat-form-field>
|
|
<mat-form-field appearance="outline">
|
|
<mat-label>Usuario</mat-label>
|
|
<input matInput formControlName="user" autocomplete="off" />
|
|
</mat-form-field>
|
|
<mat-form-field appearance="outline">
|
|
<mat-label>Contraseña</mat-label>
|
|
<input matInput type="password" formControlName="password" autocomplete="new-password" />
|
|
</mat-form-field>
|
|
</form>
|
|
}
|
|
|
|
@if (testing()) {
|
|
<mat-progress-bar mode="indeterminate" aria-label="Probando conexión"></mat-progress-bar>
|
|
}
|
|
@if (testResult(); as result) {
|
|
<p class="db-test" [class.db-test--error]="!result.ok" role="status">
|
|
<mat-icon aria-hidden="true">{{ result.ok ? 'check_circle' : 'error' }}</mat-icon>{{ result.message }}
|
|
</p>
|
|
}
|
|
}
|
|
}
|
|
</mat-dialog-content>
|
|
|
|
<mat-dialog-actions align="end">
|
|
<button mat-button mat-dialog-close type="button">Cancelar</button>
|
|
@if (view() === 'files') {
|
|
<button mat-flat-button type="button" [disabled]="files().length === 0" (click)="connectFiles()">
|
|
Conectar {{ files().length > 1 ? files().length + ' archivos' : '' }}
|
|
</button>
|
|
}
|
|
@if (view() === 'database') {
|
|
<button mat-stroked-button type="button" [disabled]="testing()" (click)="testConnection()">
|
|
<mat-icon aria-hidden="true">network_check</mat-icon>Probar conexión
|
|
</button>
|
|
<button mat-flat-button type="button" [disabled]="databaseFormInvalid" (click)="connectDatabase()">Conectar</button>
|
|
}
|
|
</mat-dialog-actions>
|