2024-03-19 15:13:44 +00:00
|
|
|
// Code generated by templ - DO NOT EDIT.
|
|
|
|
|
2024-03-23 17:34:50 +00:00
|
|
|
// templ: version: v0.2.646
|
2024-03-19 15:13:44 +00:00
|
|
|
package view
|
|
|
|
|
|
|
|
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
|
|
|
|
|
|
|
import "github.com/a-h/templ"
|
|
|
|
import "context"
|
|
|
|
import "io"
|
|
|
|
import "bytes"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"git.staur.ca/stobbsm/clustvirt/lib/host"
|
|
|
|
)
|
|
|
|
|
|
|
|
func memchart(used uint64, free uint64, buf uint64, cache uint64) templ.ComponentScript {
|
|
|
|
return templ.ComponentScript{
|
|
|
|
Name: `__templ_memchart_9d4c`,
|
|
|
|
Function: `function __templ_memchart_9d4c(used, free, buf, cache){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
|
|
|
|
}],
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}`,
|
|
|
|
Call: templ.SafeScript(`__templ_memchart_9d4c`, used, free, buf, cache),
|
|
|
|
CallInline: templ.SafeScriptInline(`__templ_memchart_9d4c`, used, free, buf, cache),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// MemChart get's the memory pi chart from the host
|
|
|
|
func MemChart(h *host.Host) templ.Component {
|
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
|
|
|
if !templ_7745c5c3_IsBuffer {
|
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer()
|
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
|
|
}
|
|
|
|
ctx = templ.InitializeContext(ctx)
|
|
|
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
|
|
|
if templ_7745c5c3_Var1 == nil {
|
|
|
|
templ_7745c5c3_Var1 = templ.NopComponent
|
|
|
|
}
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
|
|
|
var templ_7745c5c3_Var2 = []any{"flex", "flex-row"}
|
|
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...)
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var3 string
|
|
|
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var2).String())
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-03-23 17:34:50 +00:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 1, Col: 0}
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
var templ_7745c5c3_Var4 = []any{"size-40", "md:size-80"}
|
|
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var4...)
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"")
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
var templ_7745c5c3_Var5 string
|
2024-03-23 17:34:50 +00:00
|
|
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var4).String())
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-03-23 17:34:50 +00:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 1, Col: 0}
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var6 = []any{"size-40", "md:size-80"}
|
|
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var6...)
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<canvas id=\"memchart\" class=\"")
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
var templ_7745c5c3_Var7 string
|
2024-03-23 17:34:50 +00:00
|
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var6).String())
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-03-23 17:34:50 +00:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 1, Col: 0}
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></canvas></div><ul><li>Free: <span id=\"memfree\">")
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
var templ_7745c5c3_Var8 string
|
2024-03-23 17:34:50 +00:00
|
|
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d Gi", h.NodeMemory.Free/1024/1024))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-03-23 17:34:50 +00:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 47, Col: 83}
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></li><li>Cached: <span id=\"memcach\">")
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var9 string
|
|
|
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d Gi", h.NodeMemory.Cached/1024/1024))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-03-23 17:34:50 +00:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 48, Col: 87}
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></li><li>Buffers: <span id=\"membuf\">")
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var10 string
|
|
|
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d Gi", h.NodeMemory.Buffers/1024/1024))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-03-23 17:34:50 +00:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 49, Col: 88}
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></li><li>Total: <span id=\"memtot\">")
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var11 string
|
|
|
|
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d Gi", h.NodeMemory.Total/1024/1024))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-03-23 17:34:50 +00:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 50, Col: 84}
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></li></ul></div>")
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
templ_7745c5c3_Err = memchart(h.NodeMemory.Total-h.NodeMemory.Free-h.NodeMemory.Buffers-h.NodeMemory.Cached, h.NodeMemory.Free,
|
|
|
|
h.NodeMemory.Buffers, h.NodeMemory.Cached).Render(ctx, templ_7745c5c3_Buffer)
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
if !templ_7745c5c3_IsBuffer {
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
|
|
|
}
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// HostConnect is the page that allows us to select a host to get information from
|
2024-03-23 17:34:50 +00:00
|
|
|
func HostMain() templ.Component {
|
2024-03-19 15:13:44 +00:00
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
|
|
|
if !templ_7745c5c3_IsBuffer {
|
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer()
|
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
|
|
}
|
|
|
|
ctx = templ.InitializeContext(ctx)
|
2024-03-23 17:34:50 +00:00
|
|
|
templ_7745c5c3_Var12 := templ.GetChildren(ctx)
|
|
|
|
if templ_7745c5c3_Var12 == nil {
|
|
|
|
templ_7745c5c3_Var12 = templ.NopComponent
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
|
|
|
if !templ_7745c5c3_IsBuffer {
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
|
|
|
}
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// HostInfo is meant to be an HTMX response
|
|
|
|
func HostInfo(h *host.Host) templ.Component {
|
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
|
|
|
if !templ_7745c5c3_IsBuffer {
|
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer()
|
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
|
|
}
|
|
|
|
ctx = templ.InitializeContext(ctx)
|
2024-03-23 17:34:50 +00:00
|
|
|
templ_7745c5c3_Var13 := templ.GetChildren(ctx)
|
|
|
|
if templ_7745c5c3_Var13 == nil {
|
|
|
|
templ_7745c5c3_Var13 = templ.NopComponent
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var14 = []any{"flex", "flex-col"}
|
|
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var14...)
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var15 string
|
|
|
|
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var14).String())
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 1, Col: 0}
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var16 = []any{"flex", "flex-row", "justify-start", "px-2"}
|
|
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var16...)
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var17 string
|
|
|
|
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var16).String())
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 1, Col: 0}
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"every 30s\" hx-get=\"")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var18 string
|
|
|
|
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("/htmx/host/%s/stats", h.HostName))
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 67, Col: 58}
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"#sysInfo\"><h3>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var19 string
|
|
|
|
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(h.HostName)
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-03-23 17:34:50 +00:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 70, Col: 19}
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h3>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var20 = []any{"h-6", "px-2", "htmx-indicator", "inline-block"}
|
|
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var20...)
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<img class=\"")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var21 string
|
|
|
|
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var20).String())
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 1, Col: 0}
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" src=\"/static/images/grid.svg\"></div>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var22 = []any{"flex", "flex-row", "flex-wrap"}
|
|
|
|
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var22...)
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-23 17:34:50 +00:00
|
|
|
var templ_7745c5c3_Var23 string
|
|
|
|
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var22).String())
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/hostinfo.templ`, Line: 1, Col: 0}
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" id=\"sysInfo\">")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-03-21 22:56:24 +00:00
|
|
|
templ_7745c5c3_Err = HostStats(h).Render(ctx, templ_7745c5c3_Buffer)
|
2024-03-19 15:13:44 +00:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
if !templ_7745c5c3_IsBuffer {
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
|
|
|
}
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-03-21 22:56:24 +00:00
|
|
|
func HostStats(h *host.Host) templ.Component {
|
2024-03-19 15:13:44 +00:00
|
|
|
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
|
|
|
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
|
|
|
if !templ_7745c5c3_IsBuffer {
|
|
|
|
templ_7745c5c3_Buffer = templ.GetBuffer()
|
|
|
|
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
|
|
|
}
|
|
|
|
ctx = templ.InitializeContext(ctx)
|
2024-03-23 17:34:50 +00:00
|
|
|
templ_7745c5c3_Var24 := templ.GetChildren(ctx)
|
|
|
|
if templ_7745c5c3_Var24 == nil {
|
|
|
|
templ_7745c5c3_Var24 = templ.NopComponent
|
2024-03-19 15:13:44 +00:00
|
|
|
}
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
|
|
|
templ_7745c5c3_Err = MemChart(h).Render(ctx, templ_7745c5c3_Buffer)
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
if !templ_7745c5c3_IsBuffer {
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
|
|
|
}
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
})
|
|
|
|
}
|