feat(ui): Add status page to react frontend

This commit is contained in:
Richard Palethorpe
2025-03-25 15:14:02 +00:00
parent 3e1081fc6e
commit 074aefd0df
4 changed files with 305 additions and 20 deletions

View File

@@ -200,6 +200,19 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
})
})
// API endpoint for agent status history
webapp.Get("/api/agent/:name/status", func(c *fiber.Ctx) error {
history := pool.GetStatusHistory(c.Params("name"))
if history == nil {
history = &state.Status{ActionResults: []types.ActionState{}}
}
return c.JSON(fiber.Map{
"Name": c.Params("name"),
"History": Reverse(history.Results()),
})
})
webapp.Post("/settings/import", app.ImportAgent(pool))
webapp.Get("/settings/export/:name", app.ExportAgent(pool))