dev: automated commit - 2025-10-07 13:10:57
This commit is contained in:
parent
67fe0ec007
commit
bc63f389f0
6 changed files with 220 additions and 128 deletions
|
|
@ -2,6 +2,7 @@ package templates
|
|||
|
||||
import "fmt"
|
||||
import "strings"
|
||||
import "sort"
|
||||
|
||||
type IndexProps struct {
|
||||
Title string
|
||||
|
|
@ -213,8 +214,32 @@ templ DNSRecordsTable(records []DNSRecord, currentIP string) {
|
|||
<td colspan="7" class="text-center">No DNS records found</td>
|
||||
</tr>
|
||||
} else {
|
||||
for _, record := range records {
|
||||
@DNSRecordRow(record, currentIP)
|
||||
// Group records by Content (IP)
|
||||
groups := make(map[string][]DNSRecord)
|
||||
for _, r := range records {
|
||||
groups[r.Content] = append(groups[r.Content], r)
|
||||
}
|
||||
|
||||
// Stable order of groups
|
||||
ips := make([]string, 0, len(groups))
|
||||
for ip := range groups {
|
||||
ips = append(ips, ip)
|
||||
}
|
||||
sort.Strings(ips)
|
||||
|
||||
for _, ip := range ips {
|
||||
<tr class="table-secondary">
|
||||
<td colspan="7">
|
||||
<strong>{ ip }</strong>
|
||||
<span class="ms-2 text-muted">{ fmt.Sprintf("%d record(s)", len(groups[ip])) }</span>
|
||||
if ip == currentIP {
|
||||
<span class="badge bg-success ms-2">Current IP</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
for _, record := range groups[ip] {
|
||||
@DNSRecordRow(record, currentIP)
|
||||
}
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue