fix for system view

This commit is contained in:
gabryon99 2020-03-23 10:29:45 +01:00
parent 654ea9ec08
commit c0f30310f7
21 changed files with 79 additions and 57 deletions

View file

@ -248,15 +248,20 @@ end
-- ##############################################
function sendHTTPContentTypeHeader(content_type, content_disposition, charset, system_view)
function sendHTTPContentTypeHeader(content_type, content_disposition, charset, view_mode)
-- Check if the current request page belongs to system view
local is_system_view = system_view or false
-- Check if the current request page belongs to iface/system view
if (content_type == "text/html") then
if (not isSystemView() and is_system_view) then
setSystemView(true)
elseif (isSystemView() and not is_system_view) then
setSystemView(false)
local really_view_mode = view_mode or getIfaceViewFlag()
if (isSystemView() and really_view_mode == getIfaceViewFlag()) then
setSystemView(false)
elseif (not isSystemView() and view_mode == getSystemViewFlag()) then
setSystemView(true)
elseif (really_view_mode == getBothViewFlag()) then
-- do nothing because the view is shared between iface view and system view
end
end
local charset = charset or "utf-8"
@ -3494,6 +3499,24 @@ end
-- ##############################################
function getSystemViewFlag()
return "system"
end
-- ##############################################
function getBothViewFlag()
return "both"
end
-- ##############################################
function getIfaceViewFlag()
return "iface"
end
-- ##############################################
function setSystemView(toggle)
local t = (toggle and "1" or "0")
ntop.setPref("ntopng.prefs.system_mode_enabled", t)