luci-mod-network: properly handle wireless devices when adding interfaces
Wireless device names must not be added as list/option ifname, but the network must be backreferenced in config wifi-iface instead in these cases. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
c121a43804
commit
7b5b7fbcd6
1 changed files with 8 additions and 6 deletions
|
@ -766,7 +766,7 @@ return view.extend({
|
||||||
'click': ui.createHandlerFn(this, function(ev) {
|
'click': ui.createHandlerFn(this, function(ev) {
|
||||||
var nameval = name.isValid('_new_') ? name.formvalue('_new_') : null,
|
var nameval = name.isValid('_new_') ? name.formvalue('_new_') : null,
|
||||||
protoval = proto.isValid('_new_') ? proto.formvalue('_new_') : null,
|
protoval = proto.isValid('_new_') ? proto.formvalue('_new_') : null,
|
||||||
protoclass = protoval ? network.getProtocol(protoval) : null;
|
protoclass = protoval ? network.getProtocol(protoval, nameval) : null;
|
||||||
|
|
||||||
if (nameval == null || protoval == null || nameval == '' || protoval == '')
|
if (nameval == null || protoval == null || nameval == '' || protoval == '')
|
||||||
return;
|
return;
|
||||||
|
@ -780,16 +780,18 @@ return view.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return m.save(function() {
|
return m.save(function() {
|
||||||
var section_id = uci.add('network', 'interface', nameval);
|
uci.add('network', 'interface', nameval);
|
||||||
|
|
||||||
uci.set('network', section_id, 'proto', protoval);
|
protoclass.set('proto', protoval);
|
||||||
|
|
||||||
if (ifname_single.isActive('_new_')) {
|
if (ifname_single.isActive('_new_')) {
|
||||||
uci.set('network', section_id, 'ifname', ifname_single.formvalue('_new_'));
|
protoclass.addDevice(ifname_single.formvalue('_new_'));
|
||||||
}
|
}
|
||||||
else if (ifname_multi.isActive('_new_')) {
|
else if (ifname_multi.isActive('_new_')) {
|
||||||
uci.set('network', section_id, 'type', 'bridge');
|
protoclass.set('type', 'bridge');
|
||||||
uci.set('network', section_id, 'ifname', L.toArray(ifname_multi.formvalue('_new_')).join(' '));
|
L.toArray(ifname_multi.formvalue('_new_')).map(function(dev) {
|
||||||
|
protoclass.addDevice(dev);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}).then(L.bind(m.children[0].renderMoreOptionsModal, m.children[0], nameval));
|
}).then(L.bind(m.children[0].renderMoreOptionsModal, m.children[0], nameval));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue