});
},
- handleMigration: function(ev) {
- var interfaces = this.interfaceBridgeWithIfnameSections();
+ handleBridgeMigration: function(ev) {
var tasks = [];
- interfaces.forEach(function(ns) {
+ this.interfaceBridgeWithIfnameSections().forEach(function(ns) {
var device_name = 'br-' + ns['.name'];
tasks.push(uci.callAdd('network', 'device', null, {
tasks.push(uci.callSet('network', ns['.name'], {
'type': '',
+ 'ifname': '',
'device': device_name
}));
});
+ return Promise.all(tasks)
+ .then(L.bind(ui.changes.init, ui.changes))
+ .then(L.bind(ui.changes.apply, ui.changes));
+ },
+
+ renderBridgeMigration: function() {
+ ui.showModal(_('Network bridge configuration migration'), [
+ E('p', _('The existing network configuration needs to be changed for LuCI to function properly.')),
+ E('p', _('Upon pressing "Continue", bridges configuration will be updated and the network will be restarted to apply the updated configuration.')),
+ E('div', { 'class': 'right' },
+ E('button', {
+ 'class': 'btn cbi-button-action important',
+ 'click': ui.createHandlerFn(this, 'handleBridgeMigration')
+ }, _('Continue')))
+ ]);
+ },
+
+ handleIfnameMigration: function(ev) {
+ var tasks = [];
+
this.deviceWithIfnameSections().forEach(function(ds) {
- tasks.push(uci.callSet('network', ds['.name'], {
+ tasks.push(uci.add('network', ds['.name'], {
'ifname': '',
'ports': L.toArray(ds.ifname)
}));
.then(L.bind(ui.changes.apply, ui.changes));
},
- renderMigration: function() {
- ui.showModal(_('Network bridge configuration migration'), [
+ renderIfnameMigration: function() {
+ ui.showModal(_('Network ifname configuration migration'), [
E('p', _('The existing network configuration needs to be changed for LuCI to function properly.')),
- E('p', _('Upon pressing "Continue", bridges configuration will be updated and the network will be restarted to apply the updated configuration.')),
+ E('p', _('Upon pressing "Continue", ifname options will get renamed and the network will be restarted to apply the updated configuration.')),
E('div', { 'class': 'right' },
E('button', {
'class': 'btn cbi-button-action important',
- 'click': ui.createHandlerFn(this, 'handleMigration')
+ 'click': ui.createHandlerFn(this, 'handleIfnameMigration')
}, _('Continue')))
]);
},
render: function(data) {
var netifdVersion = (data[3] || '').match(/Version: ([^\n]+)/);
- if (netifdVersion && netifdVersion[1] >= "2021-05-20" &&
- (this.interfaceBridgeWithIfnameSections().length ||
- this.deviceWithIfnameSections().length ||
- this.interfaceWithIfnameSections().length))
- return this.renderMigration();
+ if (netifdVersion && netifdVersion[1] >= "2021-05-26") {
+ if (this.interfaceBridgeWithIfnameSections().length)
+ return this.renderBridgeMigration();
+ else if (this.deviceWithIfnameSections().length || this.interfaceWithIfnameSections().length)
+ return this.renderIfnameMigration();
+ }
var dslModemType = data[0],
netDevs = data[1],
return true;
};
+ proto = s2.option(form.ListValue, 'proto', _('Protocol'));
+ proto.validate = name.validate;
+
device = s2.option(widgets.DeviceSelect, 'device', _('Device'));
device.noaliases = false;
device.optional = false;
- proto = s2.option(form.ListValue, 'proto', _('Protocol'));
- proto.validate = name.validate;
-
for (var i = 0; i < protocols.length; i++) {
proto.value(protocols[i].getProtocol(), protocols[i].getI18n());
+
+ if (!protocols[i].isVirtual())
+ device.depends('proto', protocols[i].getProtocol());
}
m2.render().then(L.bind(function(nodes) {