mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 16:30:10 +00:00
Optimize the getter of the alert category using its ID (#8204)
This commit is contained in:
parent
6e55905708
commit
ce57eef578
2 changed files with 18 additions and 10 deletions
|
|
@ -118,6 +118,23 @@ alert_consts.categories = {
|
|||
}
|
||||
}
|
||||
|
||||
local function format_by_id()
|
||||
local f_categories = {}
|
||||
for cat, cat_v in pairs(alert_consts.categories) do
|
||||
if (cat ~= 'other') then
|
||||
f_categories[cat_v.id] = cat_v
|
||||
end
|
||||
end
|
||||
return f_categories
|
||||
end
|
||||
|
||||
alert_consts.categories_id = format_by_id()
|
||||
|
||||
function alert_consts.get_category_by_id(id)
|
||||
if (id == 0) then return alert_consts.categories.other end
|
||||
return alert_consts.categories_id[id]
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
alert_consts.alert_entities = alert_entities
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue