Revert "Migrates alerts to an object-oriented implementation"

This reverts commit fbc283f12f.
This commit is contained in:
matteo 2020-12-22 13:13:57 +01:00
parent fbc283f12f
commit e24ef4ef35
108 changed files with 1741 additions and 2797 deletions

View file

@ -2,50 +2,15 @@
-- (C) 2019-20 - ntop.org
--
-- ##############################################
-- #######################################################
local alert_keys = require "alert_keys"
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
local format_utils = require "format_utils"
local json = require("dkjson")
local status_keys = require "flow_keys"
-- Import the classes library.
local classes = require "classes"
-- Make sure to import the Superclass!
local alert = require "alert"
-- ##############################################
local alert_remote_to_remote = classes.class(alert)
-- ##############################################
alert_remote_to_remote.meta = {
status_key = status_keys.ntopng.status_remote_to_remote,
alert_key = alert_keys.ntopng.alert_remote_to_remote,
i18n_title = "alerts_dashboard.remote_to_remote",
icon = "fas fa-exclamation",
}
-- ##############################################
-- @brief Prepare an alert table used to generate the alert
-- @param one_flow_param The first alert param
-- @param another_flow_param The second alert param
-- @return A table with the alert built
function alert_remote_to_remote:init(server_ip)
-- Call the parent constructor
self.super:init()
self.alert_type_params = {
server_ip = server_ip
}
end
-- #######################################################
function alert_remote_to_remote.format(ifid, alert, alert_type_params)
local function formatRemoteToRemoteMessage(ifid, alert, remote_to_remote_info)
local alert_consts = require("alert_consts")
local entity = alert_consts.formatAlertEntity(ifid, alert_consts.alertEntityRaw(alert["alert_entity"]), alert["alert_entity_val"])
@ -57,4 +22,9 @@ end
-- #######################################################
return alert_remote_to_remote
return {
alert_key = alert_keys.ntopng.alert_remote_to_remote,
i18n_title = "alerts_dashboard.remote_to_remote",
i18n_description = formatRemoteToRemoteMessage,
icon = "fas fa-exclamation",
}