diff --git a/node/bindata.go b/node/bindata.go index ac86f0623967bb58b1c988af2742561904c21b12..53a610a20f1c46a298f058accb9a74bf66317ffe 100644 --- a/node/bindata.go +++ b/node/bindata.go @@ -303,7 +303,7 @@ var _templatesIndexHtml = []byte(`<!DOCTYPE html> {{range .Nodes}} <li> {{.Name}} <span class="badge">{{.NumListeners}}</span> - {{if not .IcecastUp}}<span class="label label-danger">IC_DOWN</span>{{end}} + {{if not .IcecastOk}}<span class="label label-danger">IC_DOWN</span>{{end}} </li> {{end}} </ul> @@ -339,7 +339,7 @@ func templatesIndexHtml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "templates/index.html", size: 2567, mode: os.FileMode(420), modTime: time.Unix(1555111991, 0)} + info := bindataFileInfo{name: "templates/index.html", size: 2567, mode: os.FileMode(420), modTime: time.Unix(1555112385, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/node/http.go b/node/http.go index 97a7dc6ae8a2553eea3e5c202c7bbadc7a1abe47..e61ade96b25405a810577c9c51f21046b1618ae6 100644 --- a/node/http.go +++ b/node/http.go @@ -183,13 +183,19 @@ func sendRedirect(w http.ResponseWriter, r *http.Request, targetURL string) { } func serveStatusPage(n *Node, w http.ResponseWriter, r *http.Request, tpl *template.Template, domain string) { + // Convert the list of nodes to just the status. nodes := n.lb.getNodes() + statuses := make([]*pb.Status, 0, len(nodes)) + for _, ni := range nodes { + statuses = append(statuses, ni.status) + } + ms := mountsToStatus(n.mounts.GetMounts(), nodes) ctx := struct { Domain string - Nodes []*nodeInfo + Nodes []*pb.Status Mounts []*mountStatus - }{domain, nodes, ms} + }{domain, statuses, ms} var buf bytes.Buffer if err := tpl.ExecuteTemplate(&buf, "index.html", ctx); err != nil { diff --git a/node/node_test.go b/node/node_test.go index a218b7515aa52c176e0c449be359fbe3c69df3e0..14ea7aed97144c18ef859980430cfb2a222a253d 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -121,6 +121,10 @@ func TestNode_StatusPage(t *testing.T) { } httpSrv := httptest.NewServer(newHTTPHandler(n, 8080, "example.com")) + defer httpSrv.Close() + + // Give the Node time to gather its status. + time.Sleep(1 * time.Second) resp, err := http.Get(httpSrv.URL) if err != nil { diff --git a/node/templates/index.html b/node/templates/index.html index cfcd9052304a2803b2fe1b7af3e02fea8d171e67..d1839167c5590bdfef78967da0845ab368986166 100644 --- a/node/templates/index.html +++ b/node/templates/index.html @@ -56,7 +56,7 @@ {{range .Nodes}} <li> {{.Name}} <span class="badge">{{.NumListeners}}</span> - {{if not .IcecastUp}}<span class="label label-danger">IC_DOWN</span>{{end}} + {{if not .IcecastOk}}<span class="label label-danger">IC_DOWN</span>{{end}} </li> {{end}} </ul>