summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-status/htdocs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-10-31 23:53:25 +0100
committerJo-Philipp Wich <jo@mein.io>2023-10-31 23:54:55 +0100
commit0bf5e5ca06a53140667f12fd728257157a3d945e (patch)
treed272d3bbd9e56aec82a0c71411a96c186e345c71 /modules/luci-mod-status/htdocs
parentbe340ed9c4bf7be3052c2554bfc0efaeabab08d7 (diff)
luci-mod-status: 29_ports.js: handle devices without speed indication
Use carrier state to distinguish connected/no link states and simply print "Connected" if no speed indication is available. Fixes: #6663 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-status/htdocs')
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
index 9ea5555deb..ab1852323b 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/29_ports.js
@@ -209,7 +209,7 @@ function buildInterfaceMapping(zones, networks) {
return portmap;
}
-function formatSpeed(speed, duplex) {
+function formatSpeed(carrier, speed, duplex) {
if (speed && duplex) {
var d = (duplex == 'half') ? '\u202f(H)' : '',
e = E('span', { 'title': _('Speed: %d Mibit/s, Duplex: %s').format(speed, duplex) });
@@ -229,7 +229,7 @@ function formatSpeed(speed, duplex) {
return e;
}
- return _('no link');
+ return carrier ? _('Connected') : _('no link');
}
function formatStats(portdev) {
@@ -352,15 +352,16 @@ return baseclass.extend({
return E('div', { 'style': 'display:grid;grid-template-columns:repeat(auto-fit, minmax(70px, 1fr));margin-bottom:1em' }, known_ports.map(function(port) {
var speed = port.netdev.getSpeed(),
duplex = port.netdev.getDuplex(),
+ carrier = port.netdev.getCarrier(),
pmap = port_map[port.netdev.getName()],
pzones = (pmap && pmap.zones.length) ? pmap.zones.sort(function(a, b) { return L.naturalCompare(a.getName(), b.getName()) }) : [ null ];
return E('div', { 'class': 'ifacebox', 'style': 'margin:.25em;min-width:70px;max-width:100px' }, [
E('div', { 'class': 'ifacebox-head', 'style': 'font-weight:bold' }, [ port.netdev.getName() ]),
E('div', { 'class': 'ifacebox-body' }, [
- E('img', { 'src': L.resource('icons/port_%s.png').format((speed && duplex) ? 'up' : 'down') }),
+ E('img', { 'src': L.resource('icons/port_%s.png').format(carrier ? 'up' : 'down') }),
E('br'),
- formatSpeed(speed, duplex)
+ formatSpeed(carrier, speed, duplex)
]),
E('div', { 'class': 'ifacebox-head cbi-tooltip-container', 'style': 'display:flex' }, [
E([], pzones.map(function(zone) {