improve error messages
This commit is contained in:
@@ -5,6 +5,9 @@
|
|||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
|
.center-content {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
.is-error {
|
.is-error {
|
||||||
font-size: 3rem;
|
font-size: 3rem;
|
||||||
color: #333;
|
color: #333;
|
||||||
@@ -14,10 +17,9 @@
|
|||||||
<div *ngIf="loading" class="center">
|
<div *ngIf="loading" class="center">
|
||||||
<mat-spinner></mat-spinner>
|
<mat-spinner></mat-spinner>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="error" class="center is-error">
|
<div *ngIf="error" class="center is-error .center-content">
|
||||||
{{error}}
|
{{error}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="!loading && !error">
|
<div *ngIf="!loading && !error">
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<button mat-button (click)="createNewDashboard()">New</button>
|
<button mat-button (click)="createNewDashboard()">New</button>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { Dashboard, DashboardCreationData, DashboardList, DashboardService } from '../dashboard.service';
|
import { Dashboard, DashboardCreationData, DashboardList, DashboardService } from '../dashboard.service';
|
||||||
@@ -31,8 +32,12 @@ export class DashboardPageComponent implements OnInit {
|
|||||||
this.dataSource = dashboardList.dashboards;
|
this.dataSource = dashboardList.dashboards;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
'error': () => {
|
'error': (error: HttpErrorResponse) => {
|
||||||
this.error = "Failed to load dashboards.";
|
if (error.status == 504){
|
||||||
|
this.error = "Server Unreachable";
|
||||||
|
}else{
|
||||||
|
this.error = "Failed to load dashboards";
|
||||||
|
}
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -41,8 +41,10 @@ export class DashboardComponent implements OnInit {
|
|||||||
'error': (error: HttpErrorResponse) =>{
|
'error': (error: HttpErrorResponse) =>{
|
||||||
if (error.status == 404) {
|
if (error.status == 404) {
|
||||||
this.error = "Not Found";
|
this.error = "Not Found";
|
||||||
|
}else if (error.status == 504) { // gateway timeout
|
||||||
|
this.error = "Server Unreachable";
|
||||||
}else{
|
}else{
|
||||||
this.error = "Failed to load dashboard.";
|
this.error = "Failed to load dashboard";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user