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

View File

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

View File

@ -6,49 +6,29 @@
extends network_layout
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='')
table.table.table-responsive.table-striped.table-hover
tr
th(width='25%')
th(width='2%') Yes
th(width='73%') No
tr
td(width='3%')
input#6planeCheckBox.checkbox(type='checkbox' checked=(network.v6AssignMode['6plane']? true : false))
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
td
input#rfc4193CheckBox.checkbox(type='checkbox' checked=(network.v6AssignMode['rfc4193']? true : false))
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
td
input#ztCheckBox.checkbox(type='checkbox' checked=(network.v6AssignMode['zt']? true : false))
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')
button.btn.btn-primary(type='submit') Submit
= ' '
a.btn.btn-default(href='/controller/network/' + network.nwid name='cancel' role='button') Cancel
if errors
ul
for err in errors
li!= err.msg
if errors
ul
for err in errors
li!= err.msg