feat(auth): login screen and domain-scoped navigation

Session login against /auth/*, with a guard on every route and an interceptor that returns to the login on 401. The header, the import workspace and both governance panels only offer the account's own domains (auth/dominios.ts), and a batch opens on the account's database.

The sign-in screen follows the app's palette: logo above the title, the action button in the shared tokens, and no register or password-recovery rows.
This commit is contained in:
Erick ivan
2026-11-19 09:36:48 -06:00
parent d72c18756f
commit 7f17681409
29 changed files with 876 additions and 121 deletions
@@ -1,7 +1,7 @@
<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) {
@for (option of domains(); track option.id) {
<mat-button-toggle [value]="option.id">{{ option.label }}</mat-button-toggle>
}
</mat-button-toggle-group>
@@ -1,5 +1,5 @@
import { DatePipe } from '@angular/common';
import { Component, DestroyRef, OnInit, inject, signal } from '@angular/core';
import { Component, DestroyRef, OnInit, computed, inject, signal } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatButtonModule } from '@angular/material/button';
import { MatDialog } from '@angular/material/dialog';
@@ -11,6 +11,8 @@ import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTableModule } from '@angular/material/table';
import { MatTooltipModule } from '@angular/material/tooltip';
import { DOMAINS } from '../../../connect/state/connect-workspace.store';
import { AuthService } from '../../../auth/auth.service';
import { alcanzaTodos, dominioInicial, dominiosPermitidos } from '../../../auth/dominios';
import { apiErrorMessage } from '../../../connect/api/api.types';
import { GovernanceApi } from '../../api/governance.api';
import { ModelVersion } from '../../api/governance.types';
@@ -45,12 +47,17 @@ const TRAINABLE = { domain: 'cacu', scenario: 'cin2_logistic' };
})
export class ModelVersionsPanel implements OnInit {
private readonly api = inject(GovernanceApi);
private readonly auth = inject(AuthService);
private readonly snackBar = inject(MatSnackBar);
private readonly dialog = inject(MatDialog);
private readonly destroyRef = inject(DestroyRef);
readonly domains = [{ id: null, label: 'Todos' }, ...DOMAINS.map((d) => ({ id: d.id as string | null, label: d.label }))];
readonly domain = signal<string | null>(null);
/** Only the account's domains; «Todos» only when it reaches all of them. */
readonly domains = computed<{ id: string | null; label: string }[]>(() => [
...(alcanzaTodos(this.auth, DOMAINS) ? [{ id: null, label: 'Todos' }] : []),
...dominiosPermitidos(this.auth, DOMAINS).map((d) => ({ id: d.id as string | null, label: d.label })),
]);
readonly domain = signal<string | null>(dominioInicial(this.auth, DOMAINS));
readonly versions = signal<ModelVersion[]>([]);
readonly loading = signal(false);
readonly loadError = signal<string | null>(null);
@@ -63,6 +70,7 @@ export class ModelVersionsPanel implements OnInit {
}
setDomain(domain: string | null): void {
if (domain !== null && !this.auth.puedeVer(domain)) return;
this.domain.set(domain);
this.reload();
}