Remove redundant html markup and refashion table display a la fois.

This commit is contained in:
z3d
2009-07-28 13:06:19 +00:00
parent 256bb771e1
commit 73f8cb4819
14 changed files with 131 additions and 92 deletions

View File

@ -762,7 +762,7 @@ public class Router {
buf.append("\n<h2>Most recent console messages:</h2><table border=\"1\">\n");
for (Iterator iter = msgs.iterator(); iter.hasNext(); ) {
String msg = (String)iter.next();
buf.append("<tr><td valign=\"top\" align=\"left\"><pre>");
buf.append("<tr><td align=\"left\"><pre>");
appendLogMessage(buf, msg);
buf.append("</pre></td></tr>\n");
}

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 28;
public final static long BUILD = 29;
/** for example "-test" */
public final static String EXTRA = "-rc";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;

View File

@ -1037,11 +1037,11 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
}
}
buf.append("<table border=\"0\" cellspacing=\"30\"><tr><td valign=\"top\">");
buf.append("<table border=\"0\" cellspacing=\"30\"><tr><td>");
List<String> versionList = new ArrayList(versions.objects());
if (versionList.size() > 0) {
Collections.sort(versionList, Collections.reverseOrder());
buf.append("<table border=\"1\">\n");
buf.append("<table>\n");
buf.append("<tr><th>Version</th><th>Count</th></tr>\n");
for (String routerVersion : versionList) {
int num = versions.count(routerVersion);
@ -1050,14 +1050,14 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
}
buf.append("</table>\n");
}
buf.append("</td><td valign=\"top\">");
buf.append("</td><td>");
out.write(buf.toString());
buf.setLength(0);
List<String> countryList = new ArrayList(countries.objects());
if (countryList.size() > 0) {
Collections.sort(countryList);
buf.append("<table border=\"1\">\n");
buf.append("<table>\n");
buf.append("<tr><th>Country</th><th>Count</th></tr>\n");
for (String country : countryList) {
int num = countries.count(country);

View File

@ -59,7 +59,7 @@ class ProfileOrganizerRenderer {
StringBuilder buf = new StringBuilder(16*1024);
buf.append("<h2>Peer Profiles</h2>\n");
buf.append("<p>Showing ").append(order.size()).append(" recent profiles, hiding ").append(peers.size()-order.size()).append(" older profiles</p>");
buf.append("<table border=\"1\">");
buf.append("<table>");
buf.append("<tr>");
buf.append("<th>Peer</th>");
buf.append("<th>Groups (Caps)</th>");
@ -98,9 +98,9 @@ class ProfileOrganizerRenderer {
buf.append("<tr><td colspan=\"7\"><hr /></td></tr>\n");
prevTier = tier;
buf.append("<tr><td align=\"right\" nowrap>");
buf.append("<tr><td align=\"center\" nowrap>");
buf.append(_context.commSystem().renderPeerHTML(peer));
buf.append("</td><td>");
buf.append("</td><td align=\"center\">");
switch (tier) {
case 1: buf.append("Fast, High Capacity"); break;
@ -137,7 +137,7 @@ class ProfileOrganizerRenderer {
buf.append(bonus).append(')');
}
buf.append("</td><td align=\"right\">").append(num(prof.getIntegrationValue()));
buf.append("</td><td>");
buf.append("</td><td align=\"center\">");
if (_context.shitlist().isShitlisted(peer)) buf.append("Shitlist");
if (prof.getIsFailing()) buf.append(" Failing");
if (_context.commSystem().wasUnreachable(peer)) buf.append(" Unreachable");
@ -150,37 +150,41 @@ class ProfileOrganizerRenderer {
buf.append(' ').append(fails).append('/').append(total).append(" Test Fails");
}
buf.append("&nbsp</td>");
buf.append("<td nowrap><a href=\"dumpprofile.jsp?peer=").append(peer.toBase64().substring(0,6)).append("\">profile</a>");
buf.append("/<a href=\"configpeer.jsp?peer=").append(peer.toBase64()).append("\">+-</a></td>\n");
buf.append("<td nowrap align=\"center\"><a target=\"_blank\" href=\"dumpprofile.jsp?peer=").append(peer.toBase64().substring(0,6)).append("\">profile</a>");
buf.append("&nbsp;<a href=\"configpeer.jsp?peer=").append(peer.toBase64()).append("\">+-</a></td>\n");
buf.append("</tr>");
}
buf.append("</table>");
buf.append("<h2>Floodfill and Integrated Peers</h2>\n");
buf.append("<table border=\"1\">");
buf.append("<table>");
buf.append("<tr>");
buf.append("<th>Peer</th>");
buf.append("<th>Caps</th>");
buf.append("<th>Integ. Value</th>");
buf.append("<th>Last Heard About</th>");
buf.append("<th>Last Heard From</th>");
buf.append("<th>Last Successful Send</th>");
buf.append("<th>Last Failed Send</th>");
buf.append("<th>10m Resp. Time</th>");
buf.append("<th>1h Resp. Time</th>");
buf.append("<th>1d Resp. Time</th>");
buf.append("<th>Successful Lookups</th>");
buf.append("<th>Failed Lookups</th>");
buf.append("<th>New Stores</th>");
buf.append("<th>Old Stores</th>");
buf.append("<th>1h Fail Rate</th>");
buf.append("<th>1d Fail Rate</th>");
buf.append("<th class=\"smallhead\">Peer</th>");
buf.append("<th class=\"smallhead\">Caps</th>");
buf.append("<th class=\"smallhead\">Integ. Value</th>");
buf.append("<th class=\"smallhead\">Last Heard About</th>");
buf.append("<th class=\"smallhead\">Last Heard From</th>");
// buf.append("<th class=\"smallhead\">Last Successful Send</th>");
buf.append("<th class=\"smallhead\">Last Good Send</th>");
// buf.append("<th class=\"smallhead\">Last Failed Send</th>");
buf.append("<th class=\"smallhead\">Last Bad Send</th>");
buf.append("<th class=\"smallhead\">10m Resp. Time</th>");
buf.append("<th class=\"smallhead\">1h Resp. Time</th>");
buf.append("<th class=\"smallhead\">1d Resp. Time</th>");
// buf.append("<th class=\"smallhead\">Successful Lookups</th>");
buf.append("<th class=\"smallhead\">Good Lookups</th>");
// buf.append("<th>Failed Lookups</th>");
buf.append("<th class=\"smallhead\">Bad Lookups</th>");
buf.append("<th class=\"smallhead\">New Stores</th>");
buf.append("<th class=\"smallhead\">Old Stores</th>");
buf.append("<th class=\"smallhead\">1h Fail Rate</th>");
buf.append("<th class=\"smallhead\">1d Fail Rate</th>");
buf.append("</tr>");
for (Iterator iter = integratedPeers.iterator(); iter.hasNext();) {
PeerProfile prof = (PeerProfile)iter.next();
Hash peer = prof.getPeer();
buf.append("<tr><td align=\"right\" nowrap>");
buf.append("<tr><td align=\"center\" nowrap>");
buf.append(_context.commSystem().renderPeerHTML(peer));
buf.append("</td>");
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);

View File

@ -643,7 +643,7 @@ public class NTCPTransport extends TransportImpl {
buf.append(" limit: ").append(getMaxConnections());
buf.append(" timeout: ").append(DataHelper.formatDuration(_pumper.getIdleTimeout()));
buf.append("</b><br />\n");
buf.append("<table border=\"1\">\n");
buf.append("<table>\n");
buf.append("<tr><th><a href=\"#def.peer\">Peer</a></th>");
buf.append("<th>Dir</th>");
buf.append("<th align=\"right\"><a href=\"#def.idle\">Idle</a></th>");

View File

@ -1767,7 +1767,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
buf.append(" limit: ").append(getMaxConnections());
buf.append(" timeout: ").append(DataHelper.formatDuration(_expireTimeout));
buf.append("</b><br />\n");
buf.append("<table border=\"1\">\n");
buf.append("<table>\n");
buf.append("<tr><th><a href=\"#def.peer\">Peer</a>");
if (sortFlags != FLAG_ALPHA)
buf.append(" <a href=\"").append(urlBase).append("?sort=0\">V</a> ");
@ -1862,7 +1862,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
if (idleIn < 0) idleIn = 0;
if (idleOut < 0) idleOut = 0;
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(idleIn);
buf.append("s/");
buf.append(idleOut);
@ -1871,7 +1871,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
int recvBps = (idleIn > 2 ? 0 : peer.getReceiveBps());
int sendBps = (idleOut > 2 ? 0 : peer.getSendBps());
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(formatKBps(recvBps));
buf.append("/");
buf.append(formatKBps(sendBps));
@ -1884,18 +1884,18 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
long uptime = now - peer.getKeyEstablishedTime();
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(DataHelper.formatDuration(uptime));
buf.append("</code></td>");
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(peer.getClockSkew());
buf.append("s</code></td>");
offsetTotal = offsetTotal + peer.getClockSkew();
long sendWindow = peer.getSendWindowBytes();
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(sendWindow/1024);
buf.append("K");
buf.append("/").append(peer.getConcurrentSends());
@ -1903,26 +1903,26 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
buf.append("/").append(peer.getConsecutiveSendRejections());
buf.append("</code></td>");
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(peer.getSlowStartThreshold()/1024);
buf.append("K</code></td>");
int rtt = peer.getRTT();
int rto = peer.getRTO();
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(rtt);
buf.append("</code></td>");
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(peer.getRTTDeviation());
buf.append("</code></td>");
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(rto);
buf.append("</code></td>");
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(peer.getMTU()).append("/").append(peer.getReceiveMTU());
//.append('/');
@ -1933,11 +1933,11 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
long sent = peer.getPacketsTransmitted();
long recv = peer.getPacketsReceived();
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(sent);
buf.append("</code></td>");
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(recv);
buf.append("</code></td>");
@ -1949,14 +1949,14 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
long resent = peer.getPacketsRetransmitted();
long dupRecv = peer.getPacketsReceivedDuplicate();
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
//buf.append(formatPct(sendLostPct));
buf.append(resent); // + "/" + peer.getPacketsPeriodRetransmitted() + "/" + sent);
//buf.append(peer.getPacketRetransmissionRate());
buf.append("</code></td>");
double recvDupPct = (double)peer.getPacketsReceivedDuplicate()/(double)peer.getPacketsReceived();
buf.append("<td valign=\"top\" align=\"right\" ><code>");
buf.append("<td align=\"right\" ><code>");
buf.append(dupRecv); //formatPct(recvDupPct));
buf.append("</code></td>");

View File

@ -438,7 +438,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
List participating = _context.tunnelDispatcher().listParticipatingTunnels();
Collections.sort(participating, new TunnelComparator());
out.write("<h2><a name=\"participating\"></a>Participating tunnels:</h2><table border=\"1\">\n");
out.write("<h2><a name=\"participating\"></a>Participating tunnels:</h2><table>\n");
out.write("<tr><th>Receive on</th><th>From</th><th>"
+ "Send on</th><th>To</th><th>Expiration</th>"
+ "<th>Usage</th><th>Rate</th><th>Role</th></tr>\n");
@ -524,7 +524,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
if (info.getLength() > maxLength)
maxLength = info.getLength();
}
out.write("<table border=\"1\"><tr><th>In/Out</th><th>Expiry</th><th>Usage</th><th>Gateway</th>");
out.write("<table><tr><th>In/Out</th><th>Expiry</th><th>Usage</th><th>Gateway</th>");
if (maxLength > 3) {
out.write("<th align=\"center\" colspan=\"" + (maxLength - 2));
out.write("\">Participants</th>");
@ -603,7 +603,7 @@ public class TunnelPoolManager implements TunnelManagerFacade {
Collections.sort(peerList, new HashComparator());
out.write("<h2><a name=\"peers\"></a>Tunnel Counts By Peer:</h2>\n");
out.write("<table border=\"1\"><tr><th>Peer</th><th>Expl. + Client</th><th>% of total</th><th>Part. from + to</th><th>% of total</th></tr>\n");
out.write("<table><tr><th>Peer</th><th>Expl. + Client</th><th>% of total</th><th>Part. from + to</th><th>% of total</th></tr>\n");
for (Hash h : peerList) {
out.write("<tr><td align=\"center\">");
out.write(netDbLink(h));