Checkpoint
This commit is contained in:
parent
4637689db4
commit
5112113aae
4 changed files with 104 additions and 40 deletions
17
webserver.go
17
webserver.go
|
|
@ -67,8 +67,21 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
|
|||
data["DNSRecords"] = entries
|
||||
|
||||
tree := BuildRecordsTree(entries)
|
||||
htmlTree := tree.ToHTML([]string{})
|
||||
data["Tree"] = template.HTML(htmlTree)
|
||||
htmlElements := tree.ToHTMLElements([]string{}, 0)
|
||||
|
||||
var html string
|
||||
for _, el := range htmlElements {
|
||||
if el.Header {
|
||||
html += el.HTML
|
||||
}
|
||||
}
|
||||
for _, el := range htmlElements {
|
||||
if !el.Header {
|
||||
html += el.HTML
|
||||
}
|
||||
}
|
||||
|
||||
data["Tree"] = template.HTML(html)
|
||||
|
||||
j, _ := json.Marshal(tree)
|
||||
os.WriteFile("/tmp/tree.json", j, 0644)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue