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 @@ + +