diff --git a/front/deviceDetails.php b/front/deviceDetails.php index 7bda2d1f..174fb385 100755 --- a/front/deviceDetails.php +++ b/front/deviceDetails.php @@ -594,6 +594,7 @@ if ($_REQUEST['mac'] == 'Internet') { Extra + Nothing sniffed out with Polus for this device. @@ -1653,6 +1654,119 @@ function loadPholus() }); } +// function loadPholus() +// { +// tableId = "tablePholus"; + + +// $.get('php/server/devices.php?action=getPholus&mac='+ mac, function(data) { + + +// console.log("here URL mac:" + mac) +// console.log("here table mac:" + $("#"+tableId).attr("data-mac")) +// console.log("here") + +// // check if already initialized +// if($("#"+tableId).attr("data-mac") == mac) +// { +// console.log("return") +// return; +// } + + + +// initTable(tableId, mac); + +// data = sanitize(data); + +// if(data != "false" && $.trim(data) != []) +// { +// var listData = JSON.parse(data); +// var order = 1; + +// tableRows = ""; + +// // for each item +// listData.forEach(function (item, index) { +// tableRows += ''+item.Index+''+item.Info+''+item.Time+''+item.IP_v4_or_v6+''+item.Record_Type+''+item.Value+''+item.Extra+''; +// }); + +// $("#tablePholus tbody").first().html(tableRows); +// // $("#tablePholusPlc").attr("style", "display:none"); +// // $("#tablePholusPlc").hide(); +// } +// else +// { +// // console.log("else") +// // $("#tablePholusPlc").show(); +// // $(".deviceSpecific").remove(); +// } + + + + +// }); +// } + + +function initTable(tableId, mac){ + + // clear table + $("#"+tableId+" tbody").remove(); + + // Events datatable + $('#'+tableId).DataTable({ + 'paging' : true, + 'lengthChange': true, + 'lengthMenu' : [[10, 25, 50, 100, 500, -1], [10, 25, 50, 100, 500, 'All']], + 'searching' : true, + 'ordering' : true, + 'info' : true, + 'autoWidth' : false, + 'order' : [[0,'desc']], + + // Parameters + 'pageLength' : 50, + + 'columnDefs' : [ + // Replace HTML codes + {targets: [0], + 'createdCell': function (td, cellData, rowData, row, col) { + $(td).html (translateHTMLcodes (cellData)); + } } + ], + + // Processing + 'processing' : true, + 'language' : { + processing: ''+ + '
Loading...'+ + '
', + emptyTable: 'No data', + "lengthMenu": "", + "search": ": ", + "paginate": { + "next": "", + "previous": "" + }, + "info": "", + } +}); + +$("#"+tableId).attr("data-mac", mac) + +// Save Parameters rows & order when changed +$('#'+tableId).on( 'length.dt', function ( e, settings, len ) { + setParameter (parSessionsRows, len); + + // Sync Rows in both datatables + // if ( $('#tableEvents').DataTable().page.len() != len) { + // $('#tableEvents').DataTable().page.len( len ).draw(); + // } +} ); + +} + window.onload = function async() { initializeTabsNew(); diff --git a/front/php/server/parameters.php b/front/php/server/parameters.php index 42275d8d..b1d027fc 100755 --- a/front/php/server/parameters.php +++ b/front/php/server/parameters.php @@ -46,7 +46,7 @@ function getParameter() { $value = getCache($parameter); } - // query the database if no cache entry found + // query the database if no cache entry found or requesting live data for the Back_App_State in the header if($parameter == "Back_App_State" || $value == "" ) { // Open DB @@ -67,10 +67,8 @@ function getParameter() { // update cookie cache setCache($parameter, $value); } - - // displayMessage ($value); - echo (json_encode ($value)); - + // return value + echo (json_encode ($value)); }