mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Implements user script filters getter
This commit is contained in:
parent
9a191d19ba
commit
211d678bd5
1 changed files with 14 additions and 1 deletions
|
|
@ -1086,7 +1086,6 @@ function user_scripts.updateScriptConfig(confid, script_key, subdir, new_config,
|
|||
local script = user_scripts.loadModule(interface.getId(), script_type, subdir, script_key)
|
||||
|
||||
if(script) then
|
||||
|
||||
-- Try to validate the configuration
|
||||
for hook, conf in pairs(new_config) do
|
||||
local valid = true
|
||||
|
|
@ -1490,6 +1489,20 @@ end
|
|||
|
||||
-- ##############################################
|
||||
|
||||
-- @brief Retrieve `subdir` filters from the configset identified with `configset_id` from all the available `configsets` passed
|
||||
function user_scripts.getFiltersById(configsets, configset_id, subdir)
|
||||
configset_id = tonumber(configset_id) or user_scripts.DEFAULT_CONFIGSET_ID
|
||||
local configset = configsets[configset_id] or configsets[user_scripts.DEFAULT_CONFIGSET_ID]
|
||||
|
||||
if configset and configset["filters"] and configset["filters"][subdir] then
|
||||
return configset["filters"][subdir], configset.id
|
||||
end
|
||||
|
||||
return {}, nil
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function user_scripts.getDefaultConfig(configsets, subdir)
|
||||
local conf = configsets[user_scripts.DEFAULT_CONFIGSET_ID]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue