Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less color for the Query Log #1872

Merged
merged 2 commits into from
Sep 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 26 additions & 36 deletions scripts/pi-hole/js/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,20 @@ $(function () {
// Query status
var fieldtext,
buttontext = "",
colorClass = false,
isCNAME = false,
regexLink = false;

switch (data[4]) {
case "1":
colorClass = "text-red";
fieldtext = "Blocked (gravity)";
fieldtext = "<span class='text-red'>Blocked (gravity)</span>";
buttontext =
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
break;
case "2":
colorClass = "text-green";
fieldtext = replyid === 0 ? "OK, sent to " : "OK, answered by ";
fieldtext =
replyid === 0
? "<span class='text-green'>OK</span>, sent to "
: "<span class='text-green'>OK</span>, answered by ";
fieldtext +=
"<br class='hidden-lg'>" +
(data.length > 10 && data[10] !== "N/A" ? data[10] : "") +
Expand All @@ -132,14 +132,13 @@ $(function () {
'<button type="button" class="btn btn-default btn-sm text-red"><i class="fa fa-ban"></i> Blacklist</button>';
break;
case "3":
colorClass = "text-green";
fieldtext = "OK <br class='hidden-lg'>(cached)" + dnssecStatus;
fieldtext =
"<span class='text-green'>OK</span> <br class='hidden-lg'>(cache)" + dnssecStatus;
buttontext =
'<button type="button" class="btn btn-default btn-sm text-red"><i class="fa fa-ban"></i> Blacklist</button>';
break;
case "4":
colorClass = "text-red";
fieldtext = "Blocked <br class='hidden-lg'>(regex blacklist)";
fieldtext = "<span class='text-red'>Blocked <br class='hidden-lg'>(regex blacklist)";

if (data.length > 9 && data[9] > 0) {
regexLink = true;
Expand All @@ -149,36 +148,33 @@ $(function () {
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
break;
case "5":
colorClass = "text-red";
fieldtext = "Blocked <br class='hidden-lg'>(exact blacklist)";
fieldtext = "<span class='text-red'>Blocked <br class='hidden-lg'>(exact blacklist)";
buttontext =
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
break;
case "6":
colorClass = "text-red";
fieldtext = "Blocked <br class='hidden-lg'>(external, IP)";
fieldtext = "<span class='text-red'>Blocked <br class='hidden-lg'>(external, IP)";
buttontext = "";
break;
case "7":
colorClass = "text-red";
fieldtext = "Blocked <br class='hidden-lg'>(external, NULL)";
fieldtext =
"<span class='text-red'>Blocked <br class='hidden-lg'>(external, NULL)</span>";
buttontext = "";
break;
case "8":
colorClass = "text-red";
fieldtext = "Blocked <br class='hidden-lg'>(external, NXRA)";
fieldtext =
"<span class='text-red'>Blocked <br class='hidden-lg'>(external, NXRA)</span>";
buttontext = "";
break;
case "9":
colorClass = "text-red";
fieldtext = "Blocked (gravity, CNAME)";
fieldtext = "<span class='text-red'>Blocked (gravity, CNAME)</span>";
buttontext =
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
isCNAME = true;
break;
case "10":
colorClass = "text-red";
fieldtext = "Blocked <br class='hidden-lg'>(regex blacklist, CNAME)";
fieldtext =
"<span class='text-red'>Blocked <br class='hidden-lg'>(regex blacklist, CNAME)</span>";

if (data.length > 9 && data[9] > 0) {
regexLink = true;
Expand All @@ -189,32 +185,30 @@ $(function () {
isCNAME = true;
break;
case "11":
colorClass = "text-red";
fieldtext = "Blocked <br class='hidden-lg'>(exact blacklist, CNAME)";
fieldtext =
"<span class='text-red'>Blocked <br class='hidden-lg'>(exact blacklist, CNAME)</span>";
buttontext =
'<button type="button" class="btn btn-default btn-sm text-green"><i class="fas fa-check"></i> Whitelist</button>';
isCNAME = true;
break;
case "12":
colorClass = "text-green";
fieldtext = "Retried";
fieldtext = "<span class='text-green'>Retried</span>";
break;
case "13":
colorClass = "text-green";
fieldtext = "Retried <br class='hidden-lg'>(ignored)";
fieldtext = "<span class='text-green'>Retried</span> <br class='hidden-lg'>(ignored)";
break;
case "14":
colorClass = "text-green";
fieldtext = "OK <br class='hidden-lg'>(already forwarded)" + dnssecStatus;
fieldtext =
"<span class='text-green'>OK</span> <br class='hidden-lg'>(already forwarded)" +
dnssecStatus;
buttontext =
'<button type="button" class="btn btn-default btn-sm text-red"><i class="fa fa-ban"></i> Blacklist</button>';
break;
case "15":
colorClass = "text-orange";
fieldtext = "Blocked <br class='hidden-lg'>(database is busy)";
fieldtext =
"<span class='text-red'>Blocked <br class='hidden-lg'>(database is busy)</span>";
break;
default:
colorClass = false;
fieldtext = "Unknown (" + parseInt(data[4], 10) + ")";
}

Expand All @@ -226,10 +220,6 @@ $(function () {

fieldtext += '<input type="hidden" name="id" value="' + parseInt(data[4], 10) + '">';

if (colorClass !== false) {
$(row).addClass(colorClass);
}

$("td:eq(4)", row).html(fieldtext);
$("td:eq(6)", row).html(buttontext);

Expand Down