Console: Number format tweaks (ticket #1913)

This commit is contained in:
zzz
2018-02-17 15:34:17 +00:00
parent dd575316bb
commit 509e39b592
2 changed files with 8 additions and 8 deletions

View File

@ -532,7 +532,7 @@ public class SummaryHelper extends HelperBase {
if (_context == null)
return "0";
long received = _context.bandwidthLimiter().getTotalAllocatedInboundBytes();
return DataHelper.formatSize2(received) + 'B';
return DataHelper.formatSize2Decimal(received) + 'B';
}
/**
@ -544,7 +544,7 @@ public class SummaryHelper extends HelperBase {
if (_context == null)
return "0";
long sent = _context.bandwidthLimiter().getTotalAllocatedOutboundBytes();
return DataHelper.formatSize2(sent) + 'B';
return DataHelper.formatSize2Decimal(sent) + 'B';
}
/**

View File

@ -142,7 +142,7 @@ class TunnelRenderer {
out.write("<td class=\"cells\" align=\"center\">" + DataHelper.formatDuration2(timeLeft) + "</td>");
else
out.write("<td class=\"cells\" align=\"center\">(" + _t("grace period") + ")</td>");
out.write("<td class=\"cells\" align=\"center\">" + count + " KB</td>");
out.write("<td class=\"cells\" align=\"center\">" + (count * 1024 / 1000) + " KB</td>");
int lifetime = (int) ((_context.clock().now() - cfg.getCreation()) / 1000);
if (lifetime <= 0)
lifetime = 1;
@ -166,7 +166,7 @@ class TunnelRenderer {
out.write("<div class=\"statusnotes\"><b>" + _t("Inactive participating tunnels") + ":&nbsp;&nbsp;" + 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") + ":&nbsp;&nbsp;" + DataHelper.formatSize2(processed*1024) + "B</b></div>\n");
out.write("<div class=\"statusnotes\"><b>" + _t("Lifetime bandwidth usage") + ":&nbsp;&nbsp;" + DataHelper.formatSize2Decimal(processed*1024) + "B</b></div>\n");
} else {
out.write("<div class=\"statusnotes noparticipate\"><b>" + _t("Not enough shared bandwidth to build participating tunnels.") +
"</b> <a href=\"config\">[" + _t("Configure") + "]</a></div>\n");
@ -247,8 +247,8 @@ class TunnelRenderer {
out.write("<tr><td class=\"cells\" align=\"center\"><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound\" title=\"" +
_t("Outbound") + "\"></td>");
out.write("<td class=\"cells\" align=\"center\">" + DataHelper.formatDuration2(timeLeft) + "</td>\n");
int count = info.getProcessedMessagesCount();
out.write("<td class=\"cells\" align=\"center\">" + count + " KiB</td>\n");
int count = info.getProcessedMessagesCount() * 1024 / 1000;
out.write("<td class=\"cells\" align=\"center\">" + count + " KB</td>\n");
for (int j = 0; j < info.getLength(); j++) {
Hash peer = info.getPeer(j);
TunnelId id = (info.isInbound() ? info.getReceiveTunnelId(j) : info.getSendTunnelId(j));
@ -297,8 +297,8 @@ class TunnelRenderer {
if (live <= 0)
out.write("<div class=\"statusnotes\"><center><b>" + _t("No tunnels; waiting for the grace period to end.") + "</b></center></div>\n");
out.write("<div class=\"statusnotes\"><center><b>" + _t("Lifetime bandwidth usage") + ":&nbsp;&nbsp;" +
DataHelper.formatSize2(processedIn*1024) + "B " + _t("in") + ", " +
DataHelper.formatSize2(processedOut*1024) + "B " + _t("out") + "</b></center></div>");
DataHelper.formatSize2Decimal(processedIn*1024) + "B " + _t("in") + ", " +
DataHelper.formatSize2Decimal(processedOut*1024) + "B " + _t("out") + "</b></center></div>");
}
/****