From 0b4b6380d0698954c2f45e301cf653810b861a87 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 11 Nov 2021 12:45:48 +0100 Subject: luci-app-firewall: use firewall.getZoneColorStyle() in views Use the new `firewall.getZoneColorStyle()` helper to apply background color styles. Signed-off-by: Jo-Philipp Wich --- .../htdocs/luci-static/resources/view/firewall/rules.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js') 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 198c7aeffd..7f073e99cd 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('strong', z) : E('em', _('this device')))]), + src: E('span', { 'class': 'zonebadge', 'style': fwmodel.getZoneColorStyle(z) }, [(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('strong', z) : E('em', _('this device')))]), + dest: E('span', { 'class': 'zonebadge', 'style': fwmodel.getZoneColorStyle(z) }, [(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 -- cgit v1.2.3