diff --git a/pdb-js/src/app/dashboard-page/dashboard-page.component.html b/pdb-js/src/app/dashboard-page/dashboard-page.component.html index 4046d3a..6459b20 100644 --- a/pdb-js/src/app/dashboard-page/dashboard-page.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard-page.component.html @@ -6,7 +6,7 @@ transform: translate(-50%, -50%); } .is-error { - font-size: 2rem; + font-size: 3rem; color: #333; } diff --git a/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html b/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html index 97a8261..2b2c861 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html @@ -4,20 +4,32 @@ height: 100%; } - .spinner { + .center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } + .center-content { + text-align: center; + } + .is-error { + font-size: 3rem; + color: #333; + } .content { padding: 0.5em; } -
+ +
+
+
{{error}}
+
Try another dashboard.
+
diff --git a/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.ts b/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.ts index 8614d16..f347268 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.ts +++ b/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.ts @@ -1,3 +1,4 @@ +import { HttpErrorResponse } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar'; @@ -15,6 +16,8 @@ export class DashboardComponent implements OnInit { dashboard?: Dashboard = undefined; + error = ""; + plotWidgetRenderData: PlotWidgetRenderData[] = []; constructor( @@ -25,7 +28,8 @@ export class DashboardComponent implements OnInit { private plotService: PlotService) {} ngOnInit(): void { - this.service.getDashboard(this.route.snapshot.paramMap.get("id")).subscribe((dashboard: Dashboard) => { + this.service.getDashboard(this.route.snapshot.paramMap.get("id")).subscribe({ + 'next':(dashboard: Dashboard) => { this.dashboard = dashboard; dashboard.plots.forEach(p => { @@ -33,7 +37,15 @@ export class DashboardComponent implements OnInit { }); this.loadImages(0, this.plotWidgetRenderData); - }); + }, + 'error': (error: HttpErrorResponse) =>{ + if (error.status == 404) { + this.error = "Not Found"; + }else{ + this.error = "Failed to load dashboard."; + } + } + }); } loadImages(index: number, plotWidgetQueue: PlotWidgetRenderData[]) {