This commit is contained in:
Bastian Wagner
2026-06-17 10:45:09 +02:00
parent 38141c0358
commit c94a02e6d0
51 changed files with 4220 additions and 628 deletions

View File

@@ -1,12 +1,11 @@
import {
Component,
Input,
OnChanges,
SimpleChanges,
OnInit,
computed,
inject,
signal,
} from '@angular/core';
import { resolveApiBaseUrl } from '../shared/api-base-url';
import { AnalyticsDashboard } from './dashboard.types';
import { DashboardService } from './dashboard.service';
@@ -16,12 +15,9 @@ import { DashboardService } from './dashboard.service';
templateUrl: './dashboard.component.html',
styleUrl: './dashboard.component.scss',
})
export class DashboardComponent implements OnChanges {
@Input({ required: true }) apiBaseUrl = '';
@Input() connected = false;
@Input() refreshKey = 0;
export class DashboardComponent implements OnInit {
private readonly dashboardService = inject(DashboardService);
private readonly apiBaseUrl = resolveApiBaseUrl();
protected readonly dashboard = signal<AnalyticsDashboard | null>(null);
protected readonly dashboardLoading = signal(false);
protected readonly dashboardError = signal<string | null>(null);
@@ -39,20 +35,11 @@ export class DashboardComponent implements OnChanges {
),
);
ngOnChanges(changes: SimpleChanges): void {
if (
this.connected &&
(changes['connected'] || changes['refreshKey'] || changes['apiBaseUrl'])
) {
this.loadDashboard();
}
ngOnInit(): void {
this.loadDashboard();
}
protected loadDashboard(): void {
if (!this.connected) {
return;
}
this.dashboardLoading.set(true);
this.dashboardError.set(null);