aboutsummaryrefslogtreecommitdiff
path: root/_www
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-01-24 05:44:03 +0700
committerShulhan <ms@kilabit.info>2021-01-24 14:51:58 +0700
commit995c887946cb01f7975fa1bfebb1ffa842d99ac4 (patch)
tree6431ebc89be8d7ca6f416c9aff32bab7dcaac2ff /_www
parent0311c57e95e48db6136b4fdec3312771abf483a6 (diff)
downloadrescached-995c887946cb01f7975fa1bfebb1ffa842d99ac4.tar.xz
zone.d: pretty print the resource record (RR) value
If the RR value is object print the value as "key=value,...".
Diffstat (limited to '_www')
-rw-r--r--_www/zone.d/index.html43
1 files changed, 34 insertions, 9 deletions
diff --git a/_www/zone.d/index.html b/_www/zone.d/index.html
index b8b3f46..7a355da 100644
--- a/_www/zone.d/index.html
+++ b/_www/zone.d/index.html
@@ -31,10 +31,10 @@
.action-delete {
margin-left: 1em;
}
- .actions {
+ div.actions {
padding: 1em;
}
- .actions button {
+ div.actions button {
width: 100%;
}
@@ -51,6 +51,9 @@
font-family: monospace;
width: 100%;
}
+ .rr > * {
+ vertical-align: middle;
+ }
.rr.header {
font-weight: bold;
}
@@ -69,8 +72,12 @@
}
.rr > .value {
display: inline-block;
+ width: 20em;
word-wrap: break-word;
}
+ .rr > .actions {
+ display: inline-block;
+ }
</style>
</head>
<body onload="main()">
@@ -182,7 +189,7 @@
oninput="updateSOA('Expire', parseInt(this.value))"
/>
<span class="input-info-toggler" onclick="toggleInfo('soa_expire_info')">?</span>
- <div class="soa_expire_info" class="input-info" style="display: none">
+ <div id="soa_expire_info" class="input-info" style="display: none">
Number of seconds after which secondary name servers should stop answering
request for this zone if the zone does not respond. This value must be
bigger than the sum of Refresh and Retry. Recommendation for small and
@@ -198,7 +205,7 @@
min="0"
oninput="updateSOA('Minimum', parseInt(this.value))"
/>
- <span class="input-info-toggler" onclick="toggleInfo('soa_expire_info')">?</span>
+ <span class="input-info-toggler" onclick="toggleInfo('soa_minimum_info')">?</span>
<div id="soa_minimum_info" class="input-info" style="display: none">
Time to live for purposes of negative caching. Recommendation for small and
stable zones is 1800 seconds (30 min).
@@ -337,7 +344,9 @@
case 15: // MX
newRR.Name = document.getElementById("rr_mx_name").value
newRR.Value = {
- Preference: parseInt(document.getElementById("rr_mx_preference").value),
+ Preference: parseInt(
+ document.getElementById("rr_mx_preference").value,
+ ),
Exchange: document.getElementById("rr_mx_exchange").value,
}
break
@@ -463,11 +472,13 @@
${resc.GetRRTypeName(rr.Type)}
</span>
<span class="value">
- ${JSON.stringify(rr.Value)}
+ ${renderRRValue(rr.Value)}
+ </span>
+ <span class="actions">
+ <button onclick="deleteRR('${rr.Name}', ${idx})">
+ X
+ </button>
</span>
- <button onclick="deleteRR('${rr.Name}', ${idx})">
- X
- </button>
</div>
`
})
@@ -475,6 +486,20 @@
w.innerHTML = out
}
+ function renderRRValue(value) {
+ if (typeof value === "object") {
+ let w = ""
+ for (const [k, v] of Object.entries(value)) {
+ if (w.length > 0) {
+ w += ","
+ }
+ w += k + "=" + v
+ }
+ return w
+ }
+ return value
+ }
+
function renderActiveZoneForm() {
let form = document.getElementById("activeZone_form")
form.style.display = "block"