mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Various script fixed
Improved error message when scripts fail
This commit is contained in:
parent
a9396720d0
commit
ab34197603
18 changed files with 1592 additions and 1552 deletions
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
local json = require "dkjson"
|
||||
|
||||
-- #####################################
|
||||
|
||||
|
|
@ -18,24 +17,26 @@ local redis_base_key = "ntopng.columns_config.%s.%s"
|
|||
|
||||
|
||||
-- @brief Retrieves columns configurations
|
||||
local function get_column_config()
|
||||
|
||||
local table_id = _GET["table_id"]
|
||||
local user_id = _SESSION["user"]
|
||||
|
||||
if(isEmptyString(table_id)) then
|
||||
rest_utils.answer(rest_utils.consts.err.invalid_args)
|
||||
end
|
||||
|
||||
local redis_key = string.format(redis_base_key, table_id, user_id)
|
||||
|
||||
local visible_columns = ntop.getCache(redis_key) or {}
|
||||
if visible_columns == nil or visible_columns == "" then
|
||||
visible_columns = {}
|
||||
else
|
||||
visible_columns = json.decode(visible_columns)
|
||||
end
|
||||
return(rest_utils.answer(rest_utils.consts.success.ok, visible_columns))
|
||||
local function get_column_config()
|
||||
require "lua_utils"
|
||||
local json = require "dkjson"
|
||||
local table_id = _GET["table_id"]
|
||||
local user_id = _SESSION["user"]
|
||||
|
||||
if(isEmptyString(table_id)) then
|
||||
rest_utils.answer(rest_utils.consts.err.invalid_args)
|
||||
end
|
||||
|
||||
local redis_key = string.format(redis_base_key, table_id, user_id)
|
||||
local visible_columns = ntop.getCache(redis_key) or {}
|
||||
|
||||
if visible_columns == nil or visible_columns == "" then
|
||||
visible_columns = {}
|
||||
else
|
||||
visible_columns = json.decode(visible_columns)
|
||||
end
|
||||
|
||||
return(rest_utils.answer(rest_utils.consts.success.ok, visible_columns))
|
||||
end
|
||||
|
||||
return(get_column_config())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue