2024-03-19 15:13:44 +00:00
|
|
|
package view
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"git.staur.ca/stobbsm/clustvirt/cluster"
|
|
|
|
)
|
|
|
|
|
2024-03-24 04:05:06 +00:00
|
|
|
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>
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|