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 cc5b8cd..4046d3a 100644 --- a/pdb-js/src/app/dashboard-page/dashboard-page.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard-page.component.html @@ -1,18 +1,27 @@ -
- -
-
+ +
-
+
+ {{error}} +
+ +
+
+ +
diff --git a/pdb-js/src/app/dashboard-page/dashboard-page.component.ts b/pdb-js/src/app/dashboard-page/dashboard-page.component.ts index 94fc0c6..b6aaaf9 100644 --- a/pdb-js/src/app/dashboard-page/dashboard-page.component.ts +++ b/pdb-js/src/app/dashboard-page/dashboard-page.component.ts @@ -13,6 +13,7 @@ export class DashboardPageComponent implements OnInit { displayedColumns: string[] = ['name', 'description']; dataSource: Dashboard[] = []; loading = true; + error = ""; constructor(public dialog: MatDialog, private dashboardService: DashboardService){ @@ -25,9 +26,15 @@ export class DashboardPageComponent implements OnInit { refreshTable(){ this.loading = true; - this.dashboardService.getDashboards().subscribe((dashboardList: DashboardList) => { - this.dataSource = dashboardList.dashboards; - this.loading = false; + this.dashboardService.getDashboards().subscribe({ + 'next':(dashboardList: DashboardList) => { + this.dataSource = dashboardList.dashboards; + this.loading = false; + }, + 'error': () => { + this.error = "Failed to load dashboards."; + this.loading = false; + } }); }