Files
Adrian Zürcher 9f262c4a55
All checks were successful
Build Process Supervisor / build (amd64, .exe, windows) (push) Successful in 2m24s
Build Process Supervisor / build (amd64, , linux) (push) Successful in 2m36s
Build Process Supervisor / build (arm, 6, , linux) (push) Successful in 2m19s
Build Process Supervisor / build (arm64, , linux) (push) Successful in 2m14s
more abstraction and simple dashboard for processes
2025-08-06 13:57:34 +02:00

74 lines
2.7 KiB
HTML

<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 {{.Cmd}} process?">
Kill
</button>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>