Give every dashboard page its own URL and move add-forms into dialogs
CI / test (push) Successful in 7m15s
CI / test (push) Successful in 7m15s
Pages are served at /resources, /sites, /domains, /mail-egress, /alerts, /access, /logs, /apps, /account and /server/*, with working links, reloads and back button. Mail egress, alerts, access, users, organizations, SSO and DKIM follow the same header-button and dialog pattern as the other pages. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f204e71c9
commit
09f4f30984
3 files changed
+79
-16
No files matched your search
@@ -21,11 +21,22 @@ func page(html []byte) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// dashboardPaths are the addresses the dashboard shows pages at. They all serve the same app,
|
||||
// which reads the path to decide what to show. Keep in step with TAB_PATH in web/index.html.
|
||||
var dashboardPaths = map[string]bool{
|
||||
"/": true, "/apps": true, "/resources": true, "/sites": true, "/domains": true, "/mail-egress": true,
|
||||
"/alerts": true, "/access": true, "/logs": true, "/account": true,
|
||||
"/server/edges": true, "/server/organizations": true, "/server/users": true, "/server/sso": true,
|
||||
"/server/settings": true, "/server/alerts": true, "/server/audit": true,
|
||||
}
|
||||
|
||||
func isDashboardPath(p string) bool { return dashboardPaths[p] }
|
||||
|
||||
func (s *Server) Handler() http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
index := page(indexHTML)
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/" {
|
||||
if !isDashboardPath(r.URL.Path) {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user