Add on-off switch template

Addresses #3513
This commit is contained in:
emanuele-f 2020-05-21 17:21:11 +02:00
parent 857629ccf0
commit eea288dee9
11 changed files with 159 additions and 160 deletions

View file

@ -2143,16 +2143,17 @@ elseif (page == "config") then
graph_utils.printPoolChangeDropdown(ifId, host_pool_id, have_nedge)
local top_hidden_checked = ternary(is_top_hidden, "checked", "")
print [[<tr>
<th>]] print(i18n("host_config.hide_from_top")) print[[</th>
<td>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="check-top_hidden" name="top_hidden" value="1" ]] print(top_hidden_checked) print[[>
<label class="custom-control-label" for="check-top_hidden">]] print(i18n("host_config.hide_host_from_top_descr", {host=host_label})) print[[</label>
</div>
</td>
<td>]]
print(template.gen("on_off_switch.html", {
id = "top_hidden",
label = i18n("host_config.hide_host_from_top_descr", {host=host_label}),
checked = is_top_hidden,
}))
print[[</td>
</tr>]]
if(host["localhost"] and ((host_vlan == nil) or (host_vlan == 0)) and mud_utils.isMudScriptEnabled(ifId)) then
@ -2190,10 +2191,11 @@ elseif (page == "config") then
drop_traffic_value = "true" -- Opposite
end
print([[<div class="custom-control custom-switch">]])
print('<input class="custom-control-input" id="check-drop_host_traffic" type="checkbox" name="drop_host_traffic" value="1" '..drop_traffic_checked..'"> '..i18n("host_config.drop_all_host_traffic")..'</input>')
print([[<label class="custom-control-label" for="check-drop_host_traffic"></label>]])
print([[</div>]])
print(template.gen("on_off_switch.html", {
id = "drop_host_traffic",
label = i18n("host_config.drop_all_host_traffic"),
checked = drop_traffic == "true",
}))
end
print[[<a class="btn btn-secondary btn-sm" href="]]