diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-07-07 20:11:35 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-07-07 20:11:35 +0200 |
commit | f970c485cfb2571dd6d4ee6a1ad36958f1410b6a (patch) | |
tree | bac0cd8c4d8fa60c11ac4db804074b2548c020cc /modules/luci-base/htdocs/luci-static/resources/firewall.js | |
parent | 37ca6fe6d63f748904a18ee5213f52e642980ab5 (diff) |
treewide: switch to shared isObject(), toArray() and sortedKeys() helpers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources/firewall.js')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/firewall.js | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/firewall.js b/modules/luci-base/htdocs/luci-static/resources/firewall.js index e99f8b83bc..d034d6e010 100644 --- a/modules/luci-base/htdocs/luci-static/resources/firewall.js +++ b/modules/luci-base/htdocs/luci-static/resources/firewall.js @@ -8,21 +8,6 @@ function initFirewallState() { return uci.load('firewall'); } -function toArray(val) { - if (val == null) - return []; - - if (Array.isArray(val)) - return val; - - var s = String(val).trim(); - - if (s == '') - return []; - - return s.split(/\s+/); -} - function parseEnum(s, values) { if (s == null) return null; @@ -155,7 +140,7 @@ Firewall = L.Class.extend({ var sections = uci.sections('firewall', 'zone'); for (var i = 0; i < sections.length; i++) - if (toArray(sections[i].network || sections[i].name).indexOf(network) != -1) + if (L.toArray(sections[i].network || sections[i].name).indexOf(network) != -1) return new Zone(sections[i]['.name']); return null; @@ -217,7 +202,7 @@ Firewall = L.Class.extend({ if (sections[i].name != oldName) continue; - if (toArray(sections[i].network).length == 0) + if (L.toArray(sections[i].network).length == 0) uci.set('firewall', sections[i]['.name'], 'network', oldName); uci.set('firewall', sections[i]['.name'], 'name', newName); @@ -383,7 +368,7 @@ Zone = AbstractFirewallItem.extend({ }, getNetworks: function() { - return toArray(this.get('network') || this.get('name')); + return L.toArray(this.get('network') || this.get('name')); }, clearNetworks: function() { |