--
-- (C) 2013-18 - ntop.org
--
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
require "graph_utils"
local template = require "template_utils"
local host_pools_utils = require("host_pools_utils")
interface.select(ifname)
local ifstats = interface.getStats()
local base_url = ntop.getHttpPrefix().."/lua/if_stats.lua"
local page_params = {}
page_params.ifid = ifstats.id
page_params.page = "pools"
local devices_mode_filter = ""
if not isEmptyString(_GET["unassigned_devices"]) then
page_params.unassigned_devices = _GET["unassigned_devices"]
devices_mode_filter = ''
end
if isAdministrator() and (_POST["member"] ~= nil) and (_POST["pool"] ~= nil) then
-- change member pool
host_pools_utils.changeMemberPool(ifstats.id, _POST["member"], _POST["pool"])
interface.reloadHostPools()
end
print(
template.gen("modal_confirm_dialog.html", {
dialog={
id = "assign_device_dialog",
action = "assignDevicePool(mac_to_assign)",
title = i18n("unknown_devices.assign_device_pool"),
message = i18n("unknown_devices.select_pool", {mac=""}) ..
'
',
custom_alert_class = "",
confirm = i18n("unknown_devices.assign_pool"),
}
})
)
local pools = host_pools_utils.getPoolsList(ifstats.id, true --[[no info]])
local no_pools = (#pools < 2)
print [[