Merge pull request #39 from mhoffmann75/master

Preventing some errors and showing all leases without search
This commit is contained in:
Chris Miles 2020-01-07 17:19:31 -06:00 committed by GitHub
commit 10102a6709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 6 deletions

View File

@ -10,7 +10,7 @@ router.get('/', function (req, res, next) {
/* Mac OUI Lookup */
var mac_oui = "";
if (typeof dhcp_lease_data[key].mac.split(":").join("") !== "undefined") {
if (typeof dhcp_lease_data[key].mac !== "undefined") {
mac_oui = dhcp_lease_data[key].mac.split(":").join("").toUpperCase().slice(0, 6);
}
@ -41,4 +41,4 @@ router.get('/', function (req, res, next) {
res.send(JSON.stringify(stat_data));
});
module.exports = router;
module.exports = router;

View File

@ -19,7 +19,13 @@
</div>
<script type="text/javascript">
/*
$( document ).ready(function() {
var e = jQuery.Event("keypress");
e.which = 13; // Enter
e.keyCode = 13;
$("#lease_search_criteria").trigger(e);
});
/*
$('#display-leases').DataTable({
dom: 'tip',
responsive: true,
@ -27,4 +33,4 @@
"aaSorting": []
});
*/
</script>
</script>

View File

@ -47,11 +47,14 @@ router.post('/', function(req, res, next) {
table_row = table_row + '<td>' + (dhcp_lease_data[key].host ? dhcp_lease_data[key].host : '') + '</td>';
table_row = table_row + '<td>' + human_time(dhcp_lease_data[key].start * 1000) + '</td>';
table_row = table_row + '<td>' + human_time(dhcp_lease_data[key].end * 1000) + '</td>';
table_row = table_row + '<td>' +
if (typeof dhcp_lease_data[key].mac !== "undefined" ) {
table_row = table_row + '<td>' +
'<button class="btn btn-default waves-effect option_data" lease="' + dhcp_lease_data[key].mac.split(":").join("") + '">Show</button>' +
'<pre style="display:none;margin-top:10px" id="' + dhcp_lease_data[key].mac.split(":").join("") + '">' + JSON.stringify(dhcp_lease_data[key].options, null, 2) + '</pre>' +
'</td>';
} else {
table_row = table_row + '<td></td>';
}
table_data = table_data + '<tr>' + table_row + '</tr>';
count++;