71 lines
2.6 KiB
HTML
71 lines
2.6 KiB
HTML
<div id="process-table" class="card">
|
|
<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="outerHTML">
|
|
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="outerHTML">
|
|
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="outerHTML">
|
|
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="outerHTML">
|
|
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="outerHTML">
|
|
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>
|