mirror of
https://github.com/pi-hole/web.git
synced 2026-04-19 16:30:52 +01:00
@@ -208,6 +208,24 @@ function parseQueryStatus(data) {
|
||||
};
|
||||
}
|
||||
|
||||
function formatReplyTime(data, type) {
|
||||
const replyTime = data.reply.time;
|
||||
if (type === "display") {
|
||||
// Units:
|
||||
// - seconds if replytime >= 1 second
|
||||
// - milliseconds if reply time >= 100 µs
|
||||
// - microseconds otherwise
|
||||
return replyTime < 1e-4
|
||||
? (1e6 * replyTime).toFixed(1) + " µs"
|
||||
: replyTime < 1
|
||||
? (1e3 * replyTime).toFixed(1) + " ms"
|
||||
: replyTime.toFixed(1) + " s";
|
||||
}
|
||||
|
||||
// else: return the number itself (for sorting and searching)
|
||||
return replyTime;
|
||||
}
|
||||
|
||||
function formatInfo(data) {
|
||||
// DNSSEC status
|
||||
var dnssecStatus = data.dnssec,
|
||||
@@ -306,11 +324,7 @@ function formatInfo(data) {
|
||||
if (data.reply.type !== "UNKNOWN") {
|
||||
replyInfo = divStart + "Reply:  " + data.reply.type;
|
||||
if (data.reply.time >= 0 && data.reply.type !== "UNKNOWN") {
|
||||
replyInfo +=
|
||||
" (" +
|
||||
(data.reply.time < 1
|
||||
? (1e3 * data.reply.time).toFixed(1) + " ms)"
|
||||
: data.reply.time.toFixed(1) + " s)");
|
||||
replyInfo += " (" + formatReplyTime(data, "display") + ")";
|
||||
}
|
||||
|
||||
replyInfo += "</div>";
|
||||
@@ -515,9 +529,10 @@ $(function () {
|
||||
},
|
||||
},
|
||||
{ data: "status", width: "1%" },
|
||||
{ data: "type", width: "5%" },
|
||||
{ data: "type", width: "1%" },
|
||||
{ data: "domain", width: "45%" },
|
||||
{ data: "client.ip", width: "29%", type: "ip-address", render: $.fn.dataTable.render.text() },
|
||||
{ data: "client.ip", width: "29%", type: "ip-address" },
|
||||
{ data: null, width: "4%", render: formatReplyTime },
|
||||
{ data: null, width: "10%", sortable: false, searchable: false },
|
||||
],
|
||||
lengthMenu: [
|
||||
@@ -569,7 +584,7 @@ $(function () {
|
||||
}
|
||||
|
||||
if (querystatus.buttontext !== false) {
|
||||
$("td:eq(5)", row).html(querystatus.buttontext);
|
||||
$("td:eq(6)", row).html(querystatus.buttontext);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user