Sort custom dns table based on fqdn, rtype, and value (#1651)
This commit is contained in:
parent
ed02e2106b
commit
50e9e8af30
|
@ -192,6 +192,22 @@ function show_current_custom_dns() {
|
||||||
$('#custom-dns-current').fadeIn();
|
$('#custom-dns-current').fadeIn();
|
||||||
else
|
else
|
||||||
$('#custom-dns-current').fadeOut();
|
$('#custom-dns-current').fadeOut();
|
||||||
|
|
||||||
|
var reverse_fqdn = function(el) {
|
||||||
|
el.qname = el.qname.split('.').reverse().join('.');
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
var sort = function(a, b) {
|
||||||
|
if(a.qname === b.qname) {
|
||||||
|
if(a.rtype === b.rtype) {
|
||||||
|
return a.value > b.value ? 1 : -1;
|
||||||
|
}
|
||||||
|
return a.rtype > b.rtype ? 1 : -1;
|
||||||
|
}
|
||||||
|
return a.qname > b.qname ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = data.map(reverse_fqdn).sort(sort).map(reverse_fqdn);
|
||||||
|
|
||||||
$('#custom-dns-current').find("tbody").text('');
|
$('#custom-dns-current').find("tbody").text('');
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
|
Loading…
Reference in New Issue