luci-app-upnp: remove dangling lines and split translations

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
This commit is contained in:
Sergey Ponomarev
2024-11-30 14:53:50 +02:00
committed by Paul Donald
parent 98c04137b4
commit 7a7f9ec0b7
2 changed files with 16 additions and 18 deletions

View File

@@ -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;
}
});

View File

@@ -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(
'<a href="https://en.wikipedia.org/wiki/Internet_Gateway_Device_Protocol" target="_blank" rel="noreferrer"><abbr title="UPnP Internet Gateway Device (Control Protocol)">UPnP IGD</abbr></a>',
'<a href="https://en.wikipedia.org/wiki/Port_Control_Protocol" target="_blank" rel="noreferrer"><abbr title="Port Control Protocol">PCP</abbr></a>',
'<a href="https://en.wikipedia.org/wiki/NAT_Port_Mapping_Protocol" target="_blank" rel="noreferrer"><abbr title="NAT Port Mapping Protocol">NAT-PMP</abbr></a>');
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('<a href="https://en.wikipedia.org/wiki/Internet_Gateway_Device_Protocol" target="_blank" rel="noreferrer"><abbr title="UPnP Internet Gateway Device (Control Protocol)">UPnP IGD</abbr></a>', '<a href="https://en.wikipedia.org/wiki/Port_Control_Protocol" target="_blank" rel="noreferrer"><abbr title="Port Control Protocol">PCP</abbr></a>', '<a href="https://en.wikipedia.org/wiki/NAT_Port_Mapping_Protocol" target="_blank" rel="noreferrer"><abbr title="NAT Port Mapping Protocol">NAT-PMP</abbr></a>'));
_('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('<a href="https://en.wikipedia.org/wiki/STUN" target="_blank" rel="noreferrer"><abbr title="Session Traversal Utilities for NAT">STUN</abbr></a>'),
s.taboption('advanced', form.Flag, 'use_stun', _('Use %s', 'Use %s (%s = STUN)')
.format('<a href="https://en.wikipedia.org/wiki/STUN" target="_blank" rel="noreferrer"><abbr title="Session Traversal Utilities for NAT">STUN</abbr></a>'),
_('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('<abbr title="Simple Service Discovery Protocol">SSDP</abbr>'));
_('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('<abbr title="Simple Service Discovery Protocol">SSDP</abbr>'));
o.datatype = 'uinteger';
o.placeholder = '900';
o.depends('enable_upnp', '1');