first running version
Some checks failed
Build Process Supervisor / build (push) Failing after 1s

This commit is contained in:
Adrian Zürcher
2025-08-05 12:01:59 +02:00
parent 5712929f23
commit b9efeb670d
12 changed files with 365 additions and 92 deletions

74
templates/htop/table.html Normal file
View File

@@ -0,0 +1,74 @@
<div id="process-table" class="card"
hx-get="/taskmanager/htop?sort={{.CurrentSort}}&order={{.CurrentOrder}}"
hx-trigger="every 2s"
hx-target="#process-table"
hx-swap="innerHTML">
<table >
<thead>
<tr>
<th>
<a hx-get="/taskmanager/htop?sort=pid&order={{if and (eq .CurrentSort "pid") (eq .CurrentOrder "asc")}}desc{{else}}asc{{end}}"
hx-target="#process-table"
hx-swap="innerHTML">
PID {{if eq .CurrentSort "pid"}}{{if eq .CurrentOrder "asc"}}↑{{else}}↓{{end}}{{end}}
</a>
</th>
<th>
<a hx-get="/taskmanager/htop?sort=user&order={{if and (eq .CurrentSort "user") (eq .CurrentOrder "asc")}}desc{{else}}asc{{end}}"
hx-target="#process-table"
hx-swap="innerHTML">
User {{if eq .CurrentSort "user"}}{{if eq .CurrentOrder "asc"}}↑{{else}}↓{{end}}{{end}}
</a>
</th>
<th>
<a hx-get="/taskmanager/htop?sort=cmd&order={{if and (eq .CurrentSort "cmd") (eq .CurrentOrder "asc")}}desc{{else}}asc{{end}}"
hx-target="#process-table"
hx-swap="innerHTML">
Command {{if eq .CurrentSort "cmd"}}{{if eq .CurrentOrder "asc"}}↑{{else}}↓{{end}}{{end}}
</a>
</th>
<th>
<a hx-get="/taskmanager/htop?sort=cpu&order={{if and (eq .CurrentSort "cpu") (eq .CurrentOrder "asc")}}desc{{else}}asc{{end}}"
hx-target="#process-table"
hx-swap="innerHTML">
CPU %{{if eq .CurrentSort "cpu"}}{{if eq .CurrentOrder "asc"}}↑{{else}}↓{{end}}{{end}}
</a>
</th>
<th>
<a hx-get="/taskmanager/htop?sort=memory&order={{if and (eq .CurrentSort "memory") (eq .CurrentOrder "asc")}}desc{{else}}asc{{end}}"
hx-target="#process-table"
hx-swap="innerHTML">
Memory {{if eq .CurrentSort "memory"}}{{if eq .CurrentOrder "asc"}}↑{{else}}↓{{end}}{{end}}
</a>
</th>
<th>Kill</th>
</tr>
</thead>
<tbody>
{{range .Processes}}
<tr>
<td class="pid">{{.PID}}</td>
<td class="user">{{.User}}</td>
<td class="cmd">{{.Cmd}}</td>
<td class="cpu">{{printf "%.2f" .CPU}}</td>
<td class="mem">
{{if ge .Memory 1073741824}}
{{printf "%.2f GB" (div .Memory 1073741824)}}
{{else}}
{{printf "%.0f MB" (div .Memory 1048576)}}
{{end}}
</td>
<td class="kill">
<button
hx-get="/taskmanager/kill?pid={{.PID}}"
hx-target="#process-table"
hx-swap="outerHTML"
hx-confirm="Are you sure you want to kill this process?">
Kill
</button>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>