ntopng/scripts/lua/service_map_handler.lua
gabryon99 5fa6e69038 improvement on service_map page
The graph page has been set as the first page wehn a user navigates to
the service map page. When a user double clicks a node then the map will
be filtered with only the edges linked to the node. The flush data and
download buttons have been restored.
2020-12-17 11:37:51 +01:00

27 lines
594 B
Lua

--
-- (C) 2020 - ntop.org
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
local json = require("dkjson")
local ifs = interface.getStats()
sendHTTPHeader('application/json')
local ifid = ifs.id
local REDIS_KEY = string.format("ntopng.prefs.service_map.%d.graph", ifid)
-- prepare response for the request
local res = {}
-- get the node position
local graph_view = _POST['JSON']
ntop.setPref(REDIS_KEY, graph_view)
res.success = true
res.message = "The graph view has been saved!"
print(json.encode(res))