show error message when dashboard cannot be loaded
This commit is contained in:
@@ -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(<string>this.route.snapshot.paramMap.get("id")).subscribe((dashboard: Dashboard) => {
|
||||
this.service.getDashboard(<string>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[]) {
|
||||
|
||||
Reference in New Issue
Block a user