luci-mod-network: Rework the (multi) mac for static leases
+i18n Removed Jows widget which hindered management of multi mac entries. Signed-off-by: Paul Donald <newtwen@gmail.com>
This commit is contained in:
parent
bcaa445f08
commit
d5db17361a
1 changed files with 3 additions and 25 deletions
|
@ -913,7 +913,8 @@ return view.extend({
|
|||
uci.unset('dhcp', section, 'dns');
|
||||
};
|
||||
|
||||
so = ss.option(form.Value, 'mac',
|
||||
//this can be a .DynamicList or a .Value with a widget and dnsmasq handles multimac OK.
|
||||
so = ss.option(form.DynamicList, 'mac',
|
||||
_('MAC address(es)'),
|
||||
_('The hardware address(es) of this entry/host.') + '<br /><br />' +
|
||||
_('In DHCPv4, it is possible to include more than one mac address. This allows an IP address to be associated with multiple macaddrs, and dnsmasq abandons a DHCP lease to one of the macaddrs when another asks for a lease. It only works reliably if only one of the macaddrs is active at any time.'));
|
||||
|
@ -923,30 +924,7 @@ return view.extend({
|
|||
var macs = L.toArray(uci.get('dhcp', section, 'mac'));
|
||||
return expandAndFormatMAC(macs);
|
||||
};
|
||||
so.renderWidget = function(section_id, option_index, cfgvalue) {
|
||||
var node = form.Value.prototype.renderWidget.apply(this, [section_id, option_index, cfgvalue]),
|
||||
ipopt = this.section.children.filter(function(o) { return o.option == 'ip' })[0];
|
||||
|
||||
node.addEventListener('cbi-dropdown-change', L.bind(function(ipopt, section_id, ev) {
|
||||
var mac = ev.detail.value.value;
|
||||
if (mac == null || mac == '' || !hosts[mac])
|
||||
return;
|
||||
|
||||
var iphint = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
|
||||
if (iphint == null)
|
||||
return;
|
||||
|
||||
var ip = ipopt.formvalue(section_id);
|
||||
if (ip != null && ip != '')
|
||||
return;
|
||||
|
||||
var node = ipopt.map.findElement('id', ipopt.cbid(section_id));
|
||||
if (node)
|
||||
dom.callClassMethod(node, 'setValue', iphint);
|
||||
}, this, ipopt, section_id));
|
||||
|
||||
return node;
|
||||
};
|
||||
//removed jows renderwidget function which hindered multi-mac entry
|
||||
so.validate = validateMACAddr.bind(so, pools);
|
||||
Object.keys(hosts).forEach(function(mac) {
|
||||
var hint = hosts[mac].name || L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];
|
||||
|
|
Loading…
Reference in a new issue