Implements backend and frontend to show risks docs inline

Addresses #5857
This commit is contained in:
Simone Mainardi 2021-10-01 16:27:44 +02:00
parent 4b197ca2cc
commit 1dd2b00988
8 changed files with 74 additions and 5 deletions

View file

@ -24,6 +24,7 @@ local alerts_api = require "alerts_api"
local icmp_utils = require "icmp_utils"
local tag_utils = require "tag_utils"
local checks = require "checks"
local flow_risk_utils = require "flow_risk_utils"
local shaper_utils = nil
@ -508,7 +509,8 @@ end
-- #################################
function alert_utils.formatFlowAlertMessage(ifid, alert, alert_json)
local msg
local msg
local alert_risk = ntop.getFlowAlertRisk(tonumber(alert.alert_id))
if(alert_json == nil) then
alert_json = alert_utils.getAlertInfo(alert)
@ -532,6 +534,11 @@ function alert_utils.formatFlowAlertMessage(ifid, alert, alert_json)
msg = string.format('%s <small><span class="text-muted">%s</span></small>', msg, alert["user_label"])
end
-- Add the link to the documentation
if alert_risk > 0 then
msg = string.format("%s %s", msg, flow_risk_utils.get_documentation_link(alert_risk))
end
return msg or ""
end