From: Sergey Ponomarev Date: Sat, 30 Nov 2024 12:53:50 +0000 (+0200) Subject: luci-app-upnp: remove dangling lines and split translations X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7a7f9ec0b76489e4a147f5c493d7345e89e9c387;p=project%2Fluci.git luci-app-upnp: remove dangling lines and split translations Signed-off-by: Sergey Ponomarev --- diff --git a/applications/luci-app-upnp/htdocs/luci-static/resources/view/status/include/80_upnp.js b/applications/luci-app-upnp/htdocs/luci-static/resources/view/status/include/80_upnp.js index 3173fb35bc..dcb6963734 100644 --- a/applications/luci-app-upnp/htdocs/luci-static/resources/view/status/include/80_upnp.js +++ b/applications/luci-app-upnp/htdocs/luci-static/resources/view/status/include/80_upnp.js @@ -37,7 +37,6 @@ return baseclass.extend({ }, render: function(data) { - var table = E('table', { 'class': 'table', 'id': 'upnp_status_table' }, [ E('tr', { 'class': 'tr table-titles' }, [ E('th', { 'class': 'th' }, _('Client Name')), @@ -51,7 +50,6 @@ return baseclass.extend({ ]); var rules = Array.isArray(data[0].rules) ? data[0].rules : []; - var rows = rules.map(function(rule) { return [ rule.host_hint || _('Unknown'), @@ -66,9 +64,7 @@ return baseclass.extend({ }, [ _('Delete') ]) ]; }); - cbi_update_table(table, rows, E('em', _('There are no active port maps.'))); - return table; } }); diff --git a/applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp/upnp.js b/applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp/upnp.js index 6bd7bf3a6d..a51cd72a01 100644 --- a/applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp/upnp.js +++ b/applications/luci-app-upnp/htdocs/luci-static/resources/view/upnp/upnp.js @@ -45,9 +45,7 @@ return view.extend({ }, poll_status: function(nodes, data) { - var rules = Array.isArray(data[0].rules) ? data[0].rules : []; - var rows = rules.map(function(rule) { return [ rule.host_hint || _('Unknown'), @@ -62,18 +60,21 @@ return view.extend({ }, [ _('Delete') ]) ]; }); - cbi_update_table(nodes.querySelector('#upnp_status_table'), rows, E('em', _('There are no active port maps.'))); - - return; }, render: function(data) { - var m, s, o; + var protocols = '%s & %s/%s'.format( + 'UPnP IGD', + 'PCP', + 'NAT-PMP'); m = new form.Map('upnpd', [_('UPnP IGD & PCP/NAT-PMP Service')], - _('The %s protocols allow clients on the local network to configure port maps/forwards on the router autonomously.', 'The %s (%s = UPnP IGD & PCP/NAT-PMP) protocols allow clients on the local network to configure port maps/forwards on the router autonomously.').format('%s & %s/%s').format('UPnP IGD', 'PCP', 'NAT-PMP')); + _('The %s protocols allow clients on the local network to configure port maps/forwards on the router autonomously.', + 'The %s (%s = UPnP IGD & PCP/NAT-PMP) protocols allow clients on the local network to configure port maps/forwards on the router autonomously.') + .format(protocols) + ); s = m.section(form.GridSection, '_active_rules'); @@ -91,7 +92,6 @@ return view.extend({ ]); var rules = Array.isArray(data[0].rules) ? data[0].rules : []; - var rows = rules.map(function(rule) { return [ rule.host_hint || _('Unknown'), @@ -106,9 +106,7 @@ return view.extend({ }, [ _('Delete') ]) ]; }); - cbi_update_table(table, rows, E('em', _('There are no active port maps.'))); - return E('div', { 'class': 'cbi-section cbi-tblsection' }, [ E('h3', _('Active Service Port Maps')), table ]); }, o, this); @@ -122,9 +120,11 @@ return view.extend({ _('Start autonomous port mapping service')); o.rmempty = false; - s.taboption('setup', form.Flag, 'enable_upnp', _('Enable UPnP IGD protocol')).default = '1'; + s.taboption('setup', form.Flag, 'enable_upnp', _('Enable UPnP IGD protocol')) + s.default = '1'; - s.taboption('setup', form.Flag, 'enable_natpmp', _('Enable PCP/NAT-PMP protocols')).default = '1'; + s.taboption('setup', form.Flag, 'enable_natpmp', _('Enable PCP/NAT-PMP protocols')) + s.default = '1'; o = s.taboption('setup', form.Flag, 'igdv1', _('UPnP IGDv1 compatibility mode'), _('Advertise as IGDv1 (IPv4 only) device instead of IGDv2')); @@ -140,7 +140,8 @@ return view.extend({ _('Report maximum upload speed in kByte/s')); o.depends('enable_upnp', '1'); - s.taboption('advanced', form.Flag, 'use_stun', _('Use %s', 'Use %s (%s = STUN)').format('STUN'), + s.taboption('advanced', form.Flag, 'use_stun', _('Use %s', 'Use %s (%s = STUN)') + .format('STUN'), _('To detect the public IPv4 address for unrestricted full-cone/one-to-one NATs')); o = s.taboption('advanced', form.Value, 'stun_host', _('STUN Host')); @@ -158,7 +159,8 @@ return view.extend({ o.depends('enable_upnp', '1'); o = s.taboption('advanced', form.Value, 'notify_interval', _('Notify interval'), - _('A 900s interval will result in %s notifications with the minimum max-age of 1800s', 'A 900s interval will result in %s (%s = SSDP) notifications with the minimum max-age of 1800s').format('SSDP')); + _('A 900s interval will result in %s notifications with the minimum max-age of 1800s', 'A 900s interval will result in %s (%s = SSDP) notifications with the minimum max-age of 1800s') + .format('SSDP')); o.datatype = 'uinteger'; o.placeholder = '900'; o.depends('enable_upnp', '1');