2024-03-17 06:10:04 +00:00
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.598
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 (
2024-03-19 04:38:28 +00:00
"fmt"
2024-03-17 06:10:04 +00:00
"git.staur.ca/stobbsm/clustvirt/lib/host"
"git.staur.ca/stobbsm/clustvirt/view/components"
"git.staur.ca/stobbsm/clustvirt/view/layouts"
)
2024-03-19 04:38:28 +00:00
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 ) ,
}
}
2024-03-17 06:10:04 +00:00
// 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
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var2 ) . String ( ) ) )
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-19 04:38:28 +00:00
var templ_7745c5c3_Var3 = [ ] any { "size-40" , "md:size-80" }
2024-03-17 06:10:04 +00:00
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var3 ... )
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
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var3 ) . String ( ) ) )
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-19 04:38:28 +00:00
var templ_7745c5c3_Var4 = [ ] any { "size-40" , "md:size-80" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var4 ... )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-03-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<canvas id=\"memchart\" class=\"" )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-03-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var4 ) . String ( ) ) )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-03-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\"></canvas></div><ul><li>Free: <span id=\"memfree\">" )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
2024-03-19 04:38:28 +00:00
templ_7745c5c3_Var5 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d Gi" , h . NodeMemory . Free / 1024 / 1024 ) )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
2024-03-19 04:38:28 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/hostinfo.templ ` , Line : 48 , Col : 83 }
2024-03-17 06:10:04 +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-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span></li><li>Cached: <span id=\"memcach\">" )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
2024-03-19 04:38:28 +00:00
templ_7745c5c3_Var6 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d Gi" , h . NodeMemory . Cached / 1024 / 1024 ) )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
2024-03-19 04:38:28 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/hostinfo.templ ` , Line : 49 , Col : 87 }
2024-03-17 06:10:04 +00:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var6 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-03-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span></li><li>Buffers: <span id=\"membuf\">" )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
2024-03-19 04:38:28 +00:00
templ_7745c5c3_Var7 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d Gi" , h . NodeMemory . Buffers / 1024 / 1024 ) )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
2024-03-19 04:38:28 +00:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/hostinfo.templ ` , Line : 50 , Col : 88 }
2024-03-17 06:10:04 +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-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span></li><li>Total: <span id=\"memtot\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d Gi" , h . NodeMemory . Total / 1024 / 1024 ) )
if templ_7745c5c3_Err != nil {
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/hostinfo.templ ` , Line : 51 , Col : 84 }
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var8 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span></li></ul></div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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 )
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
} )
}
func hostButton ( hostname string ) 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_Var9 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var9 == nil {
templ_7745c5c3_Var9 = templ . NopComponent
}
ctx = templ . ClearChildren ( ctx )
var templ_7745c5c3_Var10 = [ ] any { "rounded" ,
"border" ,
"border-solid" ,
"border-uiblue-700" ,
"text-uigrey-200" ,
"bg-uiblue-800" ,
"hover:border-uipurple-400" ,
"hover:text-ui-grey-800" ,
"hover:bg-uipurple-600" ,
"gap-2" ,
"p-1" ,
"my-1" ,
"w-full" ,
"flex" ,
"flex-row" ,
"justify-between" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var10 ... )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<button hx-target=\"#sysContent\" hx-get=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( fmt . Sprintf ( "/htmx/host/%s" , hostname ) ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" class=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var10 ) . String ( ) ) )
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_Var11 = [ ] any { "px-2" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var11 ... )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<span class=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var11 ) . String ( ) ) )
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_Var12 string
templ_7745c5c3_Var12 , templ_7745c5c3_Err = templ . JoinStringErrs ( hostname )
if templ_7745c5c3_Err != nil {
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/hostinfo.templ ` , Line : 79 , Col : 35 }
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var12 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</span> " )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 = [ ] any { "htmx-indicator" , "inline-block" , "h-6" , "px-2" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var13 ... )
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
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var13 ) . String ( ) ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\" src=\"/static/images/bars.svg\"></button>" )
2024-03-17 06:10:04 +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
func HostMain ( navBarItems [ ] components . NavItem ) 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-19 04:38:28 +00:00
templ_7745c5c3_Var14 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var14 == nil {
templ_7745c5c3_Var14 = templ . NopComponent
2024-03-17 06:10:04 +00:00
}
ctx = templ . ClearChildren ( ctx )
2024-03-19 04:38:28 +00:00
templ_7745c5c3_Var15 := templ . ComponentFunc ( func ( ctx context . Context , templ_7745c5c3_W io . Writer ) ( templ_7745c5c3_Err error ) {
2024-03-17 06:10:04 +00:00
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 )
}
2024-03-19 04:38:28 +00:00
var templ_7745c5c3_Var16 = [ ] any { "flex" , "flex-row" , "h-full" , "mt-2" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var16 ... )
2024-03-17 06:10:04 +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-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var16 ) . String ( ) ) )
2024-03-17 06:10:04 +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-19 04:38:28 +00:00
var templ_7745c5c3_Var17 = [ ] any { "w-1/6" , "border-uigrey-600" , "border" , "rounded" , "border-dotted" , "p-2" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var17 ... )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div id=\"sysNavBar\" class=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-03-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var17 ) . String ( ) ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\"><ul><li>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = hostButton ( "venus.staur.ca" ) . Render ( ctx , templ_7745c5c3_Buffer )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-03-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</li><li>" )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-03-19 04:38:28 +00:00
templ_7745c5c3_Err = hostButton ( "earth.staur.ca" ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</li><li>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = hostButton ( "mars.staur.ca" ) . Render ( ctx , templ_7745c5c3_Buffer )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "</li></ul></div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var18 = [ ] any { "w-3/4" , "px-2" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var18 ... )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div id=\"sysContent\" class=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-03-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var18 ) . String ( ) ) )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\"><p>This is where you can see a system overview of all available hosts</p><p>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</p></div></div>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if ! templ_7745c5c3_IsBuffer {
_ , templ_7745c5c3_Err = io . Copy ( templ_7745c5c3_W , templ_7745c5c3_Buffer )
}
return templ_7745c5c3_Err
} )
2024-03-19 04:38:28 +00:00
templ_7745c5c3_Err = layouts . Manager ( "ClustVirt" , "Cluster Manager" , navBarItems ) . Render ( templ . WithChildren ( ctx , templ_7745c5c3_Var15 ) , templ_7745c5c3_Buffer )
2024-03-17 06:10:04 +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
} )
}
// 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-19 04:38:28 +00:00
templ_7745c5c3_Var19 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var19 == nil {
templ_7745c5c3_Var19 = templ . NopComponent
2024-03-17 06:10:04 +00:00
}
ctx = templ . ClearChildren ( ctx )
2024-03-19 04:38:28 +00:00
var templ_7745c5c3_Var20 = [ ] any { "flex" , "flex-col" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var20 ... )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2024-03-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "<div class=\"" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var20 ) . String ( ) ) )
2024-03-17 06:10:04 +00:00
if templ_7745c5c3_Err != nil {
2024-03-19 04:38:28 +00:00
return templ_7745c5c3_Err
2024-03-17 06:10:04 +00:00
}
2024-03-19 04:38:28 +00:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( "\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var21 = [ ] any { "flex" , "flex-row" , "justify-start" , "px-2" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var21 ... )
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
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var21 ) . String ( ) ) )
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
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( fmt . Sprintf ( "/htmx/host/%s/stats" , h . HostName ) ) )
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
}
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22 , templ_7745c5c3_Err = templ . JoinStringErrs ( h . HostName )
if templ_7745c5c3_Err != nil {
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/hostinfo.templ ` , Line : 121 , Col : 19 }
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var22 ) )
2024-03-17 06:10:04 +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-19 04:38:28 +00:00
var templ_7745c5c3_Var23 = [ ] any { "h-6" , "px-2" , "htmx-indicator" , "inline-block" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var23 ... )
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
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var23 ) . String ( ) ) )
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
}
var templ_7745c5c3_Var24 = [ ] any { "flex" , "flex-row" , "flex-wrap" }
templ_7745c5c3_Err = templ . RenderCSSItems ( ctx , templ_7745c5c3_Buffer , templ_7745c5c3_Var24 ... )
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
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ . CSSClasses ( templ_7745c5c3_Var24 ) . String ( ) ) )
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
}
templ_7745c5c3_Err = SysInfo ( h ) . Render ( ctx , templ_7745c5c3_Buffer )
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
} )
}
func SysInfo ( 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_Var25 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var25 == nil {
templ_7745c5c3_Var25 = templ . NopComponent
}
ctx = templ . ClearChildren ( ctx )
2024-03-17 06:10:04 +00:00
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
} )
}