Fixes periodicity changed alert link to the map

This commit is contained in:
MatteoBiscosi 2021-08-11 16:06:22 +02:00
parent f6560d1974
commit 156f85e522
2 changed files with 16 additions and 31 deletions

View file

@ -4,6 +4,8 @@
-- ##############################################
package.path = dirs.installdir .. "/pro/scripts/lua/enterprise/modules/?.lua;" .. package.path
local flow_alert_keys = require "flow_alert_keys"
-- Import the classes library.
local classes = require "classes"
@ -45,7 +47,13 @@ end
function alert_periodicity_changed.format(ifid, alert, alert_type_params)
-- Extracting info field
local info = ""
local href = '<a href="/lua/pro/enterprise/periodicity_map.lua"><i class="fas fa-lg fa-clock"></i></a>'
local href = ""
local flow_infos = {
host = alert["cli_ip"],
l7proto = ternary(tonumber(alert["l7_proto"]) ~= 0, alert["l7_proto"], alert["l7_master_proto"]),
vlan_id = alert["vlan_id"]
}
local graph_map_utils = require("graph_map_utils")
if alert.json then
info = json.decode(alert["json"])
@ -56,6 +64,8 @@ function alert_periodicity_changed.format(ifid, alert, alert_type_params)
end
end
href = '<a href="' .. graph_map_utils.getMapUrl(flow_infos, interface.getId(), 'periodicity_map', 'graph') .. '"><i class="fas fa-lg fa-clock"></i></a>'
if alert_type_params.is_periodic then
return(i18n("alerts_dashboard.periodicity_is_periodic_descr", { info = info, href = href }))
elseif alert_type_params.is_aperiodic then