mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
Host alerts migration to new api
This commit is contained in:
parent
ad5113cee0
commit
ecdf88b8a0
8 changed files with 879 additions and 532 deletions
|
|
@ -26,6 +26,8 @@ if _GET["ifid"] ~= nil then
|
|||
interface.select(_GET["ifid"])
|
||||
end
|
||||
|
||||
local ifid = interface.getId()
|
||||
|
||||
if(tonumber(_GET["currentPage"]) == nil) then _GET["currentPage"] = 1 end
|
||||
if(tonumber(_GET["perPage"]) == nil) then _GET["perPage"] = getDefaultTableSize() end
|
||||
|
||||
|
|
@ -64,14 +66,23 @@ local function formatAlertRecord(alert_entity, record)
|
|||
column_msg = formatRawUserActivity(record, record["alert_json"])
|
||||
else
|
||||
local alert_obj = alerts_api.parseAlert(record)
|
||||
local msg = record["alert_json"]
|
||||
|
||||
if(alert_obj.formatter ~= nil) then
|
||||
local msg = record["alert_json"]
|
||||
|
||||
if(string.sub(msg, 1, 1) == "{") then
|
||||
if(string.sub(msg, 1, 1) == "{") then
|
||||
msg = json.decode(msg)
|
||||
end
|
||||
|
||||
if(alert_obj.formatter ~= nil) then
|
||||
column_msg = alert_obj.formatter(msg, record)
|
||||
else
|
||||
local description = alertTypeDescription(record.alert_type)
|
||||
|
||||
if(type(description) == "string") then
|
||||
-- localization string
|
||||
column_msg = i18n(description, msg)
|
||||
elseif(type(description) == "function") then
|
||||
column_msg = description(ifid, record, msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue