Changed v4AssignMode and v6AssignMode pages to checkboxes with auto-post

This commit is contained in:
Key Networks 2018-01-31 17:44:08 +08:00
parent 06caa458d8
commit 26f4d51679
4 changed files with 41 additions and 60 deletions

View File

@ -363,6 +363,8 @@ exports.v4AssignMode = async function (req, res) {
v4AssignMode: { zt: req.body.zt } v4AssignMode: { zt: req.body.zt }
}; };
console.log('v4AssignMode: ' + JSON.stringify(v4AssignMode));
try { try {
const network = await zt.network_object(req.params.nwid, v4AssignMode); const network = await zt.network_object(req.params.nwid, v4AssignMode);
nav.whence = '/controller/network/' + network.nwid; nav.whence = '/controller/network/' + network.nwid;
@ -385,11 +387,13 @@ exports.v6AssignMode = async function (req, res) {
v6AssignMode: v6AssignMode:
{ {
'6plane': req.body['6plane'], '6plane': req.body['6plane'],
rfc4193: req.body.rfc4193, 'rfc4193': req.body.rfc4193,
zt: req.body.zt 'zt': req.body.zt
} }
}; };
console.log('v6AssignMode: ' + JSON.stringify(v6AssignMode));
try { try {
const network = await zt.network_object(req.params.nwid, v6AssignMode); const network = await zt.network_object(req.params.nwid, v6AssignMode);
nav.whence = '/controller/network/' + network.nwid; nav.whence = '/controller/network/' + network.nwid;

View File

@ -9,19 +9,19 @@ block net_content
script. script.
$(function() { $(function() {
$('#authCheckBox').on('click', function() { $('#authCheckBox').on('click', function() {
$.post('', {id: this.value, auth: this.checked}); $.post('', {'id': this.value, 'auth': this.checked});
}); });
}); });
$(function() { $(function() {
$('#activeBridgeCheckBox').on('click', function() { $('#activeBridgeCheckBox').on('click', function() {
$.post('', {id: this.value, activeBridge: this.checked}); $.post('', {'id': this.value, 'activeBridge': this.checked});
}); });
}); });
$(function() { $(function() {
$('.text').on('change', function() { $('.text').on('change', function() {
$.post('', {id: this.name, name: this.value}); $.post('', {'id': this.name, 'name': this.value});
}); });
}); });

View File

@ -6,24 +6,21 @@
extends network_layout extends network_layout
block net_content block net_content
p Let ZT assign IPv4 addresses? script.
$(function() {
$('.checkbox').on('click', function() {
$.post('', {'zt': $('#v4AssignModeCheckBox').is(':checked')});
});
});
form(method='POST' action='') form(method='POST' action='')
.radio table.table.table-responsive.table-striped.table-hover
label tr
input(type='radio' name='zt' value='true' checked=network.v4AssignMode.zt) td(width='3%')
| Yes input#v4AssignModeCheckBox.checkbox(type='checkbox' checked=(network.v4AssignMode.zt? true : false))
.radio td Auto-assign from IP Assignment Pool
label
input(type='radio' name='zt' value='false' checked=!network.v4AssignMode.zt)
| No
.form-group(style='padding-top: 10px') if errors
button.btn.btn-primary(type='submit') Submit ul
= ' ' for err in errors
a.btn.btn-default(href='/controller/network/' + network.nwid name='cancel' role='button') Cancel li!= err.msg
if errors
ul
for err in errors
li!= err.msg

View File

@ -6,49 +6,29 @@
extends network_layout extends network_layout
block net_content block net_content
script.
$(function() {
$('.checkbox').on('click', function() {
$.post('', {'6plane': $('#6planeCheckBox').is(':checked'), 'rfc4193': $('#rfc4193CheckBox').is(':checked'), 'zt': $('#ztCheckBox').is(':checked')});
});
});
form(method='POST' action='') form(method='POST' action='')
table.table.table-responsive.table-striped.table-hover table.table.table-responsive.table-striped.table-hover
tr tr
th(width='25%') td(width='3%')
th(width='2%') Yes input#6planeCheckBox.checkbox(type='checkbox' checked=(network.v6AssignMode['6plane']? true : false))
th(width='73%') No
tr
td ZT 6plane (/80 routable for each device) td ZT 6plane (/80 routable for each device)
td
.radio
label
input(type='radio' name='6plane' value='true' checked=network.v6AssignMode['6plane'])
td
.radio
label
input(type='radio' name='6plane' value='false' checked=!network.v6AssignMode['6plane'])
tr tr
td
input#rfc4193CheckBox.checkbox(type='checkbox' checked=(network.v6AssignMode['rfc4193']? true : false))
td ZT rfc4193 (/128 for each device) td ZT rfc4193 (/128 for each device)
td
.radio
label
input(type='radio' name='rfc4193' value='true' checked=network.v6AssignMode.rfc4193)
td
.radio
label
input(type='radio' name='rfc4193' value='false' checked=!network.v6AssignMode.rfc4193)
tr tr
td
input#ztCheckBox.checkbox(type='checkbox' checked=(network.v6AssignMode['zt']? true : false))
td Auto-assign from IP Assignment Pool td Auto-assign from IP Assignment Pool
td
.radio
label
input(type='radio' name='zt' value='true' checked=network.v6AssignMode.zt)
td
.radio
label
input(type='radio' name='zt' value='false' checked=!network.v6AssignMode.zt)
.form-group(style='padding-top: 10px') if errors
button.btn.btn-primary(type='submit') Submit ul
= ' ' for err in errors
a.btn.btn-default(href='/controller/network/' + network.nwid name='cancel' role='button') Cancel li!= err.msg
if errors
ul
for err in errors
li!= err.msg