log.js: fixed minor issue in queryLogs() and added context menu for query logs entries.

This commit is contained in:
Shreyas Zare
2023-02-18 11:46:51 +05:30
parent e783b6b171
commit 0034e3e0b0

View File

@@ -292,7 +292,10 @@ function queryLogs(pageNumber) {
if (pageNumber == null)
pageNumber = $("#txtQueryLogPageNumber").val();
var entriesPerPage = $("#optQueryLogsEntriesPerPage").val();
var entriesPerPage = Number($("#optQueryLogsEntriesPerPage").val());
if (entriesPerPage < 1)
entriesPerPage = 10;
var descendingOrder = $("#optQueryLogsDescendingOrder").val();
var start = $("#txtQueryLogStart").val();
@@ -333,7 +336,22 @@ function queryLogs(pageNumber) {
htmlEncode(responseJSON.response.entries[i].qname == "" ? "." : responseJSON.response.entries[i].qname) + "</td><td>" +
(responseJSON.response.entries[i].qtype == null ? "" : responseJSON.response.entries[i].qtype) + "</td><td>" +
(responseJSON.response.entries[i].qclass == null ? "" : responseJSON.response.entries[i].qclass) + "</td><td style=\"word-break: break-all;\">" +
htmlEncode(responseJSON.response.entries[i].answer) + "</td></tr>"
htmlEncode(responseJSON.response.entries[i].answer) +
"</td><td align=\"right\"><div class=\"dropdown\"><a href=\"#\" id=\"btnQueryLogsRowOption" + i + "\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"true\"><span class=\"glyphicon glyphicon-option-vertical\" aria-hidden=\"true\"></span></a><ul class=\"dropdown-menu dropdown-menu-right\">";
switch (responseJSON.response.entries[i].responseType.toLowerCase()) {
case "blocked":
case "upstreamblocked":
case "cacheblocked":
tableHtml += "<li><a href=\"#\" data-id=\"" + i + "\" data-domain=\"" + htmlEncode(responseJSON.response.entries[i].qname) + "\" onclick=\"allowDomain(this, 'btnQueryLogsRowOption'); return false;\">Allow Domain</a></li>";
break;
default:
tableHtml += "<li><a href=\"#\" data-id=\"" + i + "\" data-domain=\"" + htmlEncode(responseJSON.response.entries[i].qname) + "\" onclick=\"blockDomain(this, 'btnQueryLogsRowOption'); return false;\">Block Domain</a></li>";
break;
}
tableHtml += "</ul></div></td></tr>";
}
var paginationHtml = "";