feat: Stage 3 — alert detail, acknowledge, comments, stats charts

Press enter on any alert to open a full-screen detail pane (viewport).
Keybindings in detail mode:
  a/A   acknowledge / unacknowledge (updates immediately)
  c     compose a comment (text input at bottom)
  [/]   cycle comment cursor up/down
  d     delete selected comment (y/N confirmation)
  s     assign placeholder — shows "not yet supported by server"
  S     open stats view: top alerts + by-hour/by-day ASCII bar charts
  esc   back to dashboard

API additions: GetAlert, AcknowledgeAlert, UnacknowledgeAlert,
GetComments, AddComment, DeleteComment, GetTopAlerts,
GetStatsByHour, GetStatsByDay.
This commit is contained in:
Niklas Ye
2026-05-21 13:48:01 +02:00
parent e29cff21ae
commit b5ee62f145
7 changed files with 825 additions and 36 deletions
+25
View File
@@ -23,3 +23,28 @@ type AlertStats struct {
Firing int `json:"firing"`
Resolved int `json:"resolved"`
}
type Comment struct {
ID int64 `json:"id"`
AlertID int64 `json:"alert_id"`
UserID int64 `json:"user_id"`
Username string `json:"username"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
}
type TopAlert struct {
Name string `json:"name"`
Count int `json:"count"`
}
type HourStat struct {
Hour int `json:"hour"`
Count int `json:"count"`
}
type DayStat struct {
Day int `json:"day"`
DayName string `json:"day_name"`
Count int `json:"count"`
}