ntopng/scripts/lua/rest/v2/get/tables/user_columns_config.lua
GabrieleDeri 43dcd76e2f
Ported AS table to new table (#8475)
* Fixes parsing error while pasing XML strings with comments

* Ported host countries table to new vue table

* Added country filter when redirected to hosts list page

* Ported network discovery table to TableWithConfig vue component

* FIxed indentation

* Added documentation for VueJS, Lua and cpp used in ntopng

* Fixed error

* Added Netbox pref entry for default site, customizable input box size. To implement cpp side for netbox default site

* Removed tprint

* Ported AS table to new table

* Started fixing live flow IP filter

* Fixed date formatter

* Removed debug code

* Removed tprint

* Removed unused import

---------

Co-authored-by: DGabri <gabriele.deri@gmail.com>
Co-authored-by: Luca Deri <lucaderi@users.noreply.github.com>
2024-06-26 15:22:55 +02:00

43 lines
1.1 KiB
Lua

--
-- (C) 2013-24 - ntop.org
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
-- #####################################
local rest_utils = require("rest_utils")
-- #####################################
local redis_base_key = "ntopng.columns_config.%s.%s"
-- #####################################
-- @brief Retrieves columns configurations
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())