add tests
This commit is contained in:
65
apps/website/lib/view-data/HealthViewData.ts
Normal file
65
apps/website/lib/view-data/HealthViewData.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Health View Data Types
|
||||
*
|
||||
* Defines the UI model for health monitoring data.
|
||||
* This layer isolates the UI from API churn by providing a stable interface
|
||||
* between the API layer and the presentation layer.
|
||||
*/
|
||||
|
||||
export interface HealthStatus {
|
||||
status: 'ok' | 'degraded' | 'error' | 'unknown';
|
||||
timestamp: string;
|
||||
formattedTimestamp: string;
|
||||
relativeTime: string;
|
||||
statusLabel: string;
|
||||
statusColor: string;
|
||||
statusIcon: string;
|
||||
}
|
||||
|
||||
export interface HealthMetrics {
|
||||
uptime: string;
|
||||
responseTime: string;
|
||||
errorRate: string;
|
||||
lastCheck: string;
|
||||
formattedLastCheck: string;
|
||||
checksPassed: number;
|
||||
checksFailed: number;
|
||||
totalChecks: number;
|
||||
successRate: string;
|
||||
}
|
||||
|
||||
export interface HealthComponent {
|
||||
name: string;
|
||||
status: 'ok' | 'degraded' | 'error' | 'unknown';
|
||||
statusLabel: string;
|
||||
statusColor: string;
|
||||
statusIcon: string;
|
||||
lastCheck: string;
|
||||
formattedLastCheck: string;
|
||||
responseTime: string;
|
||||
errorRate: string;
|
||||
}
|
||||
|
||||
export interface HealthAlert {
|
||||
id: string;
|
||||
type: 'critical' | 'warning' | 'info';
|
||||
title: string;
|
||||
message: string;
|
||||
timestamp: string;
|
||||
formattedTimestamp: string;
|
||||
relativeTime: string;
|
||||
severity: string;
|
||||
severityColor: string;
|
||||
}
|
||||
|
||||
export interface HealthViewData {
|
||||
overallStatus: HealthStatus;
|
||||
metrics: HealthMetrics;
|
||||
components: HealthComponent[];
|
||||
alerts: HealthAlert[];
|
||||
hasAlerts: boolean;
|
||||
hasDegradedComponents: boolean;
|
||||
hasErrorComponents: boolean;
|
||||
lastUpdated: string;
|
||||
formattedLastUpdated: string;
|
||||
}
|
||||
Reference in New Issue
Block a user