mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Fix for top scripts: the code was not discarding non .lua files
This commit is contained in:
parent
5f7d8ae2ec
commit
83fe0afb99
4 changed files with 172 additions and 163 deletions
|
|
@ -33,15 +33,17 @@ function makeTopJSON(ifid, ifname)
|
|||
..vlan_list[key]["vlan_bytes"]..",\n"
|
||||
file_cnt = 0
|
||||
for k,v in pairs(files) do
|
||||
if (v ~= nil) then
|
||||
fn,ext = v:match("([^.]+).lua")
|
||||
local topClass = require("top_scripts."..fn)
|
||||
if (topClass.getTopBy ~= nil) then
|
||||
rsp = rsp..topClass.getTopBy(ifid, ifname, "vlan", key)
|
||||
rsp = rsp..",\n"
|
||||
file_cnt = file_cnt + 1
|
||||
end
|
||||
end
|
||||
if(string.ends(k, ".lua")) then
|
||||
if (v ~= nil) then
|
||||
fn,ext = v:match("([^.]+).lua")
|
||||
local topClass = require("top_scripts."..fn)
|
||||
if (topClass.getTopBy ~= nil) then
|
||||
rsp = rsp..topClass.getTopBy(ifid, ifname, "vlan", key)
|
||||
rsp = rsp..",\n"
|
||||
file_cnt = file_cnt + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if (file_cnt > 0) then
|
||||
-- Remove last return and comma to comply with JSON format
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue