Conectar dialog by kind of source; plain-language canvas; login page and guard; loading indicators as the old app; survival curves of her clinical scenarios in the CaMa record
This commit is contained in:
@@ -0,0 +1,369 @@
|
||||
@if (!type()) {
|
||||
<h2 mat-dialog-title>¿Dónde están los datos?</h2>
|
||||
<mat-dialog-content>
|
||||
@if (catalog.isLoading()) {
|
||||
<div class="loading" role="status">
|
||||
<mat-spinner diameter="32" /> <span>Cargando opciones…</span>
|
||||
</div>
|
||||
}
|
||||
@for (g of groups(); track g.id) {
|
||||
<section class="group">
|
||||
<h3>{{ g.title }}</h3>
|
||||
<p class="hint">{{ g.description }}</p>
|
||||
<div class="types">
|
||||
@for (t of g.types; track t.id) {
|
||||
<button type="button" class="type" (click)="pick(t.id)" [attr.data-type]="t.id">
|
||||
<mat-icon>{{ icon(t.icon) }}</mat-icon>
|
||||
<span class="type-title">{{ t.title }}</span>
|
||||
<span class="type-text">{{ t.description }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button mat-dialog-close>Cancelar</button>
|
||||
</mat-dialog-actions>
|
||||
} @else {
|
||||
<h2 mat-dialog-title class="with-icon">
|
||||
<mat-icon>{{ icon(type()!.icon) }}</mat-icon> {{ type()!.title }}
|
||||
</h2>
|
||||
<mat-dialog-content>
|
||||
<p class="hint">{{ type()!.description }}</p>
|
||||
|
||||
<ng-template #field let-name let-f="f">
|
||||
@switch (f.type === 'server_file' ? 'folder' : f.type) {
|
||||
@case ('password') {
|
||||
<mat-form-field appearance="outline" class="full">
|
||||
<mat-label>{{ f.label }}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
[type]="showPassword()[name] ? 'text' : 'password'"
|
||||
[ngModel]="isMasked(name) ? '' : text(name)"
|
||||
(ngModelChange)="set(name, $event)"
|
||||
[placeholder]="isMasked(name) ? 'Guardada (escriba para cambiarla)' : f.placeholder"
|
||||
[attr.data-field]="name"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<button
|
||||
mat-icon-button
|
||||
matSuffix
|
||||
type="button"
|
||||
(click)="togglePassword(name)"
|
||||
[attr.aria-label]="showPassword()[name] ? 'Ocultar' : 'Mostrar'"
|
||||
>
|
||||
<mat-icon>{{ showPassword()[name] ? 'visibility_off' : 'visibility' }}</mat-icon>
|
||||
</button>
|
||||
@if (f.help) {
|
||||
<mat-hint>{{ f.help }}</mat-hint>
|
||||
}
|
||||
</mat-form-field>
|
||||
}
|
||||
@case ('number') {
|
||||
<mat-form-field appearance="outline" class="full">
|
||||
<mat-label>{{ f.label }}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
[ngModel]="text(name)"
|
||||
(ngModelChange)="setNumber(name, $event)"
|
||||
[attr.data-field]="name"
|
||||
/>
|
||||
@if (f.help) {
|
||||
<mat-hint>{{ f.help }}</mat-hint>
|
||||
}
|
||||
</mat-form-field>
|
||||
}
|
||||
@case ('select') {
|
||||
<mat-form-field appearance="outline" class="full">
|
||||
<mat-label>{{ f.label }}</mat-label>
|
||||
<mat-select [ngModel]="value(name)" (ngModelChange)="set(name, $event)">
|
||||
@for (o of f.options; track o.value) {
|
||||
<mat-option [value]="o.value">{{ o.label }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
@if (f.help) {
|
||||
<mat-hint>{{ f.help }}</mat-hint>
|
||||
}
|
||||
</mat-form-field>
|
||||
}
|
||||
@case ('format') {
|
||||
<mat-form-field appearance="outline" class="full">
|
||||
<mat-label>{{ f.label }}</mat-label>
|
||||
<mat-select
|
||||
[ngModel]="value(name)"
|
||||
(ngModelChange)="set(name, $event)"
|
||||
[attr.data-field]="name"
|
||||
>
|
||||
@for (o of formats(); track o.value) {
|
||||
<mat-option [value]="o.value">{{ o.label }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
}
|
||||
@case ('table') {
|
||||
<mat-form-field appearance="outline" class="full">
|
||||
<mat-label>{{ f.label }}</mat-label>
|
||||
@if (tables().length) {
|
||||
<mat-select
|
||||
[ngModel]="value(name)"
|
||||
(ngModelChange)="set(name, $event); test()"
|
||||
[attr.data-field]="name"
|
||||
>
|
||||
@for (t of tables(); track t) {
|
||||
<mat-option [value]="t">{{ t }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
} @else {
|
||||
<input
|
||||
matInput
|
||||
[ngModel]="text(name)"
|
||||
(ngModelChange)="set(name, $event)"
|
||||
[attr.data-field]="name"
|
||||
/>
|
||||
}
|
||||
@if (f.help) {
|
||||
<mat-hint>{{ f.help }}</mat-hint>
|
||||
}
|
||||
</mat-form-field>
|
||||
}
|
||||
@case ('folder') {
|
||||
<div class="picker">
|
||||
<mat-form-field appearance="outline" class="grow">
|
||||
<mat-label>{{ f.label }}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
[ngModel]="text(name)"
|
||||
(ngModelChange)="set(name, $event)"
|
||||
[attr.data-field]="name"
|
||||
/>
|
||||
@if (f.help) {
|
||||
<mat-hint>{{ f.help }}</mat-hint>
|
||||
}
|
||||
</mat-form-field>
|
||||
<button mat-stroked-button type="button" (click)="openFolder(name, text(name) || null)">
|
||||
<mat-icon>folder_open</mat-icon> Examinar…
|
||||
</button>
|
||||
</div>
|
||||
@if (browsing(); as b) {
|
||||
@if (b.field === name) {
|
||||
<div class="browser" role="group" aria-label="Carpetas del servidor">
|
||||
<div class="browser-head">
|
||||
@if (b.at.path) {
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
(click)="openFolder(name, b.at.parent)"
|
||||
aria-label="Subir"
|
||||
>
|
||||
<mat-icon>arrow_upward</mat-icon>
|
||||
</button>
|
||||
<code>{{ b.at.path }}</code>
|
||||
} @else {
|
||||
<span class="hint">Carpetas habilitadas en el servidor</span>
|
||||
}
|
||||
</div>
|
||||
<ul>
|
||||
@for (e of b.at.entries; track e.path) {
|
||||
<li>
|
||||
@if (e.kind === 'folder') {
|
||||
<button type="button" class="entry" (click)="openFolder(name, e.path)">
|
||||
<mat-icon>folder</mat-icon> {{ e.name }}
|
||||
</button>
|
||||
} @else if (browsingFiles()) {
|
||||
<button type="button" class="entry" (click)="chooseFile(e.path)">
|
||||
<mat-icon>description</mat-icon> {{ e.name }}
|
||||
</button>
|
||||
} @else {
|
||||
<span class="entry file"
|
||||
><mat-icon>description</mat-icon> {{ e.name }}</span
|
||||
>
|
||||
}
|
||||
</li>
|
||||
} @empty {
|
||||
<li class="hint">Vacía.</li>
|
||||
}
|
||||
</ul>
|
||||
<div class="browser-actions">
|
||||
<button mat-button type="button" (click)="browsing.set(undefined)">Cerrar</button>
|
||||
@if (!browsingFiles()) {
|
||||
<button
|
||||
mat-flat-button
|
||||
type="button"
|
||||
[disabled]="!b.at.path"
|
||||
(click)="chooseFolder()"
|
||||
>
|
||||
Elegir esta carpeta
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
@case ('upload') {
|
||||
<div
|
||||
class="drop"
|
||||
(dragover)="$event.preventDefault()"
|
||||
(drop)="dropped(name, $event)"
|
||||
[attr.data-field]="name"
|
||||
>
|
||||
<mat-icon>cloud_upload</mat-icon>
|
||||
<p>Arrastre aquí los archivos, o</p>
|
||||
<div class="drop-buttons">
|
||||
<button mat-stroked-button type="button" (click)="files.click()">
|
||||
Elegir archivos
|
||||
</button>
|
||||
<button mat-stroked-button type="button" (click)="folder.click()">
|
||||
Elegir una carpeta
|
||||
</button>
|
||||
</div>
|
||||
<input #files type="file" multiple hidden (change)="upload(name, files.files)" />
|
||||
<input
|
||||
#folder
|
||||
type="file"
|
||||
webkitdirectory
|
||||
hidden
|
||||
(change)="upload(name, folder.files)"
|
||||
/>
|
||||
@if (uploading(); as u) {
|
||||
@if (u.field === name) {
|
||||
<mat-progress-bar mode="determinate" [value]="u.percent" />
|
||||
<span class="hint">Subiendo… {{ u.percent }} %</span>
|
||||
}
|
||||
}
|
||||
@if (uploaded()[name]?.length) {
|
||||
<p class="ok">
|
||||
<mat-icon>check_circle</mat-icon> {{ uploaded()[name].length }} archivos subidos
|
||||
</p>
|
||||
} @else if (text(name)) {
|
||||
<p class="ok"><mat-icon>check_circle</mat-icon> Archivos ya subidos</p>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@case ('oauth') {
|
||||
<div class="signin">
|
||||
@if (account(name); as who) {
|
||||
<p class="ok"><mat-icon>check_circle</mat-icon> Conectado como {{ who }}</p>
|
||||
<button mat-button type="button" (click)="signIn(name, f.provider)">
|
||||
Usar otra cuenta
|
||||
</button>
|
||||
} @else {
|
||||
<button mat-flat-button type="button" (click)="signIn(name, f.provider)">
|
||||
<mat-icon>login</mat-icon>
|
||||
Iniciar sesión con {{ catalog.value()?.providers?.[f.provider]?.title }}
|
||||
</button>
|
||||
}
|
||||
@if (f.help) {
|
||||
<p class="hint">{{ f.help }}</p>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@default {
|
||||
<mat-form-field appearance="outline" class="full">
|
||||
<mat-label>{{ f.label }}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
[ngModel]="text(name)"
|
||||
(ngModelChange)="set(name, $event)"
|
||||
[placeholder]="f.placeholder"
|
||||
[attr.data-field]="name"
|
||||
/>
|
||||
@if (f.help) {
|
||||
<mat-hint>{{ f.help }}</mat-hint>
|
||||
}
|
||||
</mat-form-field>
|
||||
}
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<div class="fields">
|
||||
@for (e of fields(); track e[0]) {
|
||||
<ng-container *ngTemplateOutlet="field; context: { $implicit: e[0], f: e[1] }" />
|
||||
}
|
||||
</div>
|
||||
@if (more().length) {
|
||||
<mat-expansion-panel class="more">
|
||||
<mat-expansion-panel-header>Más opciones</mat-expansion-panel-header>
|
||||
<div class="fields">
|
||||
@for (e of more(); track e[0]) {
|
||||
<ng-container *ngTemplateOutlet="field; context: { $implicit: e[0], f: e[1] }" />
|
||||
}
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
}
|
||||
|
||||
<div class="test">
|
||||
<button
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
(click)="test()"
|
||||
[disabled]="testing() || missing().length > 0"
|
||||
>
|
||||
<mat-icon>network_check</mat-icon> Probar conexión
|
||||
</button>
|
||||
@if (testing()) {
|
||||
<mat-spinner diameter="24" /> <span role="status">Conectando…</span>
|
||||
} @else if (missing().length) {
|
||||
<span class="hint">Falta: {{ missing().join(', ') }}</span>
|
||||
}
|
||||
</div>
|
||||
@if (problem()) {
|
||||
<p class="error" role="alert"><mat-icon>error</mat-icon> {{ problem() }}</p>
|
||||
}
|
||||
@if (tested(); as t) {
|
||||
<div class="result" [class.bad]="!t.ok" role="status">
|
||||
<p>
|
||||
<mat-icon>{{ t.ok ? 'check_circle' : 'error' }}</mat-icon> {{ t.message }}
|
||||
</p>
|
||||
@if (t.detail) {
|
||||
<details>
|
||||
<summary>Lo que respondió el sistema</summary>
|
||||
<pre>{{ t.detail }}</pre>
|
||||
</details>
|
||||
}
|
||||
@if (t.tables?.length) {
|
||||
<p class="hint">Elija una tabla arriba para ver sus primeras filas.</p>
|
||||
}
|
||||
@if (t.rows?.length) {
|
||||
<p class="hint">
|
||||
{{
|
||||
t.rows!.length === 1
|
||||
? 'La primera fila:'
|
||||
: 'Las primeras ' + t.rows!.length + ' filas:'
|
||||
}}
|
||||
</p>
|
||||
<div class="rows">
|
||||
<table mat-table [dataSource]="t.rows!">
|
||||
@for (c of columns(); track c) {
|
||||
<ng-container [matColumnDef]="c">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ c }}</th>
|
||||
<td mat-cell *matCellDef="let row">{{ cell(row[c]) }}</td>
|
||||
</ng-container>
|
||||
}
|
||||
<tr mat-header-row *matHeaderRowDef="columns()"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: columns()"></tr>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<mat-form-field appearance="outline" class="full name">
|
||||
<mat-label>Nombre de esta fuente</mat-label>
|
||||
<input matInput [ngModel]="label()" (ngModelChange)="label.set($event)" />
|
||||
<mat-hint>Cómo se verá en el diagrama.</mat-hint>
|
||||
</mat-form-field>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
@if (!data.guided) {
|
||||
<button mat-button type="button" (click)="back()">
|
||||
<mat-icon>arrow_back</mat-icon> Otro tipo
|
||||
</button>
|
||||
}
|
||||
<span class="spacer"></span>
|
||||
<button mat-button mat-dialog-close>Cancelar</button>
|
||||
<button mat-flat-button type="button" (click)="save()" [disabled]="!ready()">Guardar</button>
|
||||
</mat-dialog-actions>
|
||||
}
|
||||
Reference in New Issue
Block a user