optimize query-log for small screens

Signed-off-by: Th3M3 <the_me@outlook.de>
This commit is contained in:
TheME
2017-12-10 15:15:38 +01:00
parent c2d9506bec
commit ca868ca4b3
5 changed files with 102 additions and 71 deletions
+23 -25
View File
@@ -103,31 +103,29 @@ $token = $_SESSION['token'];
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table-responsive">
<table id="all-queries" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>Time</th>
<th>Type</th>
<th>Domain</th>
<th>Client</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Time</th>
<th>Type</th>
<th>Domain</th>
<th>Client</th>
<th>Status</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
</div>
<table id="all-queries" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>Time</th>
<th>Type</th>
<th>Domain</th>
<th>Client</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Time</th>
<th>Type</th>
<th>Domain</th>
<th>Client</th>
<th>Status</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
+24 -26
View File
@@ -110,32 +110,30 @@ if(strlen($showing) > 0)
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table-responsive">
<table id="all-queries" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>Time</th>
<th>Type</th>
<th>Domain</th>
<th>Client</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Time</th>
<th>Type</th>
<th>Domain</th>
<th>Client</th>
<th>Status</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
<button type="button" id="resetButton" hidden="true">Clear Filters</button>
</div>
<table id="all-queries" class="display table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>Time</th>
<th>Type</th>
<th>Domain</th>
<th>Client</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Time</th>
<th>Type</th>
<th>Domain</th>
<th>Client</th>
<th>Status</th>
<th>Action</th>
</tr>
</tfoot>
</table>
<button type="button" id="resetButton" hidden="true">Clear Filters</button>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
+8 -8
View File
@@ -201,13 +201,13 @@ $(document).ready(function() {
else if (data[4] === 2)
{
$(row).css("color","green");
$("td:eq(4)", row).html( "OK (forwarded)" );
$("td:eq(4)", row).html( "OK <br class='hidden-lg'>(forwarded)" );
$("td:eq(5)", row).html( "<button style=\"color:red; white-space: nowrap;\"><i class=\"fa fa-ban\"></i> Blacklist</button>" );
}
else if (data[4] === 3)
{
$(row).css("color","green");
$("td:eq(4)", row).html( "OK (cached)" );
$("td:eq(4)", row).html( "OK <br class='hidden-lg'>(cached)" );
$("td:eq(5)", row).html( "<button style=\"color:red; white-space: nowrap;\"><i class=\"fa fa-ban\"></i> Blacklist</button>" );
// statistics[1]++;
@@ -215,20 +215,20 @@ $(document).ready(function() {
else if (data[4] === 4)
{
$(row).css("color","red");
$("td:eq(4)", row).html( "Pi-holed (wildcard)" );
$("td:eq(4)", row).html( "Pi-holed <br class='hidden-lg'>(wildcard)" );
$("td:eq(5)", row).html( "" );
// statistics[3]++;
}
else
{
$("td:eq(4)", row).html( "Unknown ("+data[4]+")" );
$("td:eq(4)", row).html( "Unknown <br class='hidden-lg'>("+data[4]+")" );
$("td:eq(5)", row).html( "" );
}
// statistics[0]++;
},
dom: "<'row'<'col-sm-12'f>>" +
"<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"ajax": {"url": APIstring, "error": handleAjaxError },
"autoWidth" : false,
@@ -236,12 +236,12 @@ $(document).ready(function() {
"deferRender": true,
"order" : [[0, "desc"]],
"columns": [
{ "width" : "20%", "render": function (data, type, full, meta) { if(type === "display"){return moment.unix(data).format("Y-MM-DD HH:mm:ss z");}else{return data;} }},
{ "width" : "15%", "render": function (data, type, full, meta) { if(type === "display"){return moment.unix(data).format("Y-MM-DD [<br class='hidden-lg'>]HH:mm:ss z");}else{return data;} }},
{ "width" : "10%" },
{ "width" : "40%" },
{ "width" : "20%" },
{ "width" : "10%" },
{ "width" : "10%" },
{ "width" : "10%" },
{ "width" : "5%" },
],
"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
"columnDefs": [ {
+8 -8
View File
@@ -136,26 +136,26 @@ $(document).ready(function() {
else if (data[4] === "2")
{
$(row).css("color","green");
$("td:eq(4)", row).html( "OK (forwarded)" );
$("td:eq(4)", row).html( "OK <br class='hidden-lg'>(forwarded)" );
$("td:eq(5)", row).html( "<button style=\"color:red; white-space: nowrap;\"><i class=\"fa fa-ban\"></i> Blacklist</button>" );
}
else if (data[4] === "3")
{
$(row).css("color","green");
$("td:eq(4)", row).html( "OK (cached)" );
$("td:eq(4)", row).html( "OK <br class='hidden-lg'>(cached)" );
$("td:eq(5)", row).html( "<button style=\"color:red; white-space: nowrap;\"><i class=\"fa fa-ban\"></i> Blacklist</button>" );
}
else if (data[4] === "4")
{
$(row).css("color","red");
$("td:eq(4)", row).html( "Pi-holed (wildcard)" );
$("td:eq(4)", row).html( "Pi-holed <br class='hidden-lg'>(wildcard)" );
$("td:eq(5)", row).html( "" );
}
else if (data[4] === "5")
{
$(row).css("color","red");
$("td:eq(4)", row).html( "Pi-holed (blacklist)" );
$("td:eq(4)", row).html( "Pi-holed <br class='hidden-lg'>(blacklist)" );
$("td:eq(5)", row).html( "<button style=\"color:green; white-space: nowrap;\"><i class=\"fa fa-pencil-square-o\"></i> Whitelist</button>" );
}
else
@@ -166,19 +166,19 @@ $(document).ready(function() {
},
dom: "<'row'<'col-sm-12'f>>" +
"<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"ajax": {"url": APIstring, "error": handleAjaxError },
"autoWidth" : false,
"processing": true,
"order" : [[0, "desc"]],
"columns": [
{ "width" : "20%", "render": function (data, type, full, meta) { if(type === "display"){return moment.unix(data).format("Y-MM-DD HH:mm:ss z");}else{return data;} }},
{ "width" : "15%", "render": function (data, type, full, meta) { if(type === "display"){return moment.unix(data).format("Y-MM-DD [<br class='hidden-lg'>]HH:mm:ss z");}else{return data;} }},
{ "width" : "10%" },
{ "width" : "40%", "render": $.fn.dataTable.render.text() },
{ "width" : "10%", "render": $.fn.dataTable.render.text() },
{ "width" : "10%" },
{ "width" : "20%", "render": $.fn.dataTable.render.text() },
{ "width" : "10%" },
{ "width" : "5%" },
],
"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
"columnDefs": [ {
+39 -4
View File
@@ -36,12 +36,47 @@ a.lookatme {
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
#all-queries {
table-layout: fixed;
.table-responsive {
-webkit-overflow-scrolling: touch;
}
#all-queries tbody {
word-wrap: break-word;
/* Optimize Queries-Table for small screens */
#all-queries td:nth-of-type(1), /* Time column */
#all-queries td:nth-of-type(5) { /* Status column */
white-space: nowrap;
}
#all-queries td:nth-of-type(3) { /* Domain column */
min-width: 200px;
word-break: break-all;
white-space: pre-wrap;
}
#all-queries_info { /* Allow Info String to wrap (useful while filtering entries on small screen) */
white-space: unset;
}
#all-queries_wrapper .pagination > li > a { /* adjust the buttons width */
padding-left: 6px;
padding-right: 6px;
min-width: 34px;
text-align: center;
}
@media screen and (max-width: 500px),
screen and (min-width: 767px) and (max-width: 1000px) {
/* Hide "Previous" & "Next"-Buttons in Pagination */
#all-queries_wrapper .pagination > li.previous,
#all-queries_wrapper .pagination > li.next {
display: none;
}
#all-queries_wrapper .pagination > li:nth-of-type(2) a {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
#all-queries_wrapper .pagination > li:nth-last-of-type(2) a {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
}
.main-header>.navbar {
height: 50px;
}