Add searching for domains and clients in the Query Log. Wildcards (*) are supported everywhere in the search string.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-03-14 19:33:14 +01:00
parent da7c0efb02
commit 5cb2a893a8

View File

@@ -557,12 +557,13 @@ $(function () {
return data; return data;
}, },
searchable: false,
}, },
{ data: "status", width: "1%" }, { data: "status", width: "1%", searchable: false },
{ data: "type", width: "1%" }, { data: "type", width: "1%", searchable: false },
{ data: "domain", width: "45%" }, { data: "domain", width: "45%" },
{ data: "client.ip", width: "29%", type: "ip-address" }, { data: "client.ip", width: "29%", type: "ip-address" },
{ data: "reply.time", width: "4%", render: formatReplyTime }, { data: "reply.time", width: "4%", render: formatReplyTime, searchable: false },
{ data: null, width: "10%", sortable: false, searchable: false }, { data: null, width: "10%", sortable: false, searchable: false },
], ],
lengthMenu: [ lengthMenu: [
@@ -620,6 +621,32 @@ $(function () {
$("td:eq(6)", row).html(querystatus.buttontext); $("td:eq(6)", row).html(querystatus.buttontext);
} }
}, },
initComplete: function () {
this.api()
.columns()
.every(function () {
// Skip columns that are not searchable
const colIdx = this.index();
const bSearchable = this.context[0].aoColumns[colIdx].bSearchable;
if (!bSearchable) {
return null;
}
// Replace footer text with input field for searchable columns
const input = document.createElement("input");
input.placeholder = this.footer().textContent;
this.footer().replaceChildren(input);
// Event listener for user input
input.addEventListener("keyup", () => {
if (this.search() !== this.value) {
this.search(input.value).draw();
}
});
return null;
});
},
}); });
// Add event listener for adding domains to the allow-/blocklist // Add event listener for adding domains to the allow-/blocklist