chore(ui): Move some field definitions server side

This commit is contained in:
Richard Palethorpe
2025-03-26 15:56:14 +00:00
parent 7fb99ecf21
commit 319caf8e91
62 changed files with 1534 additions and 1574 deletions

View File

@@ -171,6 +171,9 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
// New API endpoints for getting and updating agent configuration
webapp.Get("/api/agent/:name/config", app.GetAgentConfig(pool))
webapp.Put("/api/agent/:name/config", app.UpdateAgentConfig(pool))
// Metadata endpoint for agent configuration fields
webapp.Get("/api/agent/config/metadata", app.GetAgentConfigMeta())
webapp.Post("/action/:name/run", app.ExecuteAction(pool))
webapp.Get("/actions", app.ListActions())
@@ -190,13 +193,13 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
}
statuses[a] = !agent.Paused()
}
return c.JSON(fiber.Map{
"Agents": agents,
"Agents": agents,
"AgentCount": len(agents),
"Actions": len(services.AvailableActions),
"Actions": len(services.AvailableActions),
"Connectors": len(services.AvailableConnectors),
"Status": statuses,
"Status": statuses,
})
})
@@ -206,9 +209,9 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
if history == nil {
history = &state.Status{ActionResults: []types.ActionState{}}
}
return c.JSON(fiber.Map{
"Name": c.Params("name"),
"Name": c.Params("name"),
"History": Reverse(history.Results()),
})
})