Merge pull request #1541 from pi-hole/fix/wording_query_log_links

Fix a few UI issues
This commit is contained in:
DL6ER
2020-08-15 13:07:37 +02:00
committed by GitHub
4 changed files with 50 additions and 1 deletions

View File

@@ -288,6 +288,11 @@ else
// Get specific domain only
sendRequestFTL("getallqueries-domain ".$_GET['domain']);
}
else if(isset($_GET['client']) && (isset($_GET['type']) && $_GET['type'] === "blocked"))
{
// Get specific client only
sendRequestFTL("getallqueries-client-blocked ".$_GET['client']);
}
else if(isset($_GET['client']))
{
// Get specific client only

View File

@@ -28,6 +28,10 @@ if(isset($setupVars["API_QUERY_LOG_SHOW"]))
$showing = "showing no queries (due to setting)";
}
}
else if(isset($_GET["type"]) && $_GET["type"] === "blocked")
{
$showing = "showing blocked";
}
else
{
// If filter variable is not set, we
@@ -44,6 +48,24 @@ else if(isset($_GET["client"]))
{
$showing .= " queries for client ".htmlentities($_GET["client"]);
}
else if(isset($_GET["forwarddest"]))
{
if($_GET["forwarddest"] === "blocklist")
$showing .= " queries answered from blocklists";
elseif($_GET["forwarddest"] === "cache")
$showing .= " queries answered from cache";
else
$showing .= " queries for upstream destination ".htmlentities($_GET["forwarddest"]);
}
else if(isset($_GET["querytype"]))
{
$qtypes = ["A (IPv4)", "AAAA (IPv6)", "ANY", "SRV", "SOA", "PTR", "TXT", "NAPTR"];
$qtype = intval($_GET["querytype"]);
if($qtype > 0 && $qtype <= count($qtypes))
$showing .= " ".$qtypes[$qtype-1]." queries";
else
$showing .= " type ".$qtype." queries";
}
else if(isset($_GET["domain"]))
{
$showing .= " queries for domain ".htmlentities($_GET["domain"]);

View File

@@ -592,7 +592,7 @@ function updateTopClientsChart() {
url =
'<a href="queries.php?client=' +
clientip +
'" title="' +
'&type=blocked" title="' +
clientip +
'">' +
clientname +
@@ -1001,6 +1001,24 @@ $(function () {
return false;
});
$("#clientsChart").click(function (evt) {
var activePoints = clientsChart.getElementAtEvent(evt);
if (activePoints.length > 0) {
//get the internal index of slice in pie chart
var clickedElementindex = activePoints[0]._index;
//get specific label by index
var label = clientsChart.data.labels[clickedElementindex];
//get value by index
var from = label / 1000 - 300;
var until = label / 1000 + 300;
window.location.href = "queries.php?from=" + from + "&until=" + until;
}
return false;
});
if (document.getElementById("queryTypePieChart")) {
ctx = document.getElementById("queryTypePieChart").getContext("2d");
queryTypePieChart = new Chart(ctx, {

View File

@@ -148,6 +148,10 @@ $(function () {
APIstring += "=100";
}
if ("type" in GETDict) {
APIstring += "&type=" + GETDict.type;
}
tableApi = $("#all-queries").DataTable({
rowCallback: function (row, data) {
// DNSSEC status