borgmatic-monitor/pkg/web/hosts.go

31 lines
531 B
Go

package web
import (
"net/http"
"github.com/labstack/echo/v5"
"gitnet.fr/deblan/borgmatic-monitor/pkg/database"
"gitnet.fr/deblan/borgmatic-monitor/pkg/web/partial"
. "maragu.dev/gomponents"
. "maragu.dev/gomponents/html"
)
func Hosts(c *echo.Context) error {
var nodes []Node
for _, host := range database.Hosts() {
nodes = append(nodes, partial.Host(host))
}
return c.HTML(http.StatusOK, Page(
"home",
"Hosts",
Div(
Class("container-fluid"),
Div(
Class("row"),
Group(nodes),
),
),
))
}