Skip to content

Commit

Permalink
Query Log: Show link to groups/lists page if applicable (#2916)
Browse files Browse the repository at this point in the history
  • Loading branch information
DL6ER authored Feb 9, 2024
2 parents 4b83c7f + a0ddfe6 commit 128ae80
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
21 changes: 10 additions & 11 deletions scripts/pi-hole/js/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,16 @@ function formatInfo(data) {
"</span></strong></div>";
}

var regexInfo = "",
var listInfo = "",
cnameInfo = "";
if (data.regex_id !== null && data.regex_id > -1) {
var regexLink =
'<a href="groups/domains?domainid=' +
data.regex_id +
'" target="_blank">entry with ID ' +
data.regex_id +
"</a>";
regexInfo =
divStart + "Query was " + queryStatus.matchText + " by </td><td>" + regexLink + "</div>";
if (data.list_id !== null && data.list_id !== -1) {
// Some list matched - add link to search page

var listLink =
'<a href="search?domain=' +
encodeURIComponent(data.domain) +
'" target="_blank">search lists</a>';
listInfo = divStart + "Query was " + queryStatus.matchText + ", " + listLink + "</div>";
}

if (queryStatus.isCNAME) {
Expand Down Expand Up @@ -356,7 +355,7 @@ function formatInfo(data) {
dnssecInfo +
statusInfo +
cnameInfo +
regexInfo +
listInfo +
ttlInfo +
replyInfo +
dbInfo +
Expand Down
12 changes: 12 additions & 0 deletions scripts/pi-hole/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
* Please see LICENSE file for your rights under this license. */

/* global utils:false, apiFailure:false */
var GETDict = {};

$(function () {
GETDict = utils.parseQueryString();
if (GETDict.domain !== undefined) {
$("input[id^='domain']").val(GETDict.domain);
}

if (GETDict.N !== undefined) {
$("#number").val(GETDict.number);
}
});

function eventsource(partial) {
const ta = $("#output");
Expand Down
5 changes: 4 additions & 1 deletion style/pi-hole.css
Original file line number Diff line number Diff line change
Expand Up @@ -1075,12 +1075,15 @@ table.dataTable tbody > tr > .selected {

#output {
position: relative;
display: grid;
margin: 5px 0;
min-height: 36px;
padding: 4px 8px;
}

#output.pre-taillog {
display: grid;
}

.loading::before {
content: " ";
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion taillog.lp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mg.include('scripts/pi-hole/lua/header_authenticated.lp','r')
<div class="box-body">
<div class="row">
<div class="col-md-12">
<pre id="output" class="pre pre-scrollable"></pre>
<pre id="output" class="pre pre-scrollable pre-taillog"></pre>
</div>
</div>
</div>
Expand Down

0 comments on commit 128ae80

Please sign in to comment.