i2psnark: Hide peers button if no peers on that page (ticket #2152)

This commit is contained in:
zzz
2018-05-26 21:47:30 +00:00
parent f3207464bb
commit 36c279f23d
3 changed files with 31 additions and 15 deletions

View File

@ -495,21 +495,31 @@ public class I2PSnarkServlet extends BasicServlet {
out.write("</a>");
out.write("</th>\n<th class=\"snarkTorrentStatus\">");
if (_manager.util().connected() && !snarks.isEmpty()) {
out.write(" <a href=\"" + _contextPath + '/');
if (peerParam != null) {
// disable peer view
out.write(getQueryString(req, "", null, null));
out.write("\">");
tx = _t("Hide Peers");
out.write(toThemeImg("hidepeers", tx, tx));
} else {
// enable peer view
out.write(getQueryString(req, "1", null, null));
out.write("\">");
tx = _t("Show Peers");
out.write(toThemeImg("showpeers", tx, tx));
boolean hasPeers = false;
int end = Math.min(start + pageSize, snarks.size());
for (int i = start; i < end; i++) {
if (snarks.get(i).getPeerCount() > 0) {
hasPeers = true;
break;
}
}
if (hasPeers) {
out.write(" <a href=\"" + _contextPath + '/');
if (peerParam != null) {
// disable peer view
out.write(getQueryString(req, "", null, null));
out.write("\">");
tx = _t("Hide Peers");
out.write(toThemeImg("hidepeers", tx, tx));
} else {
// enable peer view
out.write(getQueryString(req, "1", null, null));
out.write("\">");
tx = _t("Show Peers");
out.write(toThemeImg("showpeers", tx, tx));
}
out.write("</a>\n");
}
out.write("</a>\n");
}
out.write("</th>\n<th colspan=\"2\" align=\"left\">");
// cycle through sort by name or type

View File

@ -1,6 +1,12 @@
2018-05-26 zzz
* /confignet: Reorganize (ticket #2217)
* /configsidebar: Tag sections for translation; sort unselected sections by translated name
* i2psnark:
- Hide "0 Bps" if no peers (ticket #2152)
- Hide peers button if no peers (ticket #2152)
- Hide column 1 icon for peers (ticket #1996)
* i2ptunnel: Retry accept after server socket closed (ticket #2003)
* Jetty: Skip files with [] in default servlet listing
* Router: Fix wrapper.config path in OOM message when installed as
Debian package, but not running as a service (ticket #2223)
* Summary Bar: Change header from "I2P Updates" to "Update Status" (ticket #2137)

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 = 13;
public final static long BUILD = 14;
/** for example "-test" */
public final static String EXTRA = "";