luci-mod-network: correctness fixes

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
Paul Donald
2026-05-26 17:30:59 +03:00
parent d070b1db61
commit 2708c78089
3 changed files with 5 additions and 4 deletions
@@ -197,7 +197,7 @@ function expandAndFormatMAC(macs) {
return result.length ? result : null;
}
function isValidMAC(sid, s) {
function isValidMAC(s) {
if (!s) return true;
for (const mac of L.toArray(s))
@@ -1002,7 +1002,7 @@ return view.extend({
return _('The MAC address %h is already used by another static lease in the same DHCP pool')
.format(host_macs.find(lm => this_macs.includes(lm)));
}
return isValidMAC(section_id, value);
return isValidMAC(value);
}
Object.keys(hosts).forEach(function(mac) {
let vendor;
@@ -115,7 +115,7 @@ function render_modal_status(node, ifc) {
dom.content(node, [
E('img', {
'src': L.resource('icons/%s%s.svg').format(dev ? dev.getType() : 'ethernet', ifc.isUp() ? '' : '_disabled'),
'src': L.resource('icons/%s%s.svg').format(dev ? dev.getType() : 'ethernet', ifc && ifc.isUp() ? '' : '_disabled'),
'title': dev ? dev.getTypeI18n() : _('Not present')
}),
ifc ? render_status(E('span'), ifc, true) : E('em', _('Interface not present or not connected yet.'))
@@ -679,6 +679,7 @@ return view.extend({
const badge = row.querySelector('[data-name="_badge"] > div');
const stat = row.querySelector('[data-name="_stat"]');
const btns = row.querySelectorAll('.cbi-section-actions button');
if (btns.length < 3) return;
const busy = btns[0].classList.contains('spinning') || btns[1].classList.contains('spinning') || btns[2].classList.contains('spinning');
if (radioDev) {
@@ -866,7 +867,7 @@ return view.extend({
s.load = function() {
return network.getWifiDevices().then(L.bind(function(radios) {
this.radios = radios.sort(function(a, b) {
return a.getName() > b.getName();
return a.getName().localeCompare(b.getName());
});
const tasks = [];