summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-08-06 21:22:18 +0200
committerJo-Philipp Wich <jo@mein.io>2021-03-15 11:41:50 +0100
commitbbf1a5343f1d930096cd5ff6b98f3e1f2f0d3c9a (patch)
tree61710c1fe1d941436fa2e1bde826ec35f0bc5884 /applications
parent171ef77e8985ffd90eb66b8a0a3cd74beb37ccdc (diff)
luci-app-firewall: simplify some form actions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js9
-rw-r--r--applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js5
2 files changed, 4 insertions, 10 deletions
diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js
index 7c09eeadf6..df49dcf80c 100644
--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js
+++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js
@@ -193,13 +193,8 @@ return view.extend({
s.handleAdd = function(ev) {
var config_name = this.uciconfig || this.map.config,
section_id = uci.add(config_name, this.sectiontype),
- opt1, opt2;
-
- 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 = this.getOption('src'),
+ opt2 = this.getOption('dest');
opt1.default = 'wan';
opt2.default = 'lan';
diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js
index 1d6e01c1a8..ce65fc7839 100644
--- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js
+++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/snats.js
@@ -217,9 +217,8 @@ return view.extend({
o.placeholder = null;
o.depends('target', 'SNAT');
o.validate = function(section_id, value) {
- var port = this.map.lookupOption('snat_port', section_id),
- a = this.formvalue(section_id),
- p = port ? port[0].formvalue(section_id) : null;
+ var a = this.formvalue(section_id),
+ p = this.section.formvalue(section_id, 'snat_port');
if ((a == null || a == '') && (p == null || p == '') && value == '')
return _('A rewrite IP must be specified!');