mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
fixed plus button inside recipients list
This commit is contained in:
parent
fcfd9b3a2a
commit
024f8b4572
4 changed files with 44 additions and 7 deletions
77
scripts/lua/admin/recipients_list.lua
Normal file
77
scripts/lua/admin/recipients_list.lua
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
--
|
||||
-- (C) 2019-20 - ntop.org
|
||||
--
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "lua_utils"
|
||||
|
||||
local page_utils = require("page_utils")
|
||||
local template = require "template_utils"
|
||||
local json = require "dkjson"
|
||||
local plugins_utils = require("plugins_utils")
|
||||
local menu_alert_notifications = require("menu_alert_notifications")
|
||||
local notification_configs = require("notification_configs")
|
||||
local endpoints = notification_configs.get_configs(true)
|
||||
|
||||
if not haveAdminPrivileges() then
|
||||
return
|
||||
end
|
||||
|
||||
sendHTTPContentTypeHeader('text/html')
|
||||
|
||||
page_utils.set_active_menu_entry(page_utils.menu_entries.endpoint_recipients)
|
||||
|
||||
-- append the menu above the page
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua")
|
||||
-- print a notification container used by the AJAX operations
|
||||
menu_alert_notifications.render_notifications('recipients', {})
|
||||
|
||||
page_utils.print_page_title(i18n("endpoint_notifications.recipient_list"))
|
||||
|
||||
-- localize endpoint name types in a table
|
||||
local endpoints_types = notification_configs.get_types()
|
||||
local endpoint_types_labels = {}
|
||||
-- create a table to filter recipient by endpoint's type
|
||||
local endpoint_type_filters = {}
|
||||
|
||||
for endpoint_key, endpoint in pairs(endpoints_types) do
|
||||
|
||||
local label = i18n('endpoint_notifications.types.'..endpoint_key) or endpoint.name
|
||||
endpoint_types_labels[endpoint_key] = label
|
||||
endpoint_type_filters[#endpoint_type_filters+1] = {
|
||||
label = label,
|
||||
regex = endpoint_key,
|
||||
key = endpoint_key,
|
||||
countable = true
|
||||
}
|
||||
end
|
||||
|
||||
local can_create_recipient = not table_all(endpoints,
|
||||
function(endpoint)
|
||||
return (endpoint.builtin ~= nil)
|
||||
end
|
||||
)
|
||||
|
||||
local context = {
|
||||
notifications = {
|
||||
endpoints = endpoints_types,
|
||||
endpoint_types_labels = endpoint_types_labels,
|
||||
endpoint_list = endpoints,
|
||||
can_create_recipient = can_create_recipient,
|
||||
filters = {
|
||||
endpoint_types = endpoint_type_filters
|
||||
}
|
||||
},
|
||||
plugins_utils = plugins_utils,
|
||||
template_utils = template,
|
||||
page_utils = page_utils,
|
||||
json = json,
|
||||
info = ntop.getInfo()
|
||||
}
|
||||
|
||||
-- print config_list.html template
|
||||
print(template.gen("pages/recipients_list.template", context))
|
||||
|
||||
-- append the menu below the page
|
||||
dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua")
|
||||
Loading…
Add table
Add a link
Reference in a new issue