mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 10:41:34 +00:00
Add required modules in report templates. Add vs_utils.is_available.
This commit is contained in:
parent
2b7016e486
commit
bf93ebd29c
4 changed files with 31 additions and 6 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/vulnerability_scan/?.lua;" .. package.path
|
||||
|
||||
require "lua_utils"
|
||||
require "lua_utils_get"
|
||||
|
|
@ -12,11 +13,18 @@ local rest_utils = require "rest_utils"
|
|||
local lua_path_utils = require "lua_path_utils"
|
||||
local file_utils = require "file_utils"
|
||||
local json = require "dkjson"
|
||||
local vs_utils = require "vs_utils"
|
||||
|
||||
local dashboard_utils = {}
|
||||
|
||||
-- ##############################################
|
||||
|
||||
dashboard_utils.module_available = {
|
||||
['vulnerability_scan'] = vs_utils.is_available
|
||||
}
|
||||
|
||||
-- ##############################################
|
||||
|
||||
-- Get all configured dashboard templates
|
||||
function dashboard_utils.get_templates(templates_dir)
|
||||
local templates = {}
|
||||
|
|
@ -46,6 +54,15 @@ function dashboard_utils.get_templates(templates_dir)
|
|||
elseif model == 'xl' and not info['version.enterprise_xl_edition'] then goto continue
|
||||
end
|
||||
end
|
||||
|
||||
if template.requires.modules then
|
||||
for _, module in ipairs(template.requires.modules) do
|
||||
if not dashboard_utils.module_available[module] or
|
||||
not dashboard_utils.module_available[module]() then
|
||||
goto continue
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
template_name = template_name:sub(1, #template_name - 5)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue