Task Log display

This commit is contained in:
Samuel Lorch 2024-05-09 04:49:46 +02:00
parent f31fdfd3b5
commit 7a0564a210
4 changed files with 143 additions and 12 deletions

View file

@ -14,7 +14,7 @@ type IndexData struct {
Counter []int
Workers []IndexWorker
Tasks []Task
Tasks []TaskDisplay
}
type IndexWorker struct {
@ -22,7 +22,7 @@ type IndexWorker struct {
Status *types.WorkerStatus
}
type Task struct {
type TaskDisplay struct {
ID int `db:"id"`
Library int `db:"library"`
Worker *string `db:"worker"`
@ -75,7 +75,7 @@ func handleIndex(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Error Query Tasks: "+err.Error(), http.StatusInternalServerError)
return
}
tasks, err := pgx.CollectRows[Task](rows, pgx.RowToStructByName[Task])
tasks, err := pgx.CollectRows[TaskDisplay](rows, pgx.RowToStructByName[TaskDisplay])
if err != nil {
slog.ErrorContext(r.Context(), "Executing index Template", "err", err)
http.Error(w, "Error Query Tasks: "+err.Error(), http.StatusInternalServerError)