2024-02-23 11:22:28 +01:00
|
|
|
package templates
|
|
|
|
|
|
|
|
import "git.jmbit.de/jmb/goipam/db"
|
|
|
|
import "fmt"
|
|
|
|
|
2024-02-23 18:39:05 +01:00
|
|
|
templ SubnetsPage(metaContent MetaContent, subnets []db.Subnet) {
|
|
|
|
@wrapBase(metaContent, "Subnets") {
|
2024-02-23 11:22:28 +01:00
|
|
|
<div class="section is-centered">
|
|
|
|
<div class="container">
|
|
|
|
@subnetsTable(subnets)
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
templ subnetsTable(subnets []db.Subnet) {
|
|
|
|
<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>
|
|
|
|
}
|
|
|
|
|
|
|
|
templ subnetsTableRows(subnets []db.Subnet) {
|
|
|
|
for _, subnet := range subnets {
|
|
|
|
<tr hx-get={ fmt.Sprintf("/subnets/details/%d", subnet.ID) }>
|
|
|
|
<td>{ subnet.Name }</td>
|
|
|
|
<td>{ subnet.DisplayName }</td>
|
|
|
|
<td>{ fmt.Sprint(subnet.VLAN) }</td>
|
|
|
|
<td>{ subnet.IPv4Net }</td>
|
|
|
|
<td>{ subnet.IPv6Net }</td>
|
|
|
|
<td hx-get={ fmt.Sprintf("/locations/details/%d", subnet.LocationID) }>{ subnet.Location().Name }</td>
|
|
|
|
<td>{ subnet.Comment }</td>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
}
|