generated from CubeCraft-Creations/Tracehound
CUB-176: central hub frontend — camera grid, start/stop controls, history viewer
- CameraCard: color-coded status (green/yellow/red), per-camera start/stop, battery bar, recording indicator - HistoryViewer: modal dialog with 24h status log browsing per camera - App: responsive grid (1-4 cols), Start/Stop All global buttons, SSE connection badge, live stats strip - API service: aligned with backend endpoints (list, detail, start, stop) - Types: added StatusLog, CameraDetail, CameraInfo, StartStopResponse - All 23 tests pass, lint clean, TypeScript + Vite build clean
This commit is contained in:
@@ -21,6 +21,42 @@ export interface SSEEvent {
|
||||
payload?: unknown
|
||||
}
|
||||
|
||||
/** A single status log entry from GET /api/v1/cameras/{id} */
|
||||
export interface StatusLog {
|
||||
id: number
|
||||
camera_id: string
|
||||
recorded_at: string
|
||||
battery_pct: number | null
|
||||
video_remaining_sec: number | null
|
||||
recording_state: number // 0 or 1 (SQLite bool)
|
||||
mode: string
|
||||
resolution: string
|
||||
fps: number
|
||||
online: number // 0 or 1
|
||||
raw_battery_pct: number | null
|
||||
}
|
||||
|
||||
/** Camera detail response from GET /api/v1/cameras/{id} */
|
||||
export interface CameraDetail {
|
||||
camera: CameraInfo
|
||||
last_status: StatusLog
|
||||
history: StatusLog[]
|
||||
}
|
||||
|
||||
export interface CameraInfo {
|
||||
CameraID: string
|
||||
FriendlyName: string
|
||||
MacAddress: string | null
|
||||
CreatedAt: string
|
||||
UpdatedAt: string
|
||||
}
|
||||
|
||||
/** Generic API responses */
|
||||
export interface StartStopResponse {
|
||||
status: string
|
||||
camera_id: string
|
||||
}
|
||||
|
||||
export interface Camera {
|
||||
id: string
|
||||
name: string
|
||||
|
||||
Reference in New Issue
Block a user