Merge pull request #39 from mhoffmann75/master
Preventing some errors and showing all leases without search
This commit is contained in:
commit
10102a6709
|
@ -10,7 +10,7 @@ router.get('/', function (req, res, next) {
|
||||||
|
|
||||||
/* Mac OUI Lookup */
|
/* Mac OUI Lookup */
|
||||||
var mac_oui = "";
|
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);
|
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));
|
res.send(JSON.stringify(stat_data));
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -19,7 +19,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<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({
|
$('#display-leases').DataTable({
|
||||||
dom: 'tip',
|
dom: 'tip',
|
||||||
responsive: true,
|
responsive: true,
|
||||||
|
@ -27,4 +33,4 @@
|
||||||
"aaSorting": []
|
"aaSorting": []
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -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>' + (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].start * 1000) + '</td>';
|
||||||
table_row = table_row + '<td>' + human_time(dhcp_lease_data[key].end * 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>' +
|
'<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>' +
|
'<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>';
|
'</td>';
|
||||||
|
} else {
|
||||||
|
table_row = table_row + '<td></td>';
|
||||||
|
}
|
||||||
table_data = table_data + '<tr>' + table_row + '</tr>';
|
table_data = table_data + '<tr>' + table_row + '</tr>';
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
Loading…
Reference in New Issue