Reworks experimental object-oriented alerts code

This commit is contained in:
Simone Mainardi 2020-11-26 15:56:24 +01:00
parent 49749f7e3b
commit 2cc45f5229
6 changed files with 209 additions and 93 deletions

View file

@ -2,11 +2,25 @@
-- (C) 2019-20 - ntop.org
--
-- ##############################################
local alert_keys = require "alert_keys"
-- Import the classes library.
local classes = require "classes"
-- Make sure to import the Superclass!
local alert = require "alert"
-- ##############################################
local NewHostAlert = { }
local NewHostAlert = classes.class(alert)
-- ##############################################
NewHostAlert.meta = {
alert_key = alert_keys.user.alert_user_04,
i18n_title = "New Host API Demo",
icon = "fas fa-exclamation",
}
-- ##############################################
@ -14,8 +28,10 @@ local NewHostAlert = { }
-- @param one_param The first alert param
-- @param another_param The second alert param
-- @return A table with the alert built
function NewHostAlert:set_params(one_param, another_param)
-- tprint("new create: "..self.def_script.alert_key)
function NewHostAlert:init(one_param, another_param)
-- Optional, call to the `alert` constructor
self.super:init()
self.alert_type_params = {
one_param = one_param,
another_param = another_param
@ -30,9 +46,4 @@ end
-- #######################################################
return {
alert_key = alert_keys.user.alert_user_04,
i18n_title = "New Host API Demo",
icon = "fas fa-exclamation",
Alert = NewHostAlert
}
return NewHostAlert