I2PSnark tweaks:

- Replace theme selector with a message when universal theming is enabled
- Move DHT debug info into its own <tr>
This commit is contained in:
str4d
2017-05-14 12:26:17 +00:00
parent 6f60d642af
commit 5caefb5ea9
2 changed files with 31 additions and 17 deletions

View File

@@ -795,14 +795,17 @@ public class SnarkManager implements CompleteListener, ClientApp {
updateConfig(); updateConfig();
} }
public boolean getUniversalTheming() {
return _context.getBooleanProperty(RC_PROP_UNIVERSAL_THEMING);
}
/** /**
* Get current theme. * Get current theme.
* @return String -- the current theme * @return String -- the current theme
*/ */
public String getTheme() { public String getTheme() {
String theme = _config.getProperty(PROP_THEME); String theme = _config.getProperty(PROP_THEME);
boolean universalTheming = _context.getBooleanProperty(RC_PROP_UNIVERSAL_THEMING); if (getUniversalTheming()) {
if (universalTheming) {
// Fetch routerconsole theme (or use our default if it doesn't exist) // Fetch routerconsole theme (or use our default if it doesn't exist)
theme = _context.getProperty(RC_PROP_THEME, DEFAULT_THEME); theme = _context.getProperty(RC_PROP_THEME, DEFAULT_THEME);
// Ensure that theme exists // Ensure that theme exists

View File

@@ -708,10 +708,6 @@ public class I2PSnarkServlet extends BasicServlet {
out.write("</tt>"); out.write("</tt>");
} }
out.write("</span>"); out.write("</span>");
if (dht != null) {
if (showDebug)
out.write(dht.renderStatusHTML());
}
out.write("</th>\n"); out.write("</th>\n");
if (_manager.util().connected() && total > 0) { if (_manager.util().connected() && total > 0) {
out.write(" <th align=\"right\">" + formatSize(stats[0]) + "</th>\n" + out.write(" <th align=\"right\">" + formatSize(stats[0]) + "</th>\n" +
@@ -722,6 +718,12 @@ public class I2PSnarkServlet extends BasicServlet {
} else { } else {
out.write("<th colspan=\"5\"></th>"); out.write("<th colspan=\"5\"></th>");
} }
if (dht != null) {
if (showDebug) {
out.write("</tr>\n<tr class=\"dhtDebug\">");
out.write(dht.renderStatusHTML());
}
}
out.write("</tr></tfoot>\n"); out.write("</tr></tfoot>\n");
} }
@@ -2270,7 +2272,15 @@ public class I2PSnarkServlet extends BasicServlet {
out.write("<tr><td>"); out.write("<tr><td>");
out.write(_t("Theme")); out.write(_t("Theme"));
out.write(":<td colspan=\"2\"><select name='theme'>"); out.write(":<td colspan=\"2\">");
if (_manager.getUniversalTheming()) {
out.write("<b>");
out.write(_manager.getTheme());
out.write("</b> (<a href=\"/configui\">");
out.write(_t("Universal theming is enabled"));
out.write("</a>)");
} else {
out.write("<select name='theme'>");
String theme = _manager.getTheme(); String theme = _manager.getTheme();
String[] themes = _manager.getThemes(); String[] themes = _manager.getThemes();
Arrays.sort(themes); Arrays.sort(themes);
@@ -2280,9 +2290,10 @@ public class I2PSnarkServlet extends BasicServlet {
else else
out.write("\n<OPTION value=\"" + themes[i] + "\">" + themes[i]); out.write("\n<OPTION value=\"" + themes[i] + "\">" + themes[i]);
} }
out.write("</select>\n" + out.write("</select>\n");
}
"<tr><td>"); out.write("<tr><td>");
out.write(_t("Refresh time")); out.write(_t("Refresh time"));
out.write(":<td colspan=\"2\"><select name=\"refreshDelay\"" out.write(":<td colspan=\"2\"><select name=\"refreshDelay\""
+ " title=\""); + " title=\"");