lots of bitchin' oOo patches (woot, thanks oOo!), plus some cleanup

* apply oOo's patch for beautifying the new console w/ links to a shitlisted peer's netDb entry
* apply oOo's patch to clean up the peer shitlist count more aggressively
* apply oOo's patch to allow removing lines via /configadvanced.jsp
* apply oOo's patch to clean up the memory usage display
* apply oOo's patch to include log messages on /logs.jsp most recent first, rather than last
* get rid of the netDb key shitlist (its a bad idea, better solution coming soon)
This commit is contained in:
jrandom
2004-08-16 20:27:06 +00:00
committed by zzz
parent bf3ee5c158
commit e102bf9eed
8 changed files with 58 additions and 107 deletions

View File

@ -4,6 +4,8 @@ import java.io.ByteArrayInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Iterator;
/**
* Handler to deal with form submissions from the advanced config form and act
@ -41,6 +43,7 @@ public class ConfigAdvancedHandler extends FormHandler {
*
*/
private void saveChanges() {
HashSet unsetKeys = new HashSet(_context.router().getConfigMap().keySet());
if (_config != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(_config.getBytes())));
String line = null;
@ -52,12 +55,19 @@ public class ConfigAdvancedHandler extends FormHandler {
String key = line.substring(0, eq).trim();
String val = line.substring(eq + 1).trim();
_context.router().setConfigSetting(key, val);
unsetKeys.remove(key);
}
} catch (IOException ioe) {
addFormError("Error updating the configuration (IOERROR) - please see the error logs");
return;
}
Iterator cleaner = unsetKeys.iterator();
while (cleaner.hasNext()) {
String unsetKey = (String)cleaner.next();
_context.router().removeConfigSetting(unsetKey);
}
boolean saved = _context.router().saveConfig();
if (saved)
addFormNotice("Configuration saved successfully");

View File

@ -29,8 +29,8 @@ public class LogsHelper {
StringBuffer buf = new StringBuffer(16*1024);
buf.append("<h2>Most recent console messages:</h2><ul>");
buf.append("<code>\n");
for (int i = 0; i < msgs.size(); i++) {
String msg = (String)msgs.get(i);
for (int i = msgs.size(); i > 0; i--) {
String msg = (String)msgs.get(i - 1);
buf.append("<li>");
buf.append(msg);
buf.append("</li>\n");

View File

@ -71,9 +71,10 @@ public class SummaryHelper {
*
*/
public String getMemory() {
DecimalFormat integerFormatter = new DecimalFormat("###,###,##0");
long used = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/1024;
long usedPc = 100 - ((Runtime.getRuntime().freeMemory() * 100) / Runtime.getRuntime().totalMemory());
return used + "KB (" + usedPc + "%)";
return integerFormatter.format(used) + "KB (" + usedPc + "%)";
}
/**