diff --git a/front/deviceDetailsTools.php b/front/deviceDetailsTools.php index 93fdedb1..af8b1618 100755 --- a/front/deviceDetailsTools.php +++ b/front/deviceDetailsTools.php @@ -1,5 +1,5 @@ diff --git a/front/js/pialert_common.js b/front/js/pialert_common.js index d8e7e891..f5a88e0b 100755 --- a/front/js/pialert_common.js +++ b/front/js/pialert_common.js @@ -486,39 +486,39 @@ function navigateToDeviceWithIp (ip) { // ----------------------------------------------------------------------------- function getNameByMacAddress(macAddress) { - return getDeviceDataByMacAddress(macAddress, "name") + return getDeviceDataByMacAddress(macAddress, "dev_Name") } +// ----------------------------------------------------------------------------- +// function getDeviceDataByMacAddress(macAddress, property) { + +// const sessionDataKey = 'devicesListAll'; +// const sessionData = sessionStorage.getItem(sessionDataKey); + +// if (!sessionData) { +// console.log(`Session variable "${sessionDataKey}" not found.`); +// return "Unknown"; +// } + +// const devices = JSON.parse(sessionData); + +// for (const device of devices) { +// if (device.mac === macAddress) { +// if ( device.mac == 'd2:a4:1a:74:ae:86') +// { +// console.log(device) +// } + +// return device[property]; +// } +// } + +// return "Unknown"; // Return a default value if MAC address is not found +// } + // ----------------------------------------------------------------------------- function getDeviceDataByMacAddress(macAddress, property) { - const sessionDataKey = 'devicesListAll'; - const sessionData = sessionStorage.getItem(sessionDataKey); - - if (!sessionData) { - console.log(`Session variable "${sessionDataKey}" not found.`); - return "Unknown"; - } - - const devices = JSON.parse(sessionData); - - for (const device of devices) { - if (device.mac === macAddress) { - if ( device.mac == 'd2:a4:1a:74:ae:86') - { - console.log(device) - } - - return device[property]; - } - } - - return "Unknown"; // Return a default value if MAC address is not found -} - -// ----------------------------------------------------------------------------- -function getDeviceDataByMacAddress_NEW(macAddress, property) { - const sessionDataKey = 'devicesListAll_JSON'; const sessionData = sessionStorage.getItem(sessionDataKey); @@ -529,9 +529,11 @@ function getDeviceDataByMacAddress_NEW(macAddress, property) { const devices = JSON.parse(sessionData); + console.log(devices) + for (const device of devices) { - if (device.mac === macAddress) { - if ( device.mac == 'd2:a4:1a:74:ae:86') + if (device["dev_MAC"].toLowerCase() === macAddress.toLowerCase()) { + if ( device["dev_MAC"].toLowerCase() == 'd2:a4:1a:74:ae:86') { console.log(device) } diff --git a/front/php/server/nslookup.php b/front/php/server/nslookup.php old mode 100644 new mode 100755