2024-03-19 15:13:44 +00:00
|
|
|
package view
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"git.staur.ca/stobbsm/clustvirt/cluster"
|
|
|
|
"git.staur.ca/stobbsm/clustvirt/view/components"
|
|
|
|
"git.staur.ca/stobbsm/clustvirt/view/layouts"
|
|
|
|
)
|
|
|
|
|
|
|
|
templ ClusterInfo(cs *cluster.ClusterStats, diff cluster.StatDiff, navbar []components.NavItem) {
|
|
|
|
@layouts.Manager("ClustVirt", "Cluster Manager", navbar) {
|
|
|
|
<h3>Cluster Stats</h3>
|
2024-03-21 17:15:23 +00:00
|
|
|
@CPUStats(cs, diff)
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
|
|
|
}
|
2024-03-19 21:25:57 +00:00
|
|
|
|
2024-03-21 17:15:23 +00:00
|
|
|
templ CPUStats(cs *cluster.ClusterStats, diff cluster.StatDiff) {
|
2024-03-19 21:25:57 +00:00
|
|
|
<table class={ "table-auto", "w-full" }>
|
|
|
|
<caption class={ "caption-top" }>
|
|
|
|
CPU stats
|
|
|
|
</caption>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<th>Sockets</th>
|
|
|
|
<th>Cores</th>
|
|
|
|
<th>Threads</th>
|
|
|
|
<th>Allocated</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Latest
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{ fmt.Sprint(cs.CPU.Sockets) }
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{ fmt.Sprint(cs.CPU.Cores) }
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{ fmt.Sprint(cs.CPU.Threads) }
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{ fmt.Sprint(cs.CPU.Allocated) }
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
Change
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{ fmt.Sprint(diff.CPU.Sockets) }
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{ fmt.Sprint(diff.CPU.Cores) }
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{ fmt.Sprint(diff.CPU.Threads) }
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{ fmt.Sprint(diff.CPU.Allocated) }
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
}
|