From c5ab81248a4552f4248ca53fb674190fb3c7aa92 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 25 Dec 2023 05:31:56 +0100 Subject: [PATCH] Query Log: Show link to groups/lists page if applicable Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index 77ceb4aa..7cf27043 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -278,15 +278,22 @@ function formatInfo(data) { var regexInfo = "", cnameInfo = ""; - if (data.regex_id !== null && data.regex_id > -1) { - var regexLink = - 'entry with ID ' + - data.regex_id + + if (data.list_id !== null && data.list_id !== -1) { + // Undo the negation of the list ID if this is an anti-/gravity match + const gravityMatch = data.list_id < -1; + const listID = gravityMatch ? -2 - data.list_id : data.list_id; + + var listLink = + '' + + (gravityMatch ? "list" : "domain") + + " ID " + + listID + ""; regexInfo = - divStart + "Query was " + queryStatus.matchText + " by " + regexLink + ""; + divStart + "Query was " + queryStatus.matchText + " by " + listLink + ""; } if (queryStatus.isCNAME) {