Skip to content

Commit c3a9e9c

Browse files
committed
Remove NO-CARRIER interfaces from UI header #2145
1 parent 4a09bd2 commit c3a9e9c

File tree

1 file changed

+82
-80
lines changed

1 file changed

+82
-80
lines changed

www/js/fpp.js

Lines changed: 82 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -8212,88 +8212,90 @@ function RefreshHeaderBar () {
82128212
return 0;
82138213
}
82148214

8215-
// Show up interfaces even if they do not have IP configured - eg Colorlight
8216-
if (e.operstate === 'UP') {
8217-
if (!(Array.isArray(e.addr_info) && e.addr_info.length > 0)) {
8218-
var icon = 'text-success';
8219-
var row =
8220-
'<span ifname="' +
8221-
e.ifname +
8222-
'" class="ipTooltip" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-title="IP: ' +
8223-
e.local +
8224-
'" ><i class="fas fa-network-wired ' +
8225-
icon +
8226-
'"></i><small>' +
8227-
e.ifname +
8228-
'<div class="divIPAddress">: ' +
8229-
e.local +
8230-
'</div></small></span>';
8231-
rc.push(row);
8232-
}
8215+
if (!e.flags.some(flag => flag === "NO-CARRIER")) {
8216+
// Show up interfaces even if they do not have IP configured - eg Colorlight
8217+
if (e.operstate === 'UP') {
8218+
if (!(Array.isArray(e.addr_info) && e.addr_info.length > 0)) {
8219+
var icon = 'text-success';
8220+
var row =
8221+
'<span ifname="' +
8222+
e.ifname +
8223+
'" class="ipTooltip" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-title="IP: ' +
8224+
e.local +
8225+
'" ><i class="fas fa-network-wired ' +
8226+
icon +
8227+
'"></i><small>' +
8228+
e.ifname +
8229+
'<div class="divIPAddress">: ' +
8230+
e.local +
8231+
'</div></small></span>';
8232+
rc.push(row);
8233+
}
8234+
}
8235+
8236+
e.addr_info.forEach(function (n) {
8237+
if (
8238+
n.family === 'inet' &&
8239+
(n.local == '192.168.8.1' ||
8240+
e.ifname.startsWith('SoftAp') ||
8241+
e.ifname.startsWith('tether'))
8242+
) {
8243+
var row =
8244+
'<span ifname="' +
8245+
e.ifname +
8246+
'" class="ipTooltip" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-title="Tether IP: ' +
8247+
n.local +
8248+
'"><i class="fas fa-broadcast-tower"></i><small>' +
8249+
e.ifname +
8250+
'<div class="divIPAddress">: ' +
8251+
n.local +
8252+
'</div></small></span>';
8253+
rc.push(row);
8254+
} else if (n.family === 'inet' && 'wifi' in e) {
8255+
var row =
8256+
'<span ifname="' +
8257+
e.ifname +
8258+
'" class="ipTooltip" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-title="IP: ' +
8259+
n.local +
8260+
'<br/>Strength: ' +
8261+
e.wifi.level +
8262+
e.wifi.unit +
8263+
'">';
8264+
row +=
8265+
'<img src="images/redesign/wifi-' +
8266+
e.wifi.desc +
8267+
'.svg" height="14px"/>';
8268+
row +=
8269+
'<small>' +
8270+
e.ifname +
8271+
'<div class="divIPAddress">: ' +
8272+
n.local +
8273+
'</div></small></span>';
8274+
rc.push(row);
8275+
} else if (n.family === 'inet') {
8276+
var icon = 'text-success';
8277+
if (n.local.startsWith('169.254.') && e.flags.includes('DYNAMIC')) {
8278+
icon = 'text-warning';
8279+
} else if (e.flags.includes('STATIC') && e.operstate != 'UP') {
8280+
icon = 'text-danger';
8281+
}
8282+
var row =
8283+
'<span ifname="' +
8284+
e.ifname +
8285+
'" class="ipTooltip" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-title="IP: ' +
8286+
n.local +
8287+
'" ><i class="fas fa-network-wired ' +
8288+
icon +
8289+
'"></i><small>' +
8290+
e.ifname +
8291+
'<div class="divIPAddress">: ' +
8292+
n.local +
8293+
'</div></small></span>';
8294+
rc.push(row);
8295+
}
8296+
});
82338297
}
82348298

8235-
e.addr_info.forEach(function (n) {
8236-
if (
8237-
n.family === 'inet' &&
8238-
(n.local == '192.168.8.1' ||
8239-
e.ifname.startsWith('SoftAp') ||
8240-
e.ifname.startsWith('tether'))
8241-
) {
8242-
var row =
8243-
'<span ifname="' +
8244-
e.ifname +
8245-
'" class="ipTooltip" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-title="Tether IP: ' +
8246-
n.local +
8247-
'"><i class="fas fa-broadcast-tower"></i><small>' +
8248-
e.ifname +
8249-
'<div class="divIPAddress">: ' +
8250-
n.local +
8251-
'</div></small></span>';
8252-
rc.push(row);
8253-
} else if (n.family === 'inet' && 'wifi' in e) {
8254-
var row =
8255-
'<span ifname="' +
8256-
e.ifname +
8257-
'" class="ipTooltip" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-title="IP: ' +
8258-
n.local +
8259-
'<br/>Strength: ' +
8260-
e.wifi.level +
8261-
e.wifi.unit +
8262-
'">';
8263-
row +=
8264-
'<img src="images/redesign/wifi-' +
8265-
e.wifi.desc +
8266-
'.svg" height="14px"/>';
8267-
row +=
8268-
'<small>' +
8269-
e.ifname +
8270-
'<div class="divIPAddress">: ' +
8271-
n.local +
8272-
'</div></small></span>';
8273-
rc.push(row);
8274-
} else if (n.family === 'inet') {
8275-
var icon = 'text-success';
8276-
if (n.local.startsWith('169.254.') && e.flags.includes('DYNAMIC')) {
8277-
icon = 'text-warning';
8278-
} else if (e.flags.includes('STATIC') && e.operstate != 'UP') {
8279-
icon = 'text-danger';
8280-
}
8281-
var row =
8282-
'<span ifname="' +
8283-
e.ifname +
8284-
'" class="ipTooltip" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-title="IP: ' +
8285-
n.local +
8286-
'" ><i class="fas fa-network-wired ' +
8287-
icon +
8288-
'"></i><small>' +
8289-
e.ifname +
8290-
'<div class="divIPAddress">: ' +
8291-
n.local +
8292-
'</div></small></span>';
8293-
rc.push(row);
8294-
}
8295-
});
8296-
82978299
// All rows start with '<span ifname="INTERFACENAME" ' so we can sort the full list in the UI.
82988300
rc.sort();
82998301
});

0 commit comments

Comments
 (0)