clustvirt/view/cluster.templ
Matthew Stobbs de93204e3d migrate data gathering to libvirtxml parsing
- instead of getting all the data the hard way, use libvirtxml
  to parse the XML from libvirt
- this makes it more accurate, and more future proof when schema
  changes occur
- add pcidb to query devices better
2024-03-19 15:25:57 -06:00

68 lines
1.2 KiB
Plaintext

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>
}
}
templ CPUStats() {
<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>
}