[OpenWrt-Devel] [PATCH 2/4 v2] luci2/network.switch: display switch port status icon

Álvaro Fernández Rojas noltari at gmail.com
Thu Nov 20 21:30:16 EST 2014


Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
v2: fix typo

diff --git a/luci2/htdocs/luci2/view/network.switch.js b/luci2/htdocs/luci2/view/network.switch.js
index 057955e..9391b3d 100644
--- a/luci2/htdocs/luci2/view/network.switch.js
+++ b/luci2/htdocs/luci2/view/network.switch.js
@@ -318,17 +318,19 @@ L.ui.view.extend({
 					return self.getSwitchStatus(swname).then(function(ports) {
 						for (var j = 0; j < ports.length; j++)
 						{
+							var i = '/icons/port_down.png';
 							var s = L.tr('No link');
 							var d = ' ';
 
 							if (ports[j].link)
 							{
+								i = '/icons/port_up.png');
 								s = '%dbaseT'.format(ports[j].speed);
 								d = ports[j].full_duplex ? L.tr('Full-duplex') : L.tr('Half-duplex');
 							}
 
 							$('#portstatus-%s-%d'.format(swname, j))
-								.empty().append(s + '<br />' + d);
+								.empty().append($('<img />').attr('src', L.globals.resource + i)).append('<br />' + s + '<br />' + d);
 						}
 					});
 				}, 5000);
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list