54 lines
1.4 KiB
Plaintext
54 lines
1.4 KiB
Plaintext
|
package templates
|
||
|
|
||
|
import "git.jmbit.de/jmb/goipam/utils"
|
||
|
import "git.jmbit.de/jmb/goipam/db"
|
||
|
import "fmt"
|
||
|
|
||
|
templ SubnetsPage(metaContent utils.MetaContent, subnets []db.Subnet, err error) {
|
||
|
@wrapBase(metaContent, "Subnets", err) {
|
||
|
<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>ID</th>
|
||
|
<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>{ fmt.Sprint(subnet.ID) }</td>
|
||
|
<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>
|
||
|
}
|
||
|
}
|