From 745fa9c94ba17cbc8708dd0da549cb9e72554b6b Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Thu, 3 Nov 2016 08:27:19 +0000 Subject: [PATCH 1/7] Same logic as https://github.com/pi-hole/pi-hole/pull/891 --- data.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data.php b/data.php index 7828f9fe..5b4462bb 100644 --- a/data.php +++ b/data.php @@ -1,13 +1,13 @@ Date: Sun, 13 Nov 2016 18:57:25 +0100 Subject: [PATCH 2/7] Add possibility to blacklist/whitelist entries on the Queries page. --- data.php | 1 + js/pihole/queries.js | 37 ++++++++++++++++++++++++++++++++----- queries.php | 11 +++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/data.php b/data.php index 7828f9fe..64289cd9 100644 --- a/data.php +++ b/data.php @@ -150,6 +150,7 @@ $domain, hasHostName($client), $status, + "" )); } diff --git a/js/pihole/queries.js b/js/pihole/queries.js index d13008dc..9f2c7aa8 100644 --- a/js/pihole/queries.js +++ b/js/pihole/queries.js @@ -16,12 +16,39 @@ $(document).ready(function() { { "width" : "20%", "type": "date" }, { "width" : "10%" }, { "width" : "40%" }, - { "width" : "15%" }, - { "width" : "15%" } - ] - }) + { "width" : "12.5%" }, + { "width" : "12.5%" }, + { "width" : "5%" }, + ], + "columnDefs": [ { + "targets": -1, + "data": null, + "defaultContent": "" + } ] + }); + $('#all-queries tbody').on( 'click', 'button', function () { + var data = tableApi.row( $(this).parents('tr') ).data(); + if (data[4] == "Pi-holed") + { + add(data[2],"white"); + } + else + { + add(data[2],"black"); + } + } ); } ); function refreshData() { tableApi.ajax.url("api.php?getAllQueries").load(); -} \ No newline at end of file +} + +function add(domain,list) { + var token = $("#token").html(); + $.ajax({ + url: "php/add.php", + method: "post", + data: {"domain":domain, "list":list, "token":token} +// success: function(response) { alert(response); } + }); +} diff --git a/queries.php b/queries.php index 07046bed..20f2ead9 100644 --- a/queries.php +++ b/queries.php @@ -1,6 +1,15 @@ + + + + + + + +
From d7a6412d7a4310fbe723cf98ea0f6546ab199ddb Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 14 Nov 2016 10:52:54 +0100 Subject: [PATCH 6/7] Display which domain will be added to the black-/whitelist --- js/pihole/queries.js | 5 +++++ queries.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/js/pihole/queries.js b/js/pihole/queries.js index db365f9f..2436b911 100644 --- a/js/pihole/queries.js +++ b/js/pihole/queries.js @@ -49,6 +49,8 @@ function add(domain,list) { var token = $("#token").html(); var alInfo = $("#alInfo"); var alList = $("#alList"); + var alDomain = $("#alDomain"); + alDomain.html(domain); var alSuccess = $("#alSuccess"); var alFailure = $("#alFailure"); @@ -78,6 +80,7 @@ function add(domain,list) { alInfo.delay(1000).fadeOut(2000, function() { alInfo.hide(); alList.html(""); + alDomain.html(""); }); } else { alSuccess.show(); @@ -87,6 +90,7 @@ function add(domain,list) { alInfo.delay(1000).fadeOut(2000, function() { alInfo.hide(); alList.html(""); + alDomain.html(""); }); } }, @@ -98,6 +102,7 @@ function add(domain,list) { alInfo.delay(1000).fadeOut(2000, function() { alInfo.hide(); alList.html(""); + alDomain.html(""); }); } }); diff --git a/queries.php b/queries.php index 5ec01f61..43549289 100644 --- a/queries.php +++ b/queries.php @@ -22,7 +22,7 @@ $token = $_SESSION['token'];