diff --git a/server/index.go b/server/index.go index f9a7907..b736a00 100644 --- a/server/index.go +++ b/server/index.go @@ -7,14 +7,12 @@ import ( "git.lastassault.de/speatzle/morffix/constants" "git.lastassault.de/speatzle/morffix/types" - "github.com/jackc/pgx/v5" ) type IndexData struct { Counter []int Workers []IndexWorker - Tasks []TaskDisplay } type IndexWorker struct { @@ -22,15 +20,6 @@ type IndexWorker struct { Status *types.WorkerStatus } -type TaskDisplay struct { - ID int `db:"id"` - Library int `db:"library"` - Worker *string `db:"worker"` - Type int `db:"type"` - Status int `db:"status"` - File string `db:"file"` -} - func handleIndex(w http.ResponseWriter, r *http.Request) { data := IndexData{ @@ -69,20 +58,6 @@ func handleIndex(w http.ResponseWriter, r *http.Request) { } data.Counter = splitInt(size) - rows, err := db.Query(r.Context(), "SELECT t.id AS id, l.id AS library, t.worker_id AS worker, t.type AS type, t.status AS status, f.path AS file FROM tasks t INNER JOIN files f ON f.id = t.file_id INNER JOIN libraries l ON l.id = f.library_id") - if err != nil { - slog.ErrorContext(r.Context(), "Query Tasks", "err", err) - http.Error(w, "Error Query Tasks: "+err.Error(), http.StatusInternalServerError) - return - } - 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) - return - } - data.Tasks = tasks - buf := bytes.Buffer{} err = templates.ExecuteTemplate(&buf, constants.INDEX_TEMPLATE_NAME, data) if err != nil { diff --git a/tmpl/index.tmpl b/tmpl/index.tmpl index 46049b7..644beba 100644 --- a/tmpl/index.tmpl +++ b/tmpl/index.tmpl @@ -72,40 +72,4 @@ {{end}} -
-
ID | -Library | -Worker | -Type | -Status | -File | -
---|---|---|---|---|---|
- {{ $t.ID }} - | -- {{ $t.Library }} - | -- {{ $t.Worker }} - | -- {{ $t.Type }} - | -- {{ $t.Status }} - | -- {{ $t.File }} - | -