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
@@ -0,0 +1,34 @@
|
||||
package hammerhead
|
||||
|
||||
import (
|
||||
"os"
|
||||
"regexp"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Every address the dashboard JavaScript navigates to must be served by the server, or a
|
||||
// reload on that page would 404.
|
||||
func TestDashboardPathsMatchThePage(t *testing.T) {
|
||||
src, err := os.ReadFile("web/index.html")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
m := regexp.MustCompile(`TAB_PATH = \{([^}]*)\}`).FindSubmatch(src)
|
||||
if m == nil {
|
||||
t.Fatal("TAB_PATH not found in web/index.html")
|
||||
}
|
||||
paths := regexp.MustCompile(`'(/[a-z/-]+)'`).FindAllSubmatch(m[1], -1)
|
||||
if len(paths) < 10 {
|
||||
t.Fatalf("found only %d page paths", len(paths))
|
||||
}
|
||||
for _, p := range paths {
|
||||
if !isDashboardPath(string(p[1])) {
|
||||
t.Errorf("%s is a dashboard page but the server doesn't serve it", p[1])
|
||||
}
|
||||
}
|
||||
for _, p := range []string{"/api/me", "/nope", "/server", "/server/nope"} {
|
||||
if isDashboardPath(p) {
|
||||
t.Errorf("%s should not serve the dashboard", p)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user