diff --git a/server/src/lib/ciscoController.js b/server/src/lib/ciscoController.js index 96fbc64..1495acf 100644 --- a/server/src/lib/ciscoController.js +++ b/server/src/lib/ciscoController.js @@ -75,6 +75,8 @@ function getDevices() { (devices = devices.concat(pageDevices)) ) + devices = devices.filter(device => device.ST == 'Online') + resolve(devices) } catch (e) { logError({ @@ -92,26 +94,28 @@ export async function getOnlineWifiDevices() { const now = new Date() - const restructuredOnlineDevices = onlineDevices.map(client => ({ - user: client.Name == 'unknown' ? null : client.Name, - identity: client.Name == 'unknown' ? null : client.Name, - oui: ouiFinder(client.macaddr), - mac: client.macaddr, - hostname: client.HN == 'unknown' ? undefined : client.HN, - firstSeen: undefined, - lastSeen: now, - essid: client.SSID, - ip: client.IP, - uptime: +client.UT, - apName: client.AP, - status: client.ST == 'Online' ? 'ONLINE' : 'OFFLINE', - controller: 'Cisco', - signalStrength: client.SS || null, - frequency: client.FB, - protocol: client.PT, - speed: client.SD, - usage: client.bytes_total || 0 - })) + const restructuredOnlineDevices = onlineDevices.map(client => { + return { + user: client.Name == 'unknown' ? null : client.Name, + identity: client.Name == 'unknown' ? null : client.Name, + oui: ouiFinder(client.macaddr), + mac: client.macaddr, + hostname: client.HN == 'unknown' ? undefined : client.HN, + firstSeen: undefined, + lastSeen: now, + essid: client.SSID, + ip: client.IP, + uptime: +client.UT, + apName: client.AP, + status: client.ST == 'Online' ? 'ONLINE' : 'OFFLINE', + controller: 'Cisco', + signalStrength: client.SS || null, + frequency: client.FB, + protocol: client.PT, + speed: client.SD, + usage: client.bytes_total || 0 + } + }) return restructuredOnlineDevices }