2024-02-23 11:22:28 +01:00
|
|
|
// Code generated by templ - DO NOT EDIT.
|
|
|
|
|
|
|
|
// templ: version: v0.2.543
|
|
|
|
package templates
|
|
|
|
|
|
|
|
//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 "git.jmbit.de/jmb/goipam/db"
|
|
|
|
import "fmt"
|
|
|
|
|
2024-02-23 18:39:05 +01:00
|
|
|
func SubnetsPage(metaContent MetaContent, subnets []db.Subnet) templ.Component {
|
2024-02-23 11:22:28 +01: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)
|
|
|
|
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
|
|
|
if templ_7745c5c3_Var1 == nil {
|
|
|
|
templ_7745c5c3_Var1 = templ.NopComponent
|
|
|
|
}
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
|
|
|
templ_7745c5c3_Var2 := 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)
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"section is-centered\"><div class=\"container\">")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
templ_7745c5c3_Err = subnetsTable(subnets).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 = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
|
|
|
|
}
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
})
|
2024-02-23 18:39:05 +01:00
|
|
|
templ_7745c5c3_Err = wrapBase(metaContent, "Subnets").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
2024-02-23 11:22:28 +01: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
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func subnetsTable(subnets []db.Subnet) 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_Var3 := templ.GetChildren(ctx)
|
|
|
|
if templ_7745c5c3_Var3 == nil {
|
|
|
|
templ_7745c5c3_Var3 = templ.NopComponent
|
|
|
|
}
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
2024-02-23 18:39:05 +01:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"section is-centered\"><h2 class=\"title\">Subnets</h2><div class=\"table-container\"><table class=\"table\"><thead><tr><th>Name</th><th>Display Name</th><th><abbr title=\"Virtual LAN ID\">VLAN</abbr></th><th><abbr title=\"IPv4 Address\">IPv4</abbr></th><th><abbr title=\"IPv6 Address\">IPv6</abbr></th><th>Location</th><th>Comment</th></tr></thead> <tbody id=\"search-results\"></tbody></table></div></div>")
|
2024-02-23 11:22:28 +01: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
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func subnetsTableRows(subnets []db.Subnet) 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_Var4 := templ.GetChildren(ctx)
|
|
|
|
if templ_7745c5c3_Var4 == nil {
|
|
|
|
templ_7745c5c3_Var4 = templ.NopComponent
|
|
|
|
}
|
|
|
|
ctx = templ.ClearChildren(ctx)
|
|
|
|
for _, subnet := range subnets {
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr hx-get=\"")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(fmt.Sprintf("/subnets/details/%d", subnet.ID)))
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><td>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
var templ_7745c5c3_Var5 string
|
2024-02-23 18:39:05 +01:00
|
|
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(subnet.Name)
|
2024-02-23 11:22:28 +01:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-02-23 18:39:05 +01:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/subnets.templ`, Line: 40, Col: 20}
|
2024-02-23 11:22:28 +01:00
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
var templ_7745c5c3_Var6 string
|
2024-02-23 18:39:05 +01:00
|
|
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(subnet.DisplayName)
|
2024-02-23 11:22:28 +01:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-02-23 18:39:05 +01:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/subnets.templ`, Line: 41, Col: 27}
|
2024-02-23 11:22:28 +01:00
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
var templ_7745c5c3_Var7 string
|
2024-02-23 18:39:05 +01:00
|
|
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprint(subnet.VLAN))
|
2024-02-23 11:22:28 +01:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-02-23 18:39:05 +01:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/subnets.templ`, Line: 42, Col: 32}
|
2024-02-23 11:22:28 +01:00
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
var templ_7745c5c3_Var8 string
|
2024-02-23 18:39:05 +01:00
|
|
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(subnet.IPv4Net)
|
2024-02-23 11:22:28 +01:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-02-23 18:39:05 +01:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/subnets.templ`, Line: 43, Col: 23}
|
2024-02-23 11:22:28 +01:00
|
|
|
}
|
|
|
|
_, 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("</td><td>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
var templ_7745c5c3_Var9 string
|
2024-02-23 18:39:05 +01:00
|
|
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(subnet.IPv6Net)
|
2024-02-23 11:22:28 +01:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-02-23 18:39:05 +01:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/subnets.templ`, Line: 44, Col: 23}
|
2024-02-23 11:22:28 +01:00
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td hx-get=\"")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(fmt.Sprintf("/locations/details/%d", subnet.LocationID)))
|
|
|
|
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-02-23 18:39:05 +01:00
|
|
|
var templ_7745c5c3_Var10 string
|
|
|
|
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(subnet.Location().Name)
|
2024-02-23 11:22:28 +01:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-02-23 18:39:05 +01:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/subnets.templ`, Line: 45, Col: 98}
|
2024-02-23 11:22:28 +01:00
|
|
|
}
|
2024-02-23 18:39:05 +01:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
2024-02-23 11:22:28 +01:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td>")
|
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
2024-02-23 18:39:05 +01:00
|
|
|
var templ_7745c5c3_Var11 string
|
|
|
|
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(subnet.Comment)
|
2024-02-23 11:22:28 +01:00
|
|
|
if templ_7745c5c3_Err != nil {
|
2024-02-23 18:39:05 +01:00
|
|
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/templates/subnets.templ`, Line: 46, Col: 23}
|
2024-02-23 11:22:28 +01:00
|
|
|
}
|
2024-02-23 18:39:05 +01:00
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
2024-02-23 11:22:28 +01:00
|
|
|
if templ_7745c5c3_Err != nil {
|
|
|
|
return templ_7745c5c3_Err
|
|
|
|
}
|
|
|
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td></tr>")
|
|
|
|
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
|
|
|
|
})
|
|
|
|
}
|