feat(web): console pages for monitors, incidents and notification channels
The dashboard lists monitors with status, latency and 24-hour uptime bars rendered as SVG on the server; monitor pages add 90-day uptime, latency and recent checks; an editor shows the settings of the selected check type. Closes #17 Closes #19 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
9a050ea712
commit
b831478143
18 files changed
+4268
-323
No files matched your search
+5
-17
@@ -2,6 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
@@ -23,7 +24,7 @@ func (s *Server) registerPages(r gin.IRouter) {
|
||||
r.GET("/login", s.loginPage)
|
||||
r.GET("/signup", s.signupPage)
|
||||
r.GET("/invite/:token", s.invitePage)
|
||||
r.GET("/", s.page("console.monitors.title", web.Dashboard))
|
||||
s.registerConsole(r)
|
||||
r.GET("/settings/security", s.securityPage)
|
||||
r.GET("/settings/sso", s.orgPage("sso.settings.title", authz.OrgManage, s.ssoSettingsView))
|
||||
r.GET("/settings/org", s.orgPage("org.title", authz.OrgManage, s.orgSettingsView))
|
||||
@@ -127,22 +128,6 @@ func (s *Server) consoleMe(c *gin.Context, sess *auth.Session) (web.Me, *princip
|
||||
return me, p, nil
|
||||
}
|
||||
|
||||
func (s *Server) page(titleID string, view func(web.Page, web.Me) templ.Component) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
sess := auth.Current(c)
|
||||
if sess == nil {
|
||||
c.Redirect(http.StatusSeeOther, "/login?next="+c.Request.URL.Path)
|
||||
return
|
||||
}
|
||||
me, _, err := s.consoleMe(c, sess)
|
||||
if err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
}
|
||||
web.Render(c, http.StatusOK, view(s.pageFor(c, titleID), me))
|
||||
}
|
||||
}
|
||||
|
||||
type orgPageView func(c *gin.Context, p *principal, page web.Page, me web.Me) (templ.Component, error)
|
||||
|
||||
// orgPage renders an organization settings page. perm may be empty for
|
||||
@@ -171,6 +156,9 @@ func (s *Server) orgPage(titleID string, perm authz.Permission, view orgPageView
|
||||
return
|
||||
}
|
||||
comp, err := view(c, p, s.pageFor(c, titleID), me)
|
||||
if errors.Is(err, errAborted) {
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
internalError(c, err)
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user