fix(ui): Don't try to pass unserializable Go objects to status UI (#28)

Signed-off-by: Richard Palethorpe <io@richiejp.com>
This commit is contained in:
Richard Palethorpe
2025-04-14 15:09:42 +01:00
committed by GitHub
parent 601dba3fc4
commit 606ffd8275
2 changed files with 18 additions and 21 deletions

View File

@@ -4,6 +4,7 @@ import (
"crypto/subtle"
"embed"
"errors"
"fmt"
"math/rand"
"net/http"
"path/filepath"
@@ -238,9 +239,20 @@ func (app *App) registerRoutes(pool *state.AgentPool, webapp *fiber.App) {
history = &state.Status{ActionResults: []types.ActionState{}}
}
entries := []string{}
for _, h := range Reverse(history.Results()) {
entries = append(entries, fmt.Sprintf(
"Result: %v Action: %v Params: %v Reasoning: %v",
h.Result,
h.Action.Definition().Name,
h.Params,
h.Reasoning,
))
}
return c.JSON(fiber.Map{
"Name": c.Params("name"),
"History": Reverse(history.Results()),
"History": entries,
})
})