mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Add alerts shortcut and hidden charts page. (#7783)
This commit is contained in:
parent
c367c4cae3
commit
4e5a9e094d
1 changed files with 24 additions and 1 deletions
|
|
@ -8,8 +8,12 @@ package.path = dirs.installdir .. "/scripts/lua/modules/vulnerability_scan/?.lua
|
|||
require "lua_utils"
|
||||
local page_utils = require("page_utils")
|
||||
local template = require("template_utils")
|
||||
local graph_utils = require("graph_utils")
|
||||
local json = require("dkjson")
|
||||
local page = _GET["page"]
|
||||
local auth = require "auth"
|
||||
|
||||
|
||||
|
||||
if not isAllowedSystemInterface() then return end
|
||||
|
||||
|
|
@ -20,6 +24,8 @@ page_utils.print_header_and_set_active_menu_entry(page_utils.menu_entries.vulner
|
|||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
|
||||
local base_url = ntop.getHttpPrefix() .. "/lua/vulnerability_scan.lua"
|
||||
local charts_available = areHostTimeseriesEnabled(ifId, nil)
|
||||
local host_result = _GET["host"]
|
||||
|
||||
page_utils.print_navbar(i18n("scan_hosts"), base_url .. "?", {{
|
||||
active = page == "overview" or page == nil,
|
||||
|
|
@ -30,6 +36,18 @@ page_utils.print_navbar(i18n("scan_hosts"), base_url .. "?", {{
|
|||
hidden = page == "overview" or page == nil, -- disable the entry when the user is in the overview page
|
||||
page_name = "show_result",
|
||||
label = i18n('scan_details')
|
||||
},{
|
||||
hidden = not areAlertsEnabled() or not auth.has_capability(auth.capabilities.alerts),
|
||||
active = page == "alerts",
|
||||
page_name = "alerts",
|
||||
label = "<i class='fas fa-lg fa-exclamation-triangle' title='" .. i18n("alerts_dashboard.alerts") .. "'></i>",
|
||||
url = ntop.getHttpPrefix() .."/lua/alert_stats.lua?page=am_host"
|
||||
}, {
|
||||
hidden = true,--not charts_available or page == "overview" or page == nil,
|
||||
active = page == "historical",
|
||||
page_name = "historical",
|
||||
--url = ntop.getHttpPrefix() .."/lua/vulnerability_scan.lua?page=historical×eries_groups_mode=1_chart_x_metric&ts_schema=host:host_tcp_unidirectional_flows&host="..ternary(host_result~=nil, host_result,"").."timeseries_groups=host;"..ternary(host_result~=nil, host_result,"")..";host:traffic;bytes_sent=true:false:false:false|bytes_rcvd=true:false:false:false",
|
||||
label = "<i class='fas fa-lg fa-chart-area' title='" .. i18n("historical") .. "'></i>"
|
||||
}})
|
||||
|
||||
|
||||
|
|
@ -37,7 +55,6 @@ local page = _GET["page"] or ('overview')
|
|||
local ifid = interface.getId()
|
||||
|
||||
|
||||
local host_result = _GET["host"]
|
||||
local scan_type = _GET["scan_type"]
|
||||
local scan_date = _GET["scan_date"]
|
||||
|
||||
|
|
@ -62,6 +79,12 @@ elseif (page == "show_result") then
|
|||
}
|
||||
template.render("pages/vue_page.template", { vue_page_name = "PageHostVsResult", page_context = json.encode(json_context) })
|
||||
|
||||
elseif (page == "historical") then
|
||||
local source_value_object = {
|
||||
ifid = ifid,
|
||||
host = host_result,
|
||||
}
|
||||
graph_utils.drawNewGraphs(source_value_object)
|
||||
end
|
||||
|
||||
-- #######################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue