luci-app-firewall: format protocol family for forwards and rules 2880/head
authorAnton Kikin <a.kikin@tano-systems.com>
Wed, 17 Jul 2019 16:19:45 +0000 (19:19 +0300)
committerAnton Kikin <a.kikin@tano-systems.com>
Thu, 18 Jul 2019 09:46:00 +0000 (12:46 +0300)
Fixes: #2878
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
applications/luci-app-firewall/htdocs/luci-static/resources/tools/firewall.js
applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js
applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js

index 6785d1ca6303d2d75b51a2f322dc103b389b6068..198528aaa59a224a69c60eb34df3d275a80ae29c 100644 (file)
@@ -211,6 +211,15 @@ return L.Class.extend({
                return rv;
        },
 
+       fmt_family: function(family) {
+               if (family == 'ipv4')
+                       return _('IPv4');
+               else if (family == 'ipv6')
+                       return _('IPv6');
+               else
+                       return _('IPv4 and IPv6');
+       },
+
        fmt_proto: function(x, icmp_types) {
                var rv = E([]), l = L.toArray(x);
 
index 93bfc2918876f675e9e80b0d1e1622243ac8c65e..ffbfe3ccd07bb6bf08a5d158a9d42a1bbb0f8b66 100644 (file)
@@ -42,7 +42,8 @@ function fmt(fmt /*, ...*/) {
 }
 
 function forward_proto_txt(s) {
-       return fmt('%s-%s', _('IPv4'),
+       return fmt('%s-%s',
+               fwtool.fmt_family(uci.get('firewall', s, 'family')),
                fwtool.fmt_proto(uci.get('firewall', s, 'proto'),
                                 uci.get('firewall', s, 'icmp_type')) || 'TCP+UDP');
 }
index d2d191632243f029c51bcc82cb1cd094ad350536..e67397268c1c4c7876e221ae462808453bb87038 100644 (file)
@@ -42,7 +42,8 @@ function fmt(fmt /*, ...*/) {
 }
 
 function forward_proto_txt(s) {
-       return fmt('%s-%s', _('IPv4'),
+       return fmt('%s-%s',
+               fwtool.fmt_family(uci.get('firewall', s, 'family')),
                fwtool.fmt_proto(uci.get('firewall', s, 'proto'),
                                 uci.get('firewall', s, 'icmp_type')) || 'TCP+UDP');
 }