mirror of
https://github.com/openwrt/luci.git
synced 2025-12-26 11:16:38 +04:00
luci-mod-network: move var ipaddrs in dhcp.js
Move var ipaddrs down to the sole place where it is used. Signed-off-by: David Härdeman <david@hardeman.nu>
This commit is contained in:
committed by
Paul Donald
parent
7e1b545bfa
commit
7626b810be
@@ -294,15 +294,6 @@ return view.extend({
|
|||||||
s.tab('relay', _('Relay'));
|
s.tab('relay', _('Relay'));
|
||||||
s.tab('pxe_tftp', _('PXE/TFTP'));
|
s.tab('pxe_tftp', _('PXE/TFTP'));
|
||||||
|
|
||||||
var ipaddrs = {};
|
|
||||||
|
|
||||||
Object.keys(hosts).forEach(function(mac) {
|
|
||||||
var addrs = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4);
|
|
||||||
|
|
||||||
for (var i = 0; i < addrs.length; i++)
|
|
||||||
ipaddrs[addrs[i]] = hosts[mac].name || mac;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Begin general
|
// Begin general
|
||||||
s.taboption('general', form.Flag, 'authoritative',
|
s.taboption('general', form.Flag, 'authoritative',
|
||||||
_('Authoritative'),
|
_('Authoritative'),
|
||||||
@@ -503,7 +494,13 @@ return view.extend({
|
|||||||
|
|
||||||
return _('The IP address is outside of any DHCP pool address range');
|
return _('The IP address is outside of any DHCP pool address range');
|
||||||
};
|
};
|
||||||
|
var ipaddrs = {};
|
||||||
|
Object.keys(hosts).forEach(function(mac) {
|
||||||
|
var addrs = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4);
|
||||||
|
|
||||||
|
for (var i = 0; i < addrs.length; i++)
|
||||||
|
ipaddrs[addrs[i]] = hosts[mac].name || mac;
|
||||||
|
});
|
||||||
L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ipv4) {
|
L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ipv4) {
|
||||||
so.value(ipv4, ipaddrs[ipv4] ? '%s (%s)'.format(ipv4, ipaddrs[ipv4]) : ipv4);
|
so.value(ipv4, ipaddrs[ipv4] ? '%s (%s)'.format(ipv4, ipaddrs[ipv4]) : ipv4);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user