mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Rework user script working sets (a single configset is supported now)
This commit is contained in:
parent
03512b963f
commit
fa311e3ade
45 changed files with 259 additions and 1077 deletions
|
|
@ -2,6 +2,8 @@
|
|||
-- (C) 2019-21 - ntop.org
|
||||
--
|
||||
|
||||
-- This is deprecated as there is a single configset now
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
|
|
@ -26,33 +28,15 @@ if(subdir == nil) then
|
|||
end
|
||||
|
||||
local script_type = user_scripts.script_types[subdir]
|
||||
local config_sets = user_scripts.getConfigsets()
|
||||
local configset = user_scripts.getConfigset()
|
||||
local rv = {}
|
||||
|
||||
-- Only return the essential information
|
||||
for _, configset in pairs(config_sets) do
|
||||
local pools = {}
|
||||
|
||||
if(script_type and script_type.default_config_only and (configset.id ~= user_scripts.DEFAULT_CONFIGSET_ID)) then
|
||||
-- Only return the default
|
||||
goto continue
|
||||
end
|
||||
|
||||
local configset_pools = user_scripts.getConfigsetPools(subdir, configset.id)
|
||||
for _, configset_pool in pairs(configset_pools) do
|
||||
pools[#pools + 1] = {
|
||||
key = configset_pool["pool_id"],
|
||||
label = configset_pool["name"]
|
||||
}
|
||||
end
|
||||
|
||||
rv[#rv + 1] = {
|
||||
id = configset.id,
|
||||
name = configset.name,
|
||||
pools = pools,
|
||||
}
|
||||
|
||||
::continue::
|
||||
end
|
||||
rv[#rv + 1] = {
|
||||
id = configset.id,
|
||||
name = configset.name,
|
||||
pools = {},
|
||||
}
|
||||
|
||||
print(json.encode(rv))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue