Filter offline clients

This commit is contained in:
Douglas Barone 2022-12-13 08:04:27 -04:00
parent 21be34ee3a
commit 8368d3fede

View File

@ -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
}