luci-app-firewall: simplify some form actions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
171ef77e89
commit
bbf1a5343f
2 changed files with 4 additions and 10 deletions
|
@ -193,13 +193,8 @@ return view.extend({
|
||||||
s.handleAdd = function(ev) {
|
s.handleAdd = function(ev) {
|
||||||
var config_name = this.uciconfig || this.map.config,
|
var config_name = this.uciconfig || this.map.config,
|
||||||
section_id = uci.add(config_name, this.sectiontype),
|
section_id = uci.add(config_name, this.sectiontype),
|
||||||
opt1, opt2;
|
opt1 = this.getOption('src'),
|
||||||
|
opt2 = this.getOption('dest');
|
||||||
for (var i = 0; i < this.children.length; i++)
|
|
||||||
if (this.children[i].option == 'src')
|
|
||||||
opt1 = this.children[i];
|
|
||||||
else if (this.children[i].option == 'dest')
|
|
||||||
opt2 = this.children[i];
|
|
||||||
|
|
||||||
opt1.default = 'wan';
|
opt1.default = 'wan';
|
||||||
opt2.default = 'lan';
|
opt2.default = 'lan';
|
||||||
|
|
|
@ -217,9 +217,8 @@ return view.extend({
|
||||||
o.placeholder = null;
|
o.placeholder = null;
|
||||||
o.depends('target', 'SNAT');
|
o.depends('target', 'SNAT');
|
||||||
o.validate = function(section_id, value) {
|
o.validate = function(section_id, value) {
|
||||||
var port = this.map.lookupOption('snat_port', section_id),
|
var a = this.formvalue(section_id),
|
||||||
a = this.formvalue(section_id),
|
p = this.section.formvalue(section_id, 'snat_port');
|
||||||
p = port ? port[0].formvalue(section_id) : null;
|
|
||||||
|
|
||||||
if ((a == null || a == '') && (p == null || p == '') && value == '')
|
if ((a == null || a == '') && (p == null || p == '') && value == '')
|
||||||
return _('A rewrite IP must be specified!');
|
return _('A rewrite IP must be specified!');
|
||||||
|
|
Loading…
Reference in a new issue