Implemented adding complex DNS-records like MX, TXT, SRV.
This commit is contained in:
+33
-5
@@ -33,7 +33,7 @@
|
||||
<div class="modal-content">
|
||||
<div class="box">
|
||||
<div class="columns">
|
||||
<div class="column is-one-third">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label">Name</label>
|
||||
<div class="control">
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="column is-narrow">
|
||||
<div class="field">
|
||||
<label class="label">Type</label>
|
||||
<div class="select">
|
||||
@@ -49,12 +49,18 @@
|
||||
<option>A</option>
|
||||
<option>AAAA</option>
|
||||
<option>CNAME</option>
|
||||
<option>NS</option>
|
||||
<option>MX</option>
|
||||
<option>SRV</option>
|
||||
<option>TXT</option>
|
||||
<!--<option>SOA</option>
|
||||
<option>OPT</option>-->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label">TTL</label>
|
||||
@@ -63,14 +69,36 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-one-third">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label">Data</label>
|
||||
<label class="label">Priority</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" placeholder="1.2.3.4" id="record_data">
|
||||
<input class="input" type="number" placeholder="10" id="record_priority">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label">Weight</label>
|
||||
<div class="control">
|
||||
<input class="input" type="number" placeholder="10" id="record_weight">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label">Port</label>
|
||||
<div class="control">
|
||||
<input class="input" type="number" placeholder="5222" id="record_port">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">Data/host</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" placeholder="1.2.3.4" id="record_data">
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="buttons is-grouped is-centered">
|
||||
|
||||
+26
-1
@@ -20,11 +20,22 @@ function refresh_records_list() {
|
||||
}
|
||||
|
||||
function makeRecord(value, index, array) {
|
||||
data = value.addr;
|
||||
if (value.type == "MX") {
|
||||
data = value.priority + " " + value.host;
|
||||
} else if (value.type == "CNAME") {
|
||||
data = value.host;
|
||||
} else if (value.type == "TXT") {
|
||||
data = value.data;
|
||||
} else if (value.type == "SRV") {
|
||||
data = value.priority + " " + value.weight + " " + value.port + " " + value.host;
|
||||
}
|
||||
|
||||
buf += "<div class=\"columns is-1\">\n";
|
||||
buf += "<div class=\"column\">" + getInput(value.domain) + "</div>\n";
|
||||
buf += "<div class=\"column is-2\">" + getInput(value.type) + "</div>\n";
|
||||
buf += "<div class=\"column is-2\">" + getInput(value.ttl) + "</div>\n";
|
||||
buf += "<div class=\"column\">" + getInput(value.addr) + "</div>\n";
|
||||
buf += "<div class=\"column\">" + getInput(data) + "</div>\n";
|
||||
buf += "<div class=\"column is-1 align-right\">\n<button class=\"button is-danger is-outlined\" id=\"record_delete\" onclick=\"delRecord(" + index + ");\">";
|
||||
buf += "<span class=\"icon is-small\"><i class=\"fas fa-times\"></i></span></button></div>\n";
|
||||
buf += "</div>";
|
||||
@@ -58,6 +69,20 @@ function get_record_from_dialog() {
|
||||
record_type = document.getElementById("record_type").value;
|
||||
record_ttl = parseInt(document.getElementById("record_ttl").value);
|
||||
record_data = document.getElementById("record_data").value;
|
||||
if (record_type == "CNAME" || record_type == "NS") {
|
||||
return { type: record_type, domain: record_name, ttl: record_ttl, host: record_data }
|
||||
} else if (record_type == "MX") {
|
||||
record_priority = parseInt(document.getElementById("record_priority").value);
|
||||
return { type: record_type, domain: record_name, ttl: record_ttl, priority: record_priority, host: record_data }
|
||||
} else if (record_type == "TXT") {
|
||||
record_priority = parseInt(document.getElementById("record_priority").value);
|
||||
return { type: record_type, domain: record_name, ttl: record_ttl, data: record_data }
|
||||
} else if (record_type == "SRV") {
|
||||
record_priority = parseInt(document.getElementById("record_priority").value);
|
||||
record_weight = parseInt(document.getElementById("record_weight").value);
|
||||
record_port = parseInt(document.getElementById("record_port").value);
|
||||
return { type: record_type, domain: record_name, ttl: record_ttl, priority: record_priority, weight: record_weight, port: record_port, host: record_data }
|
||||
}
|
||||
return { type: record_type, domain: record_name, ttl: record_ttl, addr: record_data }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user