summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-network/htdocs/luci-static/resources/view
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-05-20 15:03:43 +0200
committerRafał Miłecki <rafal@milecki.pl>2021-05-26 11:21:19 +0200
commitb8acde7f480a18343ee1f9624b790595065613ae (patch)
tree5d2f0ca04dd3e8bfc4d31d477e2b82998a4317b9 /modules/luci-mod-network/htdocs/luci-static/resources/view
parentc082ec86aae0697c65c8cc32670cbd4558870cc7 (diff)
luci-mod-network: migrate config to use "ports" option
LuCI supports only the newer method of specifying bridge ports using the "ports" option. Offer users migration so they can configure their network. Example: 1. Before config device option name 'br-lan' option type 'bridge' list ifname 'lan1' list ifname 'lan2' list ifname 'lan3' list ifname 'lan4' 2. After config device option name 'br-lan' option type 'bridge' list ports 'lan1' list ports 'lan2' list ports 'lan3' list ports 'lan4' Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'modules/luci-mod-network/htdocs/luci-static/resources/view')
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js
index cec5a6406c..a1def24b07 100644
--- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js
@@ -304,6 +304,12 @@ return view.extend({
});
},
+ deviceWithIfnameSections: function() {
+ return uci.sections('network', 'device').filter(function(ns) {
+ return ns.type == 'bridge' && !ns.ports && ns.ifname;
+ });
+ },
+
handleMigration: function(ev) {
var interfaces = this.interfaceWithIfnameSections();
var tasks = [];
@@ -323,6 +329,13 @@ return view.extend({
}));
});
+ this.deviceWithIfnameSections().forEach(function(ds) {
+ tasks.push(uci.callSet('network', ds['.name'], {
+ 'ifname': '',
+ 'ports': L.toArray(ds.ifname)
+ }));
+ });
+
return Promise.all(tasks)
.then(L.bind(ui.changes.init, ui.changes))
.then(L.bind(ui.changes.apply, ui.changes));
@@ -331,7 +344,7 @@ return view.extend({
renderMigration: 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 moved from "interface" sections to "device" sections the network will be restarted to apply the updated configuration.')),
+ 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',
@@ -341,7 +354,8 @@ return view.extend({
},
render: function(data) {
- if (this.interfaceWithIfnameSections().length)
+ if (this.interfaceWithIfnameSections().length ||
+ this.deviceWithIfnameSections().length)
return this.renderMigration();
var dslModemType = data[0],