Files
HeatGuard/internal/report/data.go
vikingowl 1c9db02334 feat: add web UI with full CRUD setup page
Add server-side rendered setup UI accessible via `heatwave web`.
The dashboard is now re-rendered per request and includes a nav bar
linking to the new /setup page. Setup provides full CRUD for profiles,
rooms, devices, occupants, AC units (with room assignment), scenario
toggles, and forecast fetching — all via POST/redirect/GET forms.

- Add ShowNav field to DashboardData for conditional nav bar
- Extract fetchForecastForProfile() for reuse by web handler
- Create setup.html.tmpl with Tailwind-styled entity sections
- Create web_handlers.go with 15 route handlers and flash cookies
- Switch web.go from pre-rendered to per-request dashboard rendering
- Graceful dashboard fallback when no forecast data exists
2026-02-09 10:39:00 +01:00

74 lines
1.6 KiB
Go

package report
import "time"
// DashboardData holds all data needed to render the HTML report.
type DashboardData struct {
GeneratedAt time.Time
ProfileName string
Date string
ShowNav bool
Warnings []WarningData
RiskLevel string
PeakTempC float64
MinNightTempC float64
PoorNightCool bool
RiskWindows []RiskWindowData
Timeline []TimelineSlotData
RoomBudgets []RoomBudgetData
CareChecklist []string
LLMSummary string
LLMDisclaimer string
}
// WarningData holds a weather warning for display.
type WarningData struct {
Headline string
Severity string
Description string
Instruction string
Onset string
Expires string
}
// RiskWindowData holds a risk window for display.
type RiskWindowData struct {
StartHour int
EndHour int
PeakTempC float64
Level string
Reason string
}
// TimelineSlotData holds one hour's data for the timeline.
type TimelineSlotData struct {
Hour int
HourStr string
TempC float64
RiskLevel string
BudgetStatus string
Actions []ActionData
}
// ActionData holds a single action for display.
type ActionData struct {
Name string
Category string
Effort string
Impact string
Description string
}
// RoomBudgetData holds a room's heat budget for display.
type RoomBudgetData struct {
RoomName string
InternalGainsW float64
SolarGainW float64
VentGainW float64
TotalGainW float64
TotalGainBTUH float64
ACCapacityBTUH float64
HeadroomBTUH float64
Status string
}