clustvirt/view/cluster.templ
Matthew Stobbs 8e62f7e271 merge migrate_to_libvirtxml
completed migration to libvirtxml
2024-03-23 22:05:06 -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>
}