Feature: Dashboard
This commit is contained in:
Generated
+7
@@ -16,6 +16,7 @@
|
|||||||
"@angular/material": "^22.1.7",
|
"@angular/material": "^22.1.7",
|
||||||
"@angular/platform-browser": "^22.1.0",
|
"@angular/platform-browser": "^22.1.0",
|
||||||
"@angular/router": "^22.1.0",
|
"@angular/router": "^22.1.0",
|
||||||
|
"plotly.js-basic-dist-min": "^4.1.1",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
@@ -6481,6 +6482,12 @@
|
|||||||
"node": ">=16.20.0"
|
"node": ">=16.20.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/plotly.js-basic-dist-min": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/plotly.js-basic-dist-min/-/plotly.js-basic-dist-min-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-1oNF8PeQx2hv/y7tqEVWKD3JGwn/MGEMQ8mL9HUwsaqG9FGy/OU5FHUHvzqbqxN4mnwZGI9abTiE775C4kkjMQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.5.28",
|
"version": "8.5.28",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
"@angular/material": "^22.1.7",
|
"@angular/material": "^22.1.7",
|
||||||
"@angular/platform-browser": "^22.1.0",
|
"@angular/platform-browser": "^22.1.0",
|
||||||
"@angular/router": "^22.1.0",
|
"@angular/router": "^22.1.0",
|
||||||
|
"plotly.js-basic-dist-min": "^4.1.1",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0"
|
"tslib": "^2.3.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
import { Home } from './home';
|
import { Home } from './home';
|
||||||
|
|
||||||
export const routes: Routes = [{ path: '', component: Home }];
|
export const routes: Routes = [
|
||||||
|
{ path: '', component: Home },
|
||||||
|
{ path: 'dashboard', loadComponent: () => import('./dashboard/dashboard').then((module) => module.Dashboard) },
|
||||||
|
];
|
||||||
|
|||||||
+50
-2
@@ -7,8 +7,21 @@ import { InformationUploadDialog } from './information-upload-dialog';
|
|||||||
import { MatDialogRef } from '@angular/material/dialog';
|
import { MatDialogRef } from '@angular/material/dialog';
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
|
vi.mock('plotly.js-basic-dist-min', () => ({
|
||||||
|
default: {
|
||||||
|
react: vi.fn().mockResolvedValue(undefined),
|
||||||
|
purge: vi.fn(),
|
||||||
|
Plots: { resize: vi.fn() },
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
describe('App', () => {
|
describe('App', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
vi.stubGlobal('ResizeObserver', class {
|
||||||
|
observe() {}
|
||||||
|
unobserve() {}
|
||||||
|
disconnect() {}
|
||||||
|
});
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [App],
|
imports: [App],
|
||||||
providers: [provideRouter(routes)],
|
providers: [provideRouter(routes)],
|
||||||
@@ -419,7 +432,7 @@ describe('App', () => {
|
|||||||
expect(root.querySelector('#processing-success-title')?.textContent).toContain('Procesamiento completado');
|
expect(root.querySelector('#processing-success-title')?.textContent).toContain('Procesamiento completado');
|
||||||
expect(root.querySelector('.processing__finish')).not.toBeNull();
|
expect(root.querySelector('.processing__finish')).not.toBeNull();
|
||||||
root.querySelector<HTMLButtonElement>('.processing__finish')!.click();
|
root.querySelector<HTMLButtonElement>('.processing__finish')!.click();
|
||||||
expect(close).toHaveBeenCalledOnce();
|
expect(close).toHaveBeenCalledWith('completed');
|
||||||
fixture.destroy();
|
fixture.destroy();
|
||||||
vi.useRealTimers();
|
vi.useRealTimers();
|
||||||
});
|
});
|
||||||
@@ -449,8 +462,43 @@ describe('App', () => {
|
|||||||
expect(component.processingState()).toBe('success');
|
expect(component.processingState()).toBe('success');
|
||||||
expect(root.querySelector('.processing__finish')).not.toBeNull();
|
expect(root.querySelector('.processing__finish')).not.toBeNull();
|
||||||
root.querySelector<HTMLButtonElement>('.processing__finish')!.click();
|
root.querySelector<HTMLButtonElement>('.processing__finish')!.click();
|
||||||
expect(close).toHaveBeenCalledOnce();
|
expect(close).toHaveBeenCalledWith('completed');
|
||||||
fixture.destroy();
|
fixture.destroy();
|
||||||
vi.useRealTimers();
|
vi.useRealTimers();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('closes after success, then navigates to the Dashboard', async () => {
|
||||||
|
const fixture = TestBed.createComponent(App);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const router = TestBed.inject(Router);
|
||||||
|
await router.navigateByUrl('/');
|
||||||
|
fixture.detectChanges();
|
||||||
|
(fixture.nativeElement as HTMLElement).querySelector<HTMLButtonElement>('.home__action')!.click();
|
||||||
|
const dialog = TestBed.inject(MatDialog);
|
||||||
|
const dialogRef = dialog.openDialogs[0];
|
||||||
|
const dialogComponent = dialogRef.componentInstance as InformationUploadDialog;
|
||||||
|
dialogComponent.processingState.set('success');
|
||||||
|
dialogRef.componentRef!.changeDetectorRef.detectChanges();
|
||||||
|
document.querySelector<HTMLButtonElement>('.processing__finish')!.click();
|
||||||
|
await new Promise<void>((resolve) => dialogRef.afterClosed().subscribe(() => resolve()));
|
||||||
|
await fixture.whenStable();
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(dialog.openDialogs).toHaveLength(0);
|
||||||
|
expect(router.url).toBe('/dashboard');
|
||||||
|
expect((fixture.nativeElement as HTMLElement).querySelector('#dashboard-title')?.textContent).toContain('Resultados del análisis');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders the mock Dashboard with three KPIs and three charts', async () => {
|
||||||
|
const fixture = TestBed.createComponent(App);
|
||||||
|
fixture.detectChanges();
|
||||||
|
await TestBed.inject(Router).navigateByUrl('/dashboard');
|
||||||
|
await fixture.whenStable();
|
||||||
|
fixture.detectChanges();
|
||||||
|
const root = fixture.nativeElement as HTMLElement;
|
||||||
|
expect(root.querySelector('.dashboard__area')?.textContent).toContain('CAMA');
|
||||||
|
expect(root.querySelector('.dashboard__demo')?.textContent).toContain('Datos de demostración');
|
||||||
|
expect(root.querySelectorAll('.kpi')).toHaveLength(3);
|
||||||
|
expect(root.querySelectorAll('app-plotly-chart')).toHaveLength(3);
|
||||||
|
expect(root.querySelector('.site-footer img')).not.toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<section class="dashboard" aria-labelledby="dashboard-title">
|
||||||
|
<div class="dashboard__intro">
|
||||||
|
<p class="dashboard__eyebrow">ISSSTELEON · Análisis de información</p>
|
||||||
|
<h1 id="dashboard-title">Resultados del análisis</h1>
|
||||||
|
<div class="dashboard__metadata">
|
||||||
|
<span class="dashboard__area">{{ result.analysisType }}</span>
|
||||||
|
<span class="dashboard__demo">Datos de demostración</span>
|
||||||
|
</div>
|
||||||
|
<p class="dashboard__note">Los indicadores y las gráficas muestran valores obtenidos del procesamiento de los datos.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dashboard__kpis" aria-label="Indicadores de demostración">
|
||||||
|
@for (kpi of result.kpis; track kpi.label) {
|
||||||
|
<article class="kpi">
|
||||||
|
<p class="kpi__value">{{ kpi.value }}</p>
|
||||||
|
<h2 class="kpi__label">{{ kpi.label }}</h2>
|
||||||
|
</article>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dashboard__charts">
|
||||||
|
<article class="chart-card chart-card--bars" aria-labelledby="bars-title">
|
||||||
|
<h2 id="bars-title">Distribución por categoría</h2>
|
||||||
|
<app-plotly-chart [figure]="bars" aria-label="Gráfica de barras con categorías A a D, datos de demostración" />
|
||||||
|
</article>
|
||||||
|
<article class="chart-card chart-card--donut" aria-labelledby="donut-title">
|
||||||
|
<h2 id="donut-title">Composición</h2>
|
||||||
|
<app-plotly-chart [figure]="donut" aria-label="Gráfica de dona con segmentos A a C, datos de demostración" />
|
||||||
|
</article>
|
||||||
|
<article class="chart-card chart-card--line" aria-labelledby="line-title">
|
||||||
|
<h2 id="line-title">Evolución por periodo</h2>
|
||||||
|
<app-plotly-chart [figure]="line" aria-label="Gráfica de línea con periodos 1 a 6, datos de demostración" />
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// Datos exclusivos de demostración. No representan resultados clínicos ni un contrato de WebApi.
|
||||||
|
export interface MockAnalysisResult {
|
||||||
|
analysisType: 'CAMA';
|
||||||
|
kpis: ReadonlyArray<{ label: string; value: string }>;
|
||||||
|
charts: {
|
||||||
|
categories: ReadonlyArray<{ label: string; value: number }>;
|
||||||
|
composition: ReadonlyArray<{ label: string; value: number }>;
|
||||||
|
periods: ReadonlyArray<{ label: string; value: number }>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const mockAnalysisResult: MockAnalysisResult = {
|
||||||
|
analysisType: 'CAMA',
|
||||||
|
kpis: [
|
||||||
|
{ label: 'Indicador 1', value: '1,248' },
|
||||||
|
{ label: 'Indicador 2', value: '64.2 %' },
|
||||||
|
{ label: 'Indicador 3', value: '327' },
|
||||||
|
],
|
||||||
|
charts: {
|
||||||
|
categories: [
|
||||||
|
{ label: 'Categoría A', value: 12 },
|
||||||
|
{ label: 'Categoría B', value: 19 },
|
||||||
|
{ label: 'Categoría C', value: 9 },
|
||||||
|
{ label: 'Categoría D', value: 15 },
|
||||||
|
],
|
||||||
|
composition: [
|
||||||
|
{ label: 'Segmento A', value: 40 },
|
||||||
|
{ label: 'Segmento B', value: 35 },
|
||||||
|
{ label: 'Segmento C', value: 25 },
|
||||||
|
],
|
||||||
|
periods: [
|
||||||
|
{ label: 'Periodo 1', value: 8 },
|
||||||
|
{ label: 'Periodo 2', value: 11 },
|
||||||
|
{ label: 'Periodo 3', value: 10 },
|
||||||
|
{ label: 'Periodo 4', value: 15 },
|
||||||
|
{ label: 'Periodo 5', value: 13 },
|
||||||
|
{ label: 'Periodo 6', value: 18 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
:host { display: block; flex: 1; min-width: 0; }
|
||||||
|
.dashboard { margin: 0 auto; max-width: 1440px; padding: 42px clamp(20px, 4vw, 56px) 72px; width: 100%; }
|
||||||
|
.dashboard__eyebrow { color: var(--color-text-secondary); font-size: 12px; font-weight: 600; letter-spacing: .12em; margin: 0 0 12px; text-transform: uppercase; }
|
||||||
|
h1, h2, p { margin-top: 0; }
|
||||||
|
h1 { color: var(--color-text); font-family: var(--font-heading); font-size: clamp(32px, 3.8vw, 46px); line-height: 1.1; margin-bottom: 16px; }
|
||||||
|
.dashboard__metadata { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; }
|
||||||
|
.dashboard__area, .dashboard__demo { border-radius: 999px; font-size: 13px; font-weight: 700; padding: 6px 12px; }
|
||||||
|
.dashboard__area { background: #eaf0db; color: #465d1e; }
|
||||||
|
.dashboard__demo { background: #eff4f3; color: #326a6c; }
|
||||||
|
.dashboard__note { color: var(--color-text-secondary); font-size: 14px; line-height: 1.5; margin: 14px 0 0; }
|
||||||
|
.dashboard__kpis { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 32px 0 22px; }
|
||||||
|
.kpi, .chart-card { background: #fff; border: 1px solid var(--color-border); border-radius: 12px; min-width: 0; }
|
||||||
|
.kpi { padding: 22px 24px; }
|
||||||
|
.kpi__value { color: #52691f; font-family: var(--font-heading); font-size: clamp(32px, 3.5vw, 42px); font-weight: 700; line-height: 1; margin: 0 0 8px; overflow-wrap: anywhere; }
|
||||||
|
.kpi__label { color: var(--color-text); font-family: var(--font-body); font-size: 14px; font-weight: 500; margin: 0; }
|
||||||
|
.dashboard__charts { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
|
||||||
|
.chart-card { overflow: hidden; padding: 22px 22px 16px; }
|
||||||
|
.chart-card h2 { color: var(--color-text); font-family: var(--font-heading); font-size: 22px; font-weight: 700; line-height: 1.2; margin: 0 0 12px; }
|
||||||
|
.chart-card--line { grid-column: 1 / -1; }
|
||||||
|
@media (max-width: 860px) { .dashboard__charts { grid-template-columns: minmax(0, 1fr); } .chart-card--line { grid-column: auto; } }
|
||||||
|
@media (max-width: 600px) { .dashboard { padding: 30px 16px 48px; } .dashboard__kpis { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 26px; } .kpi { padding: 18px 20px; } .chart-card { padding: 18px 12px 12px; } .chart-card h2 { font-size: 20px; margin-left: 6px; } }
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { mockAnalysisResult } from './dashboard.mock';
|
||||||
|
import { ChartFigure, PlotlyChart } from './plotly-chart';
|
||||||
|
|
||||||
|
const ink = '#081839';
|
||||||
|
const grid = '#e9ede5';
|
||||||
|
const green = '#6f821c';
|
||||||
|
const darkGreen = '#465d1e';
|
||||||
|
const teal = '#5f9ea0';
|
||||||
|
const muted = '#7a7a7a';
|
||||||
|
const font = { family: 'Roboto, sans-serif', color: ink, size: 12 };
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
imports: [PlotlyChart],
|
||||||
|
selector: 'app-dashboard',
|
||||||
|
styleUrl: './dashboard.scss',
|
||||||
|
templateUrl: './dashboard.html',
|
||||||
|
})
|
||||||
|
export class Dashboard {
|
||||||
|
readonly result = mockAnalysisResult;
|
||||||
|
readonly bars: ChartFigure = {
|
||||||
|
data: [{
|
||||||
|
type: 'bar',
|
||||||
|
x: this.result.charts.categories.map((item) => item.label),
|
||||||
|
y: this.result.charts.categories.map((item) => item.value),
|
||||||
|
marker: { color: [green, darkGreen, teal, '#a8c243'] },
|
||||||
|
hovertemplate: '%{x}: %{y}<extra></extra>',
|
||||||
|
}],
|
||||||
|
layout: {
|
||||||
|
paper_bgcolor: 'rgba(0,0,0,0)', plot_bgcolor: 'rgba(0,0,0,0)', font,
|
||||||
|
margin: { l: 36, r: 12, t: 12, b: 48 }, showlegend: false,
|
||||||
|
xaxis: { showgrid: false, linecolor: grid, automargin: true },
|
||||||
|
yaxis: { showgrid: true, gridcolor: grid, zeroline: false, rangemode: 'tozero', automargin: true },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
readonly donut: ChartFigure = {
|
||||||
|
data: [{
|
||||||
|
type: 'pie', hole: 0.62,
|
||||||
|
labels: this.result.charts.composition.map((item) => item.label),
|
||||||
|
values: this.result.charts.composition.map((item) => item.value),
|
||||||
|
marker: { colors: [green, teal, '#b5c69b'] },
|
||||||
|
textinfo: 'none', hovertemplate: '%{label}: %{value}<extra></extra>', sort: false,
|
||||||
|
}],
|
||||||
|
layout: {
|
||||||
|
paper_bgcolor: 'rgba(0,0,0,0)', plot_bgcolor: 'rgba(0,0,0,0)', font,
|
||||||
|
margin: { l: 8, r: 8, t: 8, b: 8 },
|
||||||
|
showlegend: true, legend: { orientation: 'h', x: 0.5, xanchor: 'center', y: -0.06, font: { color: ink, size: 11 } },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
readonly line: ChartFigure = {
|
||||||
|
data: [{
|
||||||
|
type: 'scatter', mode: 'lines+markers',
|
||||||
|
x: this.result.charts.periods.map((item) => item.label),
|
||||||
|
y: this.result.charts.periods.map((item) => item.value),
|
||||||
|
line: { color: darkGreen, width: 3 }, marker: { color: green, size: 8 },
|
||||||
|
hovertemplate: '%{x}: %{y}<extra></extra>',
|
||||||
|
}],
|
||||||
|
layout: {
|
||||||
|
paper_bgcolor: 'rgba(0,0,0,0)', plot_bgcolor: 'rgba(0,0,0,0)', font,
|
||||||
|
margin: { l: 36, r: 16, t: 12, b: 48 }, showlegend: false,
|
||||||
|
xaxis: { showgrid: false, linecolor: grid, automargin: true },
|
||||||
|
yaxis: { showgrid: true, gridcolor: grid, zeroline: false, rangemode: 'tozero', automargin: true },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
declare module 'plotly.js-basic-dist-min' {
|
||||||
|
interface PlotlyBasic {
|
||||||
|
react(element: HTMLElement, data: ReadonlyArray<Record<string, unknown>>, layout: Record<string, unknown>, config: Record<string, unknown>): Promise<unknown>;
|
||||||
|
purge(element: HTMLElement): void;
|
||||||
|
Plots: { resize(element: HTMLElement): void };
|
||||||
|
}
|
||||||
|
const Plotly: PlotlyBasic;
|
||||||
|
export default Plotly;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import { isPlatformBrowser } from '@angular/common';
|
||||||
|
import { AfterViewInit, Component, ElementRef, inject, input, OnChanges, OnDestroy, PLATFORM_ID, viewChild } from '@angular/core';
|
||||||
|
|
||||||
|
export interface ChartFigure {
|
||||||
|
data: ReadonlyArray<Record<string, unknown>>;
|
||||||
|
layout: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-plotly-chart',
|
||||||
|
template: '<div #plot class="plotly-chart__plot"></div>',
|
||||||
|
styles: [':host { display: block; min-width: 0; width: 100%; } .plotly-chart__plot { min-width: 0; width: 100%; height: 290px; }'],
|
||||||
|
})
|
||||||
|
export class PlotlyChart implements AfterViewInit, OnChanges, OnDestroy {
|
||||||
|
readonly figure = input.required<ChartFigure>();
|
||||||
|
private readonly plot = viewChild.required<ElementRef<HTMLDivElement>>('plot');
|
||||||
|
private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));
|
||||||
|
private plotly: (typeof import('plotly.js-basic-dist-min'))['default'] | null = null;
|
||||||
|
private observer: ResizeObserver | null = null;
|
||||||
|
private ready = false;
|
||||||
|
private destroyed = false;
|
||||||
|
|
||||||
|
ngAfterViewInit(): void {
|
||||||
|
if (!this.browser) return;
|
||||||
|
this.ready = true;
|
||||||
|
void this.render();
|
||||||
|
this.observer = new ResizeObserver(() => {
|
||||||
|
if (this.plotly && !this.destroyed) this.plotly.Plots.resize(this.plot().nativeElement);
|
||||||
|
});
|
||||||
|
this.observer.observe(this.plot().nativeElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(): void {
|
||||||
|
if (this.ready) void this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async render(): Promise<void> {
|
||||||
|
// The import is evaluated only when a chart is mounted on the Dashboard route.
|
||||||
|
const module = await import('plotly.js-basic-dist-min');
|
||||||
|
if (this.destroyed) return;
|
||||||
|
this.plotly = module.default;
|
||||||
|
await this.plotly.react(this.plot().nativeElement, [...this.figure().data], {
|
||||||
|
...this.figure().layout,
|
||||||
|
autosize: true,
|
||||||
|
}, { responsive: true, displayModeBar: false, displaylogo: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.destroyed = true;
|
||||||
|
this.observer?.disconnect();
|
||||||
|
if (this.plotly) this.plotly.purge(this.plot().nativeElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-1
@@ -1,6 +1,8 @@
|
|||||||
import { Component, inject } from '@angular/core';
|
import { Component, inject } from '@angular/core';
|
||||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { take } from 'rxjs';
|
||||||
import { InformationUploadDialog } from './information-upload-dialog';
|
import { InformationUploadDialog } from './information-upload-dialog';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -11,17 +13,20 @@ import { InformationUploadDialog } from './information-upload-dialog';
|
|||||||
})
|
})
|
||||||
export class Home {
|
export class Home {
|
||||||
private readonly dialog = inject(MatDialog);
|
private readonly dialog = inject(MatDialog);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
|
||||||
openInformationDialog(): void {
|
openInformationDialog(): void {
|
||||||
if (this.dialog.openDialogs.length > 0) return;
|
if (this.dialog.openDialogs.length > 0) return;
|
||||||
|
|
||||||
this.dialog.open(InformationUploadDialog, {
|
this.dialog.open<InformationUploadDialog, void, 'completed' | undefined>(InformationUploadDialog, {
|
||||||
width: '800px',
|
width: '800px',
|
||||||
maxWidth: 'calc(100vw - 32px)',
|
maxWidth: 'calc(100vw - 32px)',
|
||||||
autoFocus: 'first-tabbable',
|
autoFocus: 'first-tabbable',
|
||||||
restoreFocus: true,
|
restoreFocus: true,
|
||||||
disableClose: true,
|
disableClose: true,
|
||||||
panelClass: 'information-upload-dialog-panel',
|
panelClass: 'information-upload-dialog-panel',
|
||||||
|
}).afterClosed().pipe(take(1)).subscribe((result) => {
|
||||||
|
if (result === 'completed') void this.router.navigateByUrl('/dashboard');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export class InformationUploadDialog implements OnDestroy {
|
|||||||
|
|
||||||
finishProcessing(): void {
|
finishProcessing(): void {
|
||||||
if (this.processingState() !== 'success') return;
|
if (this.processingState() !== 'success') return;
|
||||||
this.close();
|
this.dialogRef.close('completed');
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user