mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Merge pull request #683 from pi-hole/new/queryLog-showlast100
Query Log: Show last 100 queries by default
This commit is contained in:
@@ -230,6 +230,10 @@ if (isset($_GET['getAllQueries']) && $auth)
|
||||
// Get specific client only
|
||||
sendRequestFTL("getallqueries-client ".$_GET['client']);
|
||||
}
|
||||
else if(is_numeric($_GET['getAllQueries']))
|
||||
{
|
||||
sendRequestFTL("getallqueries (".$_GET['getAllQueries'].")");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get all queries
|
||||
|
||||
+15
-11
@@ -19,47 +19,49 @@ if(isset($setupVars["API_QUERY_LOG_SHOW"]))
|
||||
{
|
||||
if($setupVars["API_QUERY_LOG_SHOW"] === "all")
|
||||
{
|
||||
$showing = "showing all queries";
|
||||
$showing = "showing";
|
||||
}
|
||||
elseif($setupVars["API_QUERY_LOG_SHOW"] === "permittedonly")
|
||||
{
|
||||
$showing = "showing permitted queries only";
|
||||
$showing = "showing permitted";
|
||||
}
|
||||
elseif($setupVars["API_QUERY_LOG_SHOW"] === "blockedonly")
|
||||
{
|
||||
$showing = "showing blocked queries only";
|
||||
$showing = "showing blocked";
|
||||
}
|
||||
elseif($setupVars["API_QUERY_LOG_SHOW"] === "nothing")
|
||||
{
|
||||
$showing = "showing no queries at all";
|
||||
$showing = "showing no queries (due to setting)";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If filter variable is not set, we
|
||||
// automatically show all queries
|
||||
$showing = "showing all queries";
|
||||
$showing = "showing queries";
|
||||
}
|
||||
|
||||
$showall = false;
|
||||
if(isset($_GET["all"]))
|
||||
{
|
||||
$showing .= " within the Pi-hole log";
|
||||
$showing .= " all queries within the Pi-hole log";
|
||||
}
|
||||
else if(isset($_GET["client"]))
|
||||
{
|
||||
$showing .= " for client ".htmlentities($_GET["client"]);
|
||||
$showing .= " queries for client ".htmlentities($_GET["client"]);
|
||||
}
|
||||
else if(isset($_GET["domain"]))
|
||||
{
|
||||
$showing .= " for domain ".htmlentities($_GET["domain"]);
|
||||
$showing .= " queries for domain ".htmlentities($_GET["domain"]);
|
||||
}
|
||||
else if(isset($_GET["from"]) && isset($_GET["until"]))
|
||||
else if(isset($_GET["from"]) || isset($_GET["until"]))
|
||||
{
|
||||
$showing .= " within limited time interval";
|
||||
$showing .= " queries within specified time interval";
|
||||
}
|
||||
else
|
||||
{
|
||||
$showing .= " within recent 10 minutes, <a href=\"?all\">show all</a>";
|
||||
$showing .= " up to 100 queries";
|
||||
$showall = true;
|
||||
}
|
||||
|
||||
if(isset($setupVars["API_PRIVACY_MODE"]))
|
||||
@@ -74,6 +76,8 @@ if(isset($setupVars["API_PRIVACY_MODE"]))
|
||||
if(strlen($showing) > 0)
|
||||
{
|
||||
$showing = "(".$showing.")";
|
||||
if($showall)
|
||||
$showing .= ", <a href=\"?all\">show all</a>";
|
||||
}
|
||||
?>
|
||||
<!-- Send PHP info to JS -->
|
||||
|
||||
@@ -82,7 +82,7 @@ function add(domain,list) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Reset Modal after it has faded out
|
||||
alertModal.one("hidden.bs.modal", function() {
|
||||
alProcessing.show();
|
||||
@@ -136,11 +136,10 @@ $(document).ready(function() {
|
||||
{
|
||||
APIstring += "&domain="+GETDict["domain"];
|
||||
}
|
||||
// If we don't ask filtering and also not for all queries, just request the most recent 100 queries
|
||||
else if(!("all" in GETDict))
|
||||
{
|
||||
var timestamp = Math.floor(Date.now() / 1000);
|
||||
APIstring += "&from="+(timestamp - 600);
|
||||
APIstring += "&until="+(timestamp + 100);
|
||||
APIstring += "=100";
|
||||
}
|
||||
|
||||
tableApi = $("#all-queries").DataTable( {
|
||||
|
||||
Reference in New Issue
Block a user