Show 'none' if no part. tunnels on /tunnels

This commit is contained in:
zzz
2015-10-03 14:06:12 +00:00
parent f93da93cf0
commit f4a6cf2002

View File

@ -66,11 +66,13 @@ public class TunnelRenderer {
} }
List<HopConfig> participating = _context.tunnelDispatcher().listParticipatingTunnels(); List<HopConfig> participating = _context.tunnelDispatcher().listParticipatingTunnels();
Collections.sort(participating, new TunnelComparator()); out.write("<h2><a name=\"participating\"></a>" + _t("Participating tunnels") + "</h2>\n");
out.write("<h2><a name=\"participating\"></a>" + _t("Participating tunnels") + "</h2><table>\n"); if (!participating.isEmpty()) {
out.write("<tr><th>" + _t("Receive on") + "</th><th>" + _t("From") + "</th><th>" Collections.sort(participating, new TunnelComparator());
out.write("<table><tr><th>" + _t("Receive on") + "</th><th>" + _t("From") + "</th><th>"
+ _t("Send on") + "</th><th>" + _t("To") + "</th><th>" + _t("Expiration") + "</th>" + _t("Send on") + "</th><th>" + _t("To") + "</th><th>" + _t("Expiration") + "</th>"
+ "<th>" + _t("Usage") + "</th><th>" + _t("Rate") + "</th><th>" + _t("Role") + "</th></tr>\n"); + "<th>" + _t("Usage") + "</th><th>" + _t("Rate") + "</th><th>" + _t("Role") + "</th></tr>\n");
}
long processed = 0; long processed = 0;
RateStat rs = _context.statManager().getRate("tunnel.participatingMessageCount"); RateStat rs = _context.statManager().getRate("tunnel.participatingMessageCount");
if (rs != null) if (rs != null)
@ -125,10 +127,14 @@ public class TunnelRenderer {
out.write("<td class=\"cells\" align=\"center\">" + _t("Participant") + "</td>"); out.write("<td class=\"cells\" align=\"center\">" + _t("Participant") + "</td>");
out.write("</tr>\n"); out.write("</tr>\n");
} }
out.write("</table>\n"); if (!participating.isEmpty())
out.write("</table>\n");
if (displayed > DISPLAY_LIMIT) if (displayed > DISPLAY_LIMIT)
out.write("<div class=\"statusnotes\"><b>" + _t("Limited display to the {0} tunnels with the highest usage", DISPLAY_LIMIT) + "</b></div>\n"); out.write("<div class=\"statusnotes\"><b>" + _t("Limited display to the {0} tunnels with the highest usage", DISPLAY_LIMIT) + "</b></div>\n");
out.write("<div class=\"statusnotes\"><b>" + _t("Inactive participating tunnels") + ": " + inactive + "</b></div>\n"); if (inactive > 0)
out.write("<div class=\"statusnotes\"><b>" + _t("Inactive participating tunnels") + ": " + inactive + "</b></div>\n");
else if (displayed <= 0)
out.write("<div class=\"statusnotes\"><b>" + _t("none") + "</b></div>\n");
out.write("<div class=\"statusnotes\"><b>" + _t("Lifetime bandwidth usage") + ": " + DataHelper.formatSize2(processed*1024) + "B</b></div>\n"); out.write("<div class=\"statusnotes\"><b>" + _t("Lifetime bandwidth usage") + ": " + DataHelper.formatSize2(processed*1024) + "B</b></div>\n");
//renderPeers(out); //renderPeers(out);
out.write("</div>"); out.write("</div>");