Somewhat working
This commit is contained in:
parent
ad638acaf3
commit
4637689db4
6 changed files with 52 additions and 12 deletions
28
dns.go
28
dns.go
|
|
@ -107,6 +107,13 @@ func BuildRecordsTree(records []DNSRecord) *DomainPart {
|
|||
func (dp *DomainPart) ToHTML(parts []string) string {
|
||||
html := ""
|
||||
|
||||
/*
|
||||
var lines []struct {
|
||||
Header bool
|
||||
HTML string
|
||||
}
|
||||
*/
|
||||
|
||||
sortedParts := slices.Sorted(maps.Keys(dp.Subparts))
|
||||
|
||||
for _, part := range sortedParts {
|
||||
|
|
@ -118,18 +125,33 @@ func (dp *DomainPart) ToHTML(parts []string) string {
|
|||
slices.Reverse(reversedParts)
|
||||
fqdn := strings.Join(reversedParts, ".")
|
||||
|
||||
mostSpecificPart := reversedParts[0]
|
||||
restPart := ""
|
||||
if len(reversedParts) > 1 {
|
||||
restPart = strings.Join(reversedParts[1:], ".")
|
||||
mostSpecificPart += "."
|
||||
}
|
||||
|
||||
var subHTML string
|
||||
if len(subpart.Subparts) == 0 {
|
||||
html += fmt.Sprintf(`<div class="record" data-record="%s">%s</div>`, fqdn, fqdn)
|
||||
html += fmt.Sprintf(
|
||||
`<div class="record" style="margin-left: %dpx" data-top="%s"><span>%s</span><span>%s</span></div>`,
|
||||
len(newParts)*16,
|
||||
restPart,
|
||||
mostSpecificPart,
|
||||
restPart,
|
||||
)
|
||||
} else {
|
||||
subHTML = subpart.ToHTML(newParts)
|
||||
html += fmt.Sprintf(`
|
||||
<div class="top" data-top="%s">
|
||||
<div class="top" data-top="%s" style="margin-left: %dpx">
|
||||
<div class="fqdn">%s</div>
|
||||
<div class="records">%s</div>
|
||||
</div>
|
||||
<div data-top="%s" class="records">%s</div>
|
||||
`,
|
||||
fqdn,
|
||||
len(newParts)*16,
|
||||
fqdn,
|
||||
fqdn,
|
||||
subHTML,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue