luci-base: firewall.js: manage zomne networks as list
authorJo-Philipp Wich <jo@mein.io>
Mon, 1 Mar 2021 07:54:06 +0000 (08:54 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 1 Mar 2021 07:54:58 +0000 (08:54 +0100)
Fixes: #4827
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/firewall.js

index 2e032ca2d5c7f5d601cb7ab78344b471ab0d38b0..4fa4954ba632c7aadc2d89e0c3b62dade69180e9 100644 (file)
@@ -92,7 +92,6 @@ Firewall = L.Class.extend({
                            z = uci.add('firewall', 'zone');
 
                        uci.set('firewall', z, 'name',    name);
-                       uci.set('firewall', z, 'network', ' ');
                        uci.set('firewall', z, 'input',   d.getInput()   || 'DROP');
                        uci.set('firewall', z, 'output',  d.getOutput()  || 'DROP');
                        uci.set('firewall', z, 'forward', d.getForward() || 'DROP');
@@ -333,17 +332,17 @@ Zone = AbstractFirewallItem.extend({
                        return false;
 
                newNetworks.push(network);
-               this.set('network', newNetworks.join(' '));
+               this.set('network', newNetworks);
 
                return true;
        },
 
        deleteNetwork: function(network) {
                var oldNetworks = this.getNetworks(),
-            newNetworks = oldNetworks.filter(function(net) { return net != network });
+                   newNetworks = oldNetworks.filter(function(net) { return net != network });
 
                if (newNetworks.length > 0)
-                       this.set('network', newNetworks.join(' '));
+                       this.set('network', newNetworks);
                else
                        this.set('network', null);
 
@@ -355,7 +354,7 @@ Zone = AbstractFirewallItem.extend({
        },
 
        clearNetworks: function() {
-               this.set('network', ' ');
+               this.set('network', null);
        },
 
        getDevices: function() {