Update dhcp_lease_search.js

I was unable to search the "Leases" by IP. I moved the Key match and it started working. After change, I am now able to search by IP.
This commit is contained in:
ASteffen117 2019-04-08 15:20:46 -04:00 committed by GitHub
parent bb7117ca0f
commit 47bb33b14a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -29,14 +29,12 @@ router.post('/', function(req, res, next) {
var matcher = new RegExp(search, "i");
// console.log(dhcp_lease_data[key]);
if(!matcher.test(JSON.stringify(dhcp_lease_data[key])))
continue;
if(
!matcher.test(dhcp_lease_data[key].mac_oui_vendor)
&& !matcher.test(dhcp_lease_data[key].host)
&& !matcher.test(key)
&& !matcher.test(JSON.stringify(dhcp_lease_data[key]))
&& !matcher.test(dhcp_lease_data[key].mac)
&& !matcher.test(JSON.stringify(dhcp_lease_data[key].options, null, 2))
)
@ -69,4 +67,4 @@ router.post('/', function(req, res, next) {
res.send(table_data);
});
module.exports = router;
module.exports = router;