mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 23:49:33 +00:00
add alert notifications
This commit is contained in:
parent
072941abc2
commit
19e91e2c87
16 changed files with 254 additions and 24 deletions
30
scripts/lua/handler_alert_notification.lua
Normal file
30
scripts/lua/handler_alert_notification.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
--
|
||||
-- (C) 2020 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "lua_utils"
|
||||
|
||||
local json = require "dkjson"
|
||||
local menu_alert_notifications = require("menu_alert_notifications")
|
||||
|
||||
sendHTTPContentTypeHeader('application/json')
|
||||
|
||||
local response
|
||||
local action = _POST["action"] or nil
|
||||
|
||||
-- if the action is not valid then shows an error message
|
||||
if isEmptyString(action) then
|
||||
print(json.encode({success = false, message = "The action is not valid!"}))
|
||||
return
|
||||
end
|
||||
|
||||
-- otherwise handle the action
|
||||
if action == "disposed" then
|
||||
local notification_id = _POST["notification_id"]
|
||||
response = menu_alert_notifications.dispose_notification(notification_id)
|
||||
end
|
||||
|
||||
print(json.encode(response))
|
||||
Loading…
Add table
Add a link
Reference in a new issue