clustvirt/view/cluster.templ

52 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

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>
}