add to pool shortcut for interface and local network (#4093)

This commit is contained in:
gabryon99 2020-10-16 18:02:22 +02:00
parent 4608c52596
commit d9bba4b4b2
4 changed files with 75 additions and 1 deletions

View file

@ -15,6 +15,8 @@ local graph_utils = require "graph_utils"
local alert_utils = require "alert_utils"
local page_utils = require("page_utils")
local ts_utils = require("ts_utils")
local ui_utils = require("ui_utils")
local local_network_pools = require ("local_network_pools")
local network = _GET["network"]
local network_name = _GET["network_cidr"]
@ -110,6 +112,8 @@ elseif (page == "config") then
return
end
local local_network_pools_instance = local_network_pools:create()
print[[
<form id="network_config" class="form-inline" style="margin-bottom: 0px;" method="post">
<input id="csrf" name="csrf" type="hidden" value="]] print(ntop.getRandomCSRFValue()) print[["/>
@ -118,6 +122,10 @@ elseif (page == "config") then
if _SERVER["REQUEST_METHOD"] == "POST" then
setLocalNetworkAlias(network_name, _POST["custom_name"])
custom_name = getLocalNetworkAlias(network_name)
-- bind local network to pool
if (_POST["pool"]) then
local_network_pools_instance:bind_member(network_name, tonumber(_POST["pool"]))
end
end
print [[<tr>
@ -127,6 +135,16 @@ elseif (page == "config") then
</td>
</tr>]]
-- Local Network Pool
print([[
<tr>
<th>]].. i18n("pools.pool") ..[[</th>
<td>
]].. ui_utils.render_pools_dropdown(local_network_pools_instance, network_name,"local_network") ..[[
</td>
</tr>
]])
print[[
</table>
<button class="btn btn-primary" style="float:right; margin-right:1em; margin-left: auto" disabled="disabled" type="submit">]] print(i18n("save_settings")) print[[</button><br><br>