From: Jo-Philipp Wich Date: Mon, 8 Nov 2021 19:37:56 +0000 (+0100) Subject: luci-app-firewall: adjust zone badge markup X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3eac573e21ddadb5ccd7f721198209b21acbf96a;p=project%2Fluci.git luci-app-firewall: adjust zone badge markup No functional changes but required for styling rules. Signed-off-by: Jo-Philipp Wich (cherry picked from commit 01eb86f4fc105514f67fbefbcd2ac180e02ab78b) --- diff --git a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js index 1c8c806562..b4b3ce28b9 100644 --- a/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js +++ b/applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/forwards.js @@ -46,7 +46,7 @@ function rule_src_txt(s, hosts) { var z = uci.get('firewall', s, 'src'); return fwtool.fmt(_('From %{src}%{src_ip?, IP %{src_ip#%{next?, }%{item.ival}}}%{src_port?, port %{src_port#%{next?, }%{item.ival}}}%{src_mac?, MAC %{src_mac#%{next?, }%{item.ival}}}'), { - src: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z || E('em', _('this device')))]), + src: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z ? E('strong', z) : E('em', _('this device')))]), src_ip: fwtool.map_invert(uci.get('firewall', s, 'src_ip'), 'toLowerCase'), src_mac: fwtool.map_invert(uci.get('firewall', s, 'src_mac'), 'toUpperCase').map(function(v) { return Object.assign(v, { hint: hosts[v.val] }) }), src_port: fwtool.map_invert(uci.get('firewall', s, 'src_port')) @@ -79,7 +79,7 @@ function rule_target_txt(s) { var z = uci.get('firewall', s, 'dest'); return fwtool.fmt(_('Forward to %{dest}%{dest_ip? IP %{dest_ip}}%{dest_port? port %{dest_port}}'), { - dest: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z || E('em', _('this device')))]), + dest: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z ? E('strong', z) : E('em', _('this device')))]), dest_ip: (uci.get('firewall', s, 'dest_ip') || '').toLowerCase(), dest_port: uci.get('firewall', s, 'dest_port') }); 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 67b036780b..198c7aeffd 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 @@ -62,7 +62,7 @@ function rule_src_txt(s, hosts) { d = (uci.get('firewall', s, 'direction') == 'in') ? uci.get('firewall', s, 'device') : null; return fwtool.fmt(_('From %{src}%{src_device?, interface %{src_device}}%{src_ip?, IP %{src_ip#%{next?, }%{item.ival}}}%{src_port?, port %{src_port#%{next?, }%{item.ival}}}%{src_mac?, MAC %{src_mac#%{next?, }%{item.ival}}}'), { - src: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z || E('em', _('this device')))]), + src: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z ? E('strong', z) : E('em', _('this device')))]), src_ip: fwtool.map_invert(uci.get('firewall', s, 'src_ip'), 'toLowerCase'), src_mac: fwtool.map_invert(uci.get('firewall', s, 'src_mac'), 'toUpperCase').map(function(v) { return Object.assign(v, { hint: hosts[v.val] }) }), src_port: fwtool.map_invert(uci.get('firewall', s, 'src_port')), @@ -75,7 +75,7 @@ function rule_dest_txt(s) { d = (uci.get('firewall', s, 'direction') == 'out') ? uci.get('firewall', s, 'device') : null; return fwtool.fmt(_('To %{dest}%{dest_device?, interface %{dest_device}}%{dest_ip?, IP %{dest_ip#%{next?, }%{item.ival}}}%{dest_port?, port %{dest_port#%{next?, }%{item.ival}}}'), { - dest: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z || E('em', _('this device')))]), + dest: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z ? E('strong', z) : E('em', _('this device')))]), dest_ip: fwtool.map_invert(uci.get('firewall', s, 'dest_ip'), 'toLowerCase'), dest_port: fwtool.map_invert(uci.get('firewall', s, 'dest_port')), dest_device: d 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 fb345135f7..148e1fdd41 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 @@ -47,7 +47,7 @@ function rule_dest_txt(s) { var z = uci.get('firewall', s, 'src'); return fwtool.fmt(_('To %{dest}%{dest_device?, via interface %{dest_device}}%{dest_ip?, IP %{dest_ip#%{next?, }%{item.ival}}}%{dest_port?, port %{dest_port#%{next?, }%{item.ival}}}'), { - dest: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z || E('em', _('this device')))]), + dest: E('span', { 'class': 'zonebadge', 'style': 'background-color:' + fwmodel.getColorForName((z && z != '*') ? z : null) }, [(z == '*') ? E('em', _('any zone')) : (z ? E('strong', z) : E('em', _('this device')))]), dest_ip: fwtool.map_invert(uci.get('firewall', s, 'dest_ip'), 'toLowerCase'), dest_port: fwtool.map_invert(uci.get('firewall', s, 'dest_port')), dest_device: uci.get('firewall', s, 'device')