mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-28 23:19:33 +00:00
Refactors alert_severities into an independend Lua module
This commit is contained in:
parent
e683509dec
commit
b3dc39c641
109 changed files with 317 additions and 264 deletions
|
|
@ -4,7 +4,7 @@
|
|||
local dirs = ntop.getDirs()
|
||||
|
||||
require "lua_utils"
|
||||
local alert_consts = require "alert_consts"
|
||||
local alert_severities = require "alert_severities"
|
||||
local user_scripts = require "user_scripts"
|
||||
|
||||
-- ##############################################
|
||||
|
|
@ -41,12 +41,12 @@ end
|
|||
-- ##############################################
|
||||
|
||||
-- @brief Parses and validates a severity id string and returns it as a number
|
||||
-- @param minimum_severity_id_string An string with an integer severity id as found in `alert_consts.alert_severities`
|
||||
-- @param minimum_severity_id_string An string with an integer severity id as found in `alert_severities`
|
||||
-- @return A valid integer severity id or nil when validation fails
|
||||
function recipients_rest_utils.parse_minimum_severity(minimum_severity_id_string)
|
||||
local minimum_severity_id = tonumber(minimum_severity_id_string)
|
||||
|
||||
for _, alert_severity in pairs(alert_consts.alert_severities) do
|
||||
for _, alert_severity in pairs(alert_severities) do
|
||||
if minimum_severity_id == alert_severity.severity_id then
|
||||
return minimum_severity_id
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue