Remove Index Task display
This commit is contained in:
parent
9979a1eba8
commit
755b650df5
2 changed files with 0 additions and 61 deletions
|
@ -7,14 +7,12 @@ import (
|
||||||
|
|
||||||
"git.lastassault.de/speatzle/morffix/constants"
|
"git.lastassault.de/speatzle/morffix/constants"
|
||||||
"git.lastassault.de/speatzle/morffix/types"
|
"git.lastassault.de/speatzle/morffix/types"
|
||||||
"github.com/jackc/pgx/v5"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type IndexData struct {
|
type IndexData struct {
|
||||||
Counter []int
|
Counter []int
|
||||||
|
|
||||||
Workers []IndexWorker
|
Workers []IndexWorker
|
||||||
Tasks []TaskDisplay
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type IndexWorker struct {
|
type IndexWorker struct {
|
||||||
|
@ -22,15 +20,6 @@ type IndexWorker struct {
|
||||||
Status *types.WorkerStatus
|
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) {
|
func handleIndex(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
data := IndexData{
|
data := IndexData{
|
||||||
|
@ -69,20 +58,6 @@ func handleIndex(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
data.Counter = splitInt(size)
|
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{}
|
buf := bytes.Buffer{}
|
||||||
err = templates.ExecuteTemplate(&buf, constants.INDEX_TEMPLATE_NAME, data)
|
err = templates.ExecuteTemplate(&buf, constants.INDEX_TEMPLATE_NAME, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -72,40 +72,4 @@
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<p>
|
|
||||||
<h2>Tasks</h2>
|
|
||||||
<div class="task-list">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>ID</th>
|
|
||||||
<th>Library</th>
|
|
||||||
<th>Worker</th>
|
|
||||||
<th>Type</th>
|
|
||||||
<th>Status</th>
|
|
||||||
<th>File</th>
|
|
||||||
</tr>
|
|
||||||
{{range $t := .Tasks}}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
{{ $t.ID }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ $t.Library }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ $t.Worker }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ $t.Type }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ $t.Status }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ $t.File }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{end}}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
{{template "tail"}}
|
{{template "tail"}}
|
Loading…
Add table
Reference in a new issue