show error message when loading dashboards failed
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user