Add missing user scripts gui labels

This commit is contained in:
emanuele-f 2020-01-07 19:03:35 +01:00
parent d5638ef278
commit 481a00a2ad
14 changed files with 112 additions and 4 deletions

View file

@ -478,7 +478,7 @@ function user_scripts.load(ifid, script_type, subdir, options)
end
if((not user_script.gui) or (not user_script.gui.i18n_title) or (not user_script.gui.i18n_description)) then
traceError(TRACE_DEBUG, TRACE_CONSOLE, string.format("Module '%s' does not define a gui", mod_fname))
traceError(TRACE_WARNING, TRACE_CONSOLE, string.format("Module '%s' does not define a gui", mod_fname))
end
-- Augument with additional attributes
@ -751,7 +751,13 @@ end
-- ##############################################
local cached_config_sets = nil
function user_scripts.getConfigsets()
if cached_config_sets then
return(cached_config_sets)
end
local configsets = ntop.getHashAllCache(CONFIGSETS_KEY) or {}
local rv = {}
@ -763,6 +769,9 @@ function user_scripts.getConfigsets()
end
end
-- Cache to avoid loading them again
cached_config_sets = rv
return(rv)
end
@ -934,6 +943,25 @@ end
-- ##############################################
-- Returns true if a system script is enabled for some hook
function user_scripts.isSystemScriptEnabled(script_key)
local configsets = user_scripts.getConfigsets()
local default_config = user_scripts.getDefaultConfig(configsets, "system")
local script_config = default_config[script_key]
if(script_config) then
for _, hook in pairs(script_config) do
if(hook.enabled) then
return(true)
end
end
end
return(false)
end
-- ##############################################
local default_config = {
enabled = false,
script_conf = {},