feat: Sprint 1 final — delete host, Alpine modal events, grid/list toggle, transfers panel

This commit is contained in:
swanadiva
2026-07-07 13:17:31 +07:00
parent d771925727
commit 86620b034f
7 changed files with 94 additions and 30 deletions
+11
View File
@@ -57,6 +57,17 @@ func CreateHost(c *fiber.Ctx) error {
})
}
func DeleteHost(c *fiber.Ctx) error {
id := c.Params("id")
store.Delete(id)
hosts := store.All()
return c.Render("host_list", fiber.Map{
"Hosts": hosts,
"Active": countByStatus(hosts, "active"),
"Offline": countByStatus(hosts, "offline"),
})
}
func countByStatus(hosts []model.Host, status string) int {
n := 0
for _, h := range hosts {