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,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 { MatButtonToggleModule } from '@angular/material/button-toggle';
@@ -10,6 +10,8 @@ import { MatTableModule } from '@angular/material/table';
import { MatTooltipModule } from '@angular/material/tooltip';
import { Subscription, timer } from 'rxjs';
import { apiErrorMessage } from '../../../connect/api/api.types';
import { AuthService } from '../../../auth/auth.service';
import { alcanzaTodos, dominioInicial, dominiosPermitidos } from '../../../auth/dominios';
import { DOMAINS } from '../../../connect/state/connect-workspace.store';
import { GovernanceApi } from '../../api/governance.api';
import { Experiment, ExperimentDetail, ExperimentStatus } from '../../api/governance.types';
@@ -36,11 +38,16 @@ const POLL_MS = 5000;
})
export class ExperimentsPanel implements OnInit {
readonly api = inject(GovernanceApi);
private readonly auth = inject(AuthService);
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 experiments = signal<Experiment[]>([]);
readonly details = signal<Record<string, ExperimentDetail>>({});
readonly loading = signal(false);
@@ -57,6 +64,7 @@ export class ExperimentsPanel implements OnInit {
}
setDomain(domain: string | null): void {
if (domain !== null && !this.auth.puedeVer(domain)) return;
this.domain.set(domain);
this.reload();
}