Merge pull request #938 from pi-hole/fix/query_table_aditional_sorting_by_id

Fix sorting of queries with identical timestamps
This commit is contained in:
Mark Drobnak
2019-05-22 15:40:24 -04:00
committed by GitHub
2 changed files with 24 additions and 9 deletions

View File

@@ -244,7 +244,6 @@ $(document).ready(function() {
tableApi = $("#all-queries").DataTable( {
"rowCallback": function( row, data, index ){
var blocked, fieldtext, buttontext, color;
switch (data[4])
{
case 1:
@@ -310,13 +309,23 @@ $(document).ready(function() {
"<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"ajax": {"url": APIstring, "error": handleAjaxError },
"ajax": {
"url": APIstring,
"error": handleAjaxError,
"dataSrc": function(data){
var dataIndex = 0;
return data.data.map(function(x){
x[0] = x[0] * 1e6 + (dataIndex++);
return x;
});
}
},
"autoWidth" : false,
"processing": true,
"deferRender": true,
"order" : [[0, "desc"]],
"columns": [
{ "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" : "15%", "render": function (data, type, full, meta) { if(type === "display"){return moment.unix(Math.floor(data/1e6)).format("Y-MM-DD [<br class='hidden-lg'>]HH:mm:ss z");}else{return data;} }},
{ "width" : "10%" },
{ "width" : "40%" },
{ "width" : "20%" },
@@ -353,4 +362,3 @@ $("#querytime").on("apply.daterangepicker", function(ev, picker) {
$(this).val(picker.startDate.format(dateformat) + " to " + picker.endDate.format(dateformat));
refreshTableData();
});

View File

@@ -152,7 +152,6 @@ $(document).ready(function() {
tableApi = $("#all-queries").DataTable( {
"rowCallback": function( row, data, index ){
// DNSSEC status
var dnssec_status;
switch (data[5])
@@ -299,12 +298,22 @@ $(document).ready(function() {
"<'row'<'col-sm-4'l><'col-sm-8'p>>" +
"<'row'<'col-sm-12'<'table-responsive'tr>>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"ajax": {"url": APIstring, "error": handleAjaxError },
"ajax": {
"url": APIstring,
"error": handleAjaxError,
"dataSrc": function(data){
var dataIndex = 0;
return data.data.map(function(x){
x[0] = x[0] * 1e6 + (dataIndex++);
return x;
});
}
},
"autoWidth" : false,
"processing": true,
"order" : [[0, "desc"]],
"columns": [
{ "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" : "15%", "render": function (data, type, full, meta) { if(type === "display"){return moment.unix(Math.floor(data/1e6)).format("Y-MM-DD [<br class='hidden-lg'>]HH:mm:ss z");}else{return data;} }},
{ "width" : "4%" },
{ "width" : "36%", "render": $.fn.dataTable.render.text() },
{ "width" : "8%", "render": $.fn.dataTable.render.text() },
@@ -376,5 +385,3 @@ $(document).ready(function() {
$("#resetButton").click( function () { tableApi.search("").draw(); $("#resetButton").hide(); } );
} );