Fixes incorrect rest api data

This commit is contained in:
MatteoBiscosi 2023-01-31 13:16:18 +01:00
parent 6bc6b49cfa
commit ccb2a66c19
2 changed files with 9 additions and 7 deletions

View file

@ -1636,7 +1636,7 @@ local known_parameters = {
["count"] = validateSingleWord, -- Sql count parameter
["aggregation"] = validateAggregation, -- A mode for graphs aggregation
["limit"] = validateNumber, -- To limit results
["all"] = validateEmpty, -- To remove limit on results
["all"] = validateBool, -- To remove limit on results
-- NAVIGATION
["page"] = validateSingleWord, -- Currently active subpage tab

View file

@ -110,7 +110,10 @@ elseif mode == "dhcp" then
dhcp_hosts = true
end
if all ~= nil then
perPage = -1
currentPage = 0
end
local hosts_stats = hosts_retrv_function(false, sortColumn, perPage, to_skip, sOrder,
country, os_, tonumber(vlan), tonumber(asn),
@ -131,11 +134,6 @@ if hosts_stats == nil then
return
end
if all ~= nil then
perPage = 0
currentPage = 0
end
function get_host_name(h)
if h["name"] == nil then
if h["ip"] ~= nil then
@ -232,6 +230,10 @@ for _key, _value in pairsByKeys(vals, funct) do
record["name"] = name
record["score"] = {}
record["score"]["total"] = value["score"]
record["score"]["as_client"] = value["score.as_client"]
record["score"]["as_server"] = value["score.as_server"]
record["thpt"] = {}
record["thpt"]["pps"] = value["throughput_pps"]
record["thpt"]["bps"] = value["throughput_bps"]*8