package view import ( "fmt" "git.staur.ca/stobbsm/clustvirt/lib/host" "git.staur.ca/stobbsm/clustvirt/view/components" "git.staur.ca/stobbsm/clustvirt/view/layouts" ) script memchart(used uint64, free uint64, buf uint64, cache uint64) { ctx = document.getElementById('memchart'); new Chart(ctx, { type: 'pie', data: { labels: [ 'Used', 'Free', 'Cached', 'Buffered' ], datasets: [{ label: 'Memory Usage', data: [ used, free, cache, buf, ], backgroundColor: [ 'rgb(255,0,0)', 'rgb(0,255,0)', 'rgb(128,128,0)', 'rgb(0,0,255)' ], hoverOffset: 4 }], } }); } // MemChart get's the memory pi chart from the host templ MemChart(h *host.Host) {
@memchart(h.NodeMemory.Total-h.NodeMemory.Free-h.NodeMemory.Buffers-h.NodeMemory.Cached, h.NodeMemory.Free, h.NodeMemory.Buffers, h.NodeMemory.Cached) } templ hostButton(hostname string) { } // HostConnect is the page that allows us to select a host to get information from templ HostMain(navBarItems []components.NavItem) { @layouts.Manager("ClustVirt", "Cluster Manager", navBarItems) {

This is where you can see a system overview of all available hosts

For now, there is just this simple box to choose a host to connect to and push the button to load the system information via HTMX

} } // HostInfo is meant to be an HTMX response templ HostInfo(h *host.Host) {

{ h.HostName }

@SysInfo(h)
} templ SysInfo(h *host.Host) { @MemChart(h) }