Console: 2 column display of transit tunnels if > 8 & width > 1200px

This commit is contained in:
dr|z3d 2021-08-25 06:36:21 +00:00
parent ebb0c4c9e9
commit e481e8b267
2 changed files with 27 additions and 5 deletions

View file

@ -1346,10 +1346,16 @@ namespace http {
{
if(i2p::tunnel::tunnels.CountTransitTunnels())
{
int count = i2p::tunnel::tunnels.GetTransitTunnels().size();
s << "<tr><th class=\"sectiontitle configuration\" colspan=\"2\"><span>" << tr("Transit Tunnels") << "</span></th></tr>";
s << "<tr><td class=\"center nopadding\" colspan=\"2\">\r\n<div class=\"list\">\r\n";
s << "<tr><td class=\"center nopadding\" colspan=\"2\">\r\n";
s << "<div ";
if (count > 8)
s << "id=\"transit\" ";
s << "class=\"list\">\r\n";
for (const auto& it: i2p::tunnel::tunnels.GetTransitTunnels ())
{
const auto& expiry = i2p::tunnel::tunnels.GetTransitTunnelsExpirationTimeout ();
s << "<div class=\"listitem\"><span class=\"chain transit\">";
double bytes = it->GetNumTransmittedBytes ();
@ -1365,7 +1371,8 @@ namespace http {
} else {
s << "<span class=\"sent\">" << (int) (bytes) << "B</span> ";
}
// TODO: tunnel expiry per tunnel, not most recent
//s << "<span class=\"expiry\">" << expiry << tr("s" /* translation: seconds */) << "</span> ";
s << "<span class=\"tunnelid\">" << it->GetTunnelID () << "</span> ";
if (std::dynamic_pointer_cast<i2p::tunnel::TransitTunnelGateway>(it))
s << "<span class=\"role ibgw\" data-tooltip=\"" << tr("inbound gateway") << "\">"
@ -1844,7 +1851,7 @@ namespace http {
}
// HTML head start
ShowPageHead (s);
if (/*req.uri.find("summary") != std::string::npos ||*/
if (req.uri.find("summary") != std::string::npos ||
req.uri.find("commands") != std::string::npos ||
(req.uri.find("local_destinations") != std::string::npos &&
req.uri.find("b32") == std::string::npos))

View file

@ -955,7 +955,7 @@ a:hover .host, a:focus .host, a:active .host {
text-align: right;
}
.latency {
.latency, .expiry {
padding: 2px 5px 2px 20px;
min-width: 40px;
display: inline-block;
@ -966,6 +966,11 @@ a:hover .host, a:focus .host, a:active .host {
border-radius: 2px;
}
.expiry {
margin-left: 10px;
float: none;
}
.latency.unknown {
color: var(--ink-faded);
}
@ -1410,6 +1415,12 @@ input[type=checkbox]:checked + label::after {
text-align: center;
}
#transit.list {
columns: 2;
column-gap: 1px;
column-rule: 1px solid var(--border2);
}
.hops {
min-width: 280px;
display: inline-block;
@ -1469,12 +1480,16 @@ input[type=checkbox]:checked + label::after {
background-position: 5px center;
}
.latency {
.latency, .expiry {
padding-top: 3px;
padding-bottom: 3px;
margin-left: 12px;
}
.expiry {
float: right;
}
.transferred {
min-width: 48px;
}