add a page for tickets from gitea
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"ridgwaysystems.org/website/internal/blog"
|
||||
"ridgwaysystems.org/website/internal/changelog"
|
||||
"ridgwaysystems.org/website/internal/feed"
|
||||
"ridgwaysystems.org/website/internal/gitea"
|
||||
"ridgwaysystems.org/website/internal/mailer"
|
||||
"ridgwaysystems.org/website/internal/status"
|
||||
"ridgwaysystems.org/website/internal/uptime"
|
||||
@@ -166,9 +167,10 @@ type serviceHistory struct {
|
||||
|
||||
// statusData is passed to the status template.
|
||||
type statusData struct {
|
||||
Page *status.Page
|
||||
LastChecked string
|
||||
History map[string]serviceHistory // keyed by service name
|
||||
Page *status.Page
|
||||
LastChecked string
|
||||
History map[string]serviceHistory // keyed by service name
|
||||
PlannedOutages []gitea.Issue
|
||||
}
|
||||
|
||||
func (h *Handler) Status(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -188,7 +190,17 @@ func (h *Handler) Status(w http.ResponseWriter, r *http.Request) {
|
||||
UptimePct: uptime.UptimePct(uptimePath, svc.Name),
|
||||
}
|
||||
}
|
||||
h.render(w, "status", statusData{Page: p, LastChecked: lastChecked, History: history})
|
||||
// Fetch planned outages from Gitea — best-effort, failure is non-fatal.
|
||||
var plannedOutages []gitea.Issue
|
||||
if h.gitea != nil && h.giteaOwner != "" && h.giteaRepo != "" {
|
||||
if issues, err := h.gitea.ListIssuesByLabel(h.giteaOwner, h.giteaRepo, h.giteaLabel); err == nil {
|
||||
plannedOutages = issues
|
||||
} else {
|
||||
log.Printf("status: gitea planned outages: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
h.render(w, "status", statusData{Page: p, LastChecked: lastChecked, History: history, PlannedOutages: plannedOutages})
|
||||
}
|
||||
|
||||
// changelogData is passed to the changelog template.
|
||||
|
||||
Reference in New Issue
Block a user