feat: Host CRUD complete — edit, full form fields, connect, toast

- Add UpdateHost handler + PUT /hosts/:id route
- CreateHost now accepts all fields (port, username, auth, notes)
- host_modal.html: full form with port, username, auth type toggle, edit mode
- host_list.html: edit button dispatches edit-host event with host data
- Connect button links to /terminal?host={id} for pre-selection
- Terminal page reads selected host from query param
- Toast notification system via Alpine.js events
- Add default template function for fallback values
This commit is contained in:
swanadiva
2026-07-07 15:51:57 +07:00
parent 3df8416d9b
commit 301115b74d
8 changed files with 285 additions and 58 deletions
+7
View File
@@ -44,6 +44,12 @@ func main() {
}
return m
})
engine.AddFunc("default", func(def, val interface{}) interface{} {
if val == nil || val == "" {
return def
}
return val
})
app := fiber.New(fiber.Config{
Views: engine,
@@ -57,6 +63,7 @@ func main() {
app.Get("/", handler.Dashboard)
app.Get("/hosts", handler.DashboardList)
app.Post("/hosts", handler.CreateHost)
app.Put("/hosts/:id", handler.UpdateHost)
app.Delete("/hosts/:id", handler.DeleteHost)
app.Get("/snippets", handler.Snippets)
app.Get("/snippets/grid", handler.SnippetGrid)