clustvirt/view/cluster.templ
Matthew Stobbs ed9acb7e10 clusterinfo is not htmx enabled
- modified host menu to include the cluster view
- whole site now works via htmx
- about page is still static
2024-03-23 11:34:50 -06:00

52 lines
1.1 KiB
Plaintext

package view
import (
"fmt"
"git.staur.ca/stobbsm/clustvirt/cluster"
)
templ ClusterInfo(c *cluster.Cluster) {
<h3>Cluster Stats</h3>
@ClusterStats(cluster.InitStats(c))
}
templ ClusterStats(cs *cluster.ClusterStats) {
@CPUStats(cs.CPU, cs.Diff().CPU)
}
templ CPUStats(stats cluster.CPUStats, diff cluster.CPUDiff) {
<table class={ "table-auto", "w-full", "text-right" }>
<caption class={ "caption-top" }>
CPU stats
</caption>
<thead>
<tr>
<th></th>
<th>Sockets</th>
<th>Cores</th>
<th>Threads</th>
<th>Allocated</th>
<th>MHz</th>
</tr>
</thead>
<tbody>
<tr>
<td>Latest</td>
<td>{ fmt.Sprint(stats.Sockets) }</td>
<td>{ fmt.Sprint(stats.Cores) }</td>
<td>{ fmt.Sprint(stats.Threads) }</td>
<td>{ fmt.Sprint(stats.Allocated) }</td>
<td>{ fmt.Sprint(stats.MHz) }</td>
</tr>
<tr>
<td>Change</td>
<td>{ fmt.Sprint(diff.Sockets) }</td>
<td>{ fmt.Sprint(diff.Cores) }</td>
<td>{ fmt.Sprint(diff.Threads) }</td>
<td>{ fmt.Sprint(diff.Allocated) }</td>
<td>{ fmt.Sprint(diff.MHz) }</td>
</tr>
</tbody>
</table>
}