luci-mod-network: ensure consistent bridge port and network interface order
Ref: #5899 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
37422e891a
commit
801d4513b2
2 changed files with 5 additions and 25 deletions
|
@ -780,6 +780,8 @@ return baseclass.extend({
|
||||||
return network.instantiateDevice(port)
|
return network.instantiateDevice(port)
|
||||||
}).filter(function(dev) {
|
}).filter(function(dev) {
|
||||||
return dev.getType() != 'wifi' || dev.isUp();
|
return dev.getType() != 'wifi' || dev.isUp();
|
||||||
|
}).sort(function(a, b) {
|
||||||
|
return L.naturalCompare(a.getName(), b.getName());
|
||||||
});
|
});
|
||||||
|
|
||||||
this.children = this.children.filter(function(opt) { return !opt.option.match(/^port_/) });
|
this.children = this.children.filter(function(opt) { return !opt.option.match(/^port_/) });
|
||||||
|
@ -893,18 +895,6 @@ return baseclass.extend({
|
||||||
for (var port_name in seen_ports)
|
for (var port_name in seen_ports)
|
||||||
ports.push(port_name);
|
ports.push(port_name);
|
||||||
|
|
||||||
ports.sort(function(a, b) {
|
|
||||||
var m1 = a.match(/^(.+?)([0-9]*)$/),
|
|
||||||
m2 = b.match(/^(.+?)([0-9]*)$/);
|
|
||||||
|
|
||||||
if (m1[1] < m2[1])
|
|
||||||
return -1;
|
|
||||||
else if (m1[1] > m2[1])
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return +(m1[2] || 0) - +(m2[2] || 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
ss.updatePorts(ports);
|
ss.updatePorts(ports);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -13,16 +13,6 @@
|
||||||
|
|
||||||
var isReadonlyView = !L.hasViewPermission() || null;
|
var isReadonlyView = !L.hasViewPermission() || null;
|
||||||
|
|
||||||
function strcmp(a, b) {
|
|
||||||
if (a < b)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (a > b)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function count_changes(section_id) {
|
function count_changes(section_id) {
|
||||||
var changes = ui.changes.changes, n = 0;
|
var changes = ui.changes.changes, n = 0;
|
||||||
|
|
||||||
|
@ -545,7 +535,7 @@ return view.extend({
|
||||||
var protocols = network.getProtocols();
|
var protocols = network.getProtocols();
|
||||||
|
|
||||||
protocols.sort(function(a, b) {
|
protocols.sort(function(a, b) {
|
||||||
return strcmp(a.getProtocol(), b.getProtocol());
|
return L.naturalCompare(a.getProtocol(), b.getProtocol());
|
||||||
});
|
});
|
||||||
|
|
||||||
o = s.taboption('general', form.DummyValue, '_ifacestat_modal', _('Status'));
|
o = s.taboption('general', form.DummyValue, '_ifacestat_modal', _('Status'));
|
||||||
|
@ -1101,7 +1091,7 @@ return view.extend({
|
||||||
proto, name, device;
|
proto, name, device;
|
||||||
|
|
||||||
protocols.sort(function(a, b) {
|
protocols.sort(function(a, b) {
|
||||||
return a.getProtocol() > b.getProtocol();
|
return L.naturalCompare(a.getProtocol(), b.getProtocol());
|
||||||
});
|
});
|
||||||
|
|
||||||
s2.render = function() {
|
s2.render = function() {
|
||||||
|
@ -1263,7 +1253,7 @@ return view.extend({
|
||||||
|
|
||||||
s.cfgsections = function() {
|
s.cfgsections = function() {
|
||||||
var sections = uci.sections('network', 'device'),
|
var sections = uci.sections('network', 'device'),
|
||||||
section_ids = sections.sort(function(a, b) { return strcmp(a.name, b.name) }).map(function(s) { return s['.name'] });
|
section_ids = sections.sort(function(a, b) { return L.naturalCompare(a.name, b.name) }).map(function(s) { return s['.name'] });
|
||||||
|
|
||||||
for (var i = 0; i < netDevs.length; i++) {
|
for (var i = 0; i < netDevs.length; i++) {
|
||||||
if (sections.filter(function(s) { return s.name == netDevs[i].getName() }).length)
|
if (sections.filter(function(s) { return s.name == netDevs[i].getName() }).length)
|
||||||
|
|
Loading…
Reference in a new issue