Skip to content

Commit 7dc6ded

Browse files
committed
Count all inactive devices (wired & wireless)
1 parent 6d9bb75 commit 7dc6ded

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

build/lua/additional/common/devices/www/lua/devicescard_helper.lua

+9-7
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ local M = {}
1212
function M.getDevicesCardHTML(all)
1313
local devices_data = {
1414
numWireless = "sys.hosts.WirelessNumberOfEntries",
15+
numEthernet = "sys.hosts.EthernetNumberOfEntries",
1516
activeWireless = "sys.hosts.ActiveWirelessNumberOfEntries",
16-
numEthernet = "sys.hosts.ActiveEthernetNumberOfEntries",
17+
activeEthernet = "sys.hosts.ActiveEthernetNumberOfEntries",
1718
}
1819
content_helper.getExactContent(devices_data)
1920

@@ -33,10 +34,11 @@ function M.getDevicesCardHTML(all)
3334
end
3435

3536
local nEth = tonumber(devices_data["numEthernet"]) or 0
36-
local nWiFi = tonumber(devices_data["activeWireless"]) or 0
37-
local iWiFi = (tonumber(devices_data["numWireless"]) or 0) - nWiFi
37+
local activeEth = tonumber(devices_data["activeEthernet"]) or 0
38+
local activeWiFi = tonumber(devices_data["activeWireless"]) or 0
39+
local inactive = ((tonumber(devices_data["numWireless"]) or 0) - activeWiFi) + (nEth - activeEth)
3840
if multiap and nAgtDevices > 0 and nEth > nAgtDevices then
39-
nEth = nEth - nAgtDevices
41+
activeEth = nEth - nAgtDevices
4042
end
4143

4244
local bwstats_enabled = proxy.get("rpc.gui.bwstats.enabled")
@@ -45,15 +47,15 @@ function M.getDevicesCardHTML(all)
4547

4648
html[#html+1] = '<span class="simple-desc">'
4749
html[#html+1] = '<i class="icon-link status-icon"></i>'
48-
html[#html+1] = format(N('<strong %s>%d ethernet device</strong> connected','<strong %s>%d ethernet devices</strong> connected',nEth),device_modal_link,nEth)
50+
html[#html+1] = format(N('<strong %s>%d ethernet device</strong> connected','<strong %s>%d ethernet devices</strong> connected',activeEth),device_modal_link,activeEth)
4951
html[#html+1] = '</span>'
5052
html[#html+1] = '<span class="simple-desc">'
5153
html[#html+1] = '<i class="icon-wifi status-icon"></i>'
52-
html[#html+1] = format(N('<strong %s>%d Wi-Fi device</strong> active','<strong %s>%d Wi-Fi devices</strong> active',nWiFi),device_modal_link,nWiFi)
54+
html[#html+1] = format(N('<strong %s>%d Wi-Fi device</strong> active','<strong %s>%d Wi-Fi devices</strong> active',activeWiFi),device_modal_link,activeWiFi)
5355
html[#html+1] = '</span>'
5456
html[#html+1] = '<span class="simple-desc">'
5557
html[#html+1] = '<i class="icon-wifi" style="color:grey"></i>'
56-
html[#html+1] = format(N('<strong %s>%d Wi-Fi device</strong> inactive','<strong %s>%d Wi-Fi devices</strong> inactive',iWiFi),all_devices_modal_link,iWiFi)
58+
html[#html+1] = format(N('<strong %s>%d device</strong> inactive','<strong %s>%d devices</strong> inactive',inactive),all_devices_modal_link,inactive)
5759
html[#html+1] = '</span>'
5860
if all and multiap then
5961
html[#html+1] = '<span class="simple-desc">'

0 commit comments

Comments
 (0)