dashboard #1

Merged
andi merged 118 commits from dashboard into master 2024-09-29 06:47:35 +00:00
3 changed files with 14 additions and 5 deletions
Showing only changes of commit a8cd94f47e - Show all commits

View File

@@ -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>

View File

@@ -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;
} }
}); });

View File

@@ -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";
} }
} }
}); });