Console: migrate transit traffic / bandwidth to same rows as standard b/w

This commit is contained in:
dr|z3d 2021-08-26 06:43:47 +00:00
parent b5f2299b8c
commit caf18f819d
2 changed files with 40 additions and 7 deletions

View file

@ -610,7 +610,6 @@ namespace http {
#endif #endif
s << "<tr><td>" << tr("Bandwidth") << "</td><td><span class=\"router recvd\">"; s << "<tr><td>" << tr("Bandwidth") << "</td><td><span class=\"router recvd\">";
s << std::fixed << std::setprecision(0); s << std::fixed << std::setprecision(0);
// s << (double) i2p::transport::transports.GetInBandwidth () / 1024 << "&#8239;" << tr(/* tr: Kibibit/s */ "KiB/s");
if (i2p::transport::transports.GetInBandwidth () > 1024*1024*1024 || if (i2p::transport::transports.GetInBandwidth () > 1024*1024*1024 ||
i2p::transport::transports.GetInBandwidth () < 1024) i2p::transport::transports.GetInBandwidth () < 1024)
s << std::fixed << std::setprecision(2); s << std::fixed << std::setprecision(2);
@ -618,7 +617,6 @@ namespace http {
s << std::fixed << std::setprecision(1); s << std::fixed << std::setprecision(1);
s << (double) i2p::transport::transports.GetInBandwidth () / 1024 << "&#8239;" << tr(/* tr: Kibibit/s */ "K/s"); s << (double) i2p::transport::transports.GetInBandwidth () / 1024 << "&#8239;" << tr(/* tr: Kibibit/s */ "K/s");
s << "</span> <span class=\"hide\">/</span> <span class=\"router sent\">"; s << "</span> <span class=\"hide\">/</span> <span class=\"router sent\">";
// s << (double) i2p::transport::transports.GetOutBandwidth () / 1024 << "&#8239;" << tr(/* tr: Kibibit/s */ "KiB/s");
s << std::fixed << std::setprecision(0); s << std::fixed << std::setprecision(0);
if (i2p::transport::transports.GetOutBandwidth () > 1024*1024*1024 || if (i2p::transport::transports.GetOutBandwidth () > 1024*1024*1024 ||
i2p::transport::transports.GetOutBandwidth () < 1024) i2p::transport::transports.GetOutBandwidth () < 1024)
@ -626,7 +624,20 @@ namespace http {
else if (i2p::transport::transports.GetOutBandwidth () > 1024*1024) else if (i2p::transport::transports.GetOutBandwidth () > 1024*1024)
s << std::fixed << std::setprecision(1); s << std::fixed << std::setprecision(1);
s << (double) i2p::transport::transports.GetOutBandwidth () / 1024 << "&#8239;" << tr(/* tr: Kibibit/s */ "K/s"); s << (double) i2p::transport::transports.GetOutBandwidth () / 1024 << "&#8239;" << tr(/* tr: Kibibit/s */ "K/s");
s << "</span></td></tr>\r\n"; s << "</span>";
if (i2p::context.AcceptsTunnels () && i2p::tunnel::tunnels.CountTransitTunnels()) {
if (i2p::transport::transports.GetTransitBandwidth () > 1024*1024*1024 ||
i2p::transport::transports.GetTransitBandwidth () < 1024)
s << std::fixed << std::setprecision(2);
else if (i2p::transport::transports.GetTransitBandwidth () > 1024*1024)
s << std::fixed << std::setprecision(1);
s << " <span class=\"hide\">/</span> <span class=\"transit sent\">";
s << (double) i2p::transport::transports.GetTransitBandwidth () / 1024;
s << "&#8239;" << tr(/* tr: Kibibit/s */ "K/s") << "</span>";
}
s << "</td></tr>\r\n";
s << "<tr><td>" << tr("Transferred") << "</td><td><span class=\"router recvd\">"; s << "<tr><td>" << tr("Transferred") << "</td><td><span class=\"router recvd\">";
s << std::fixed << std::setprecision(0); s << std::fixed << std::setprecision(0);
if (i2p::transport::transports.GetTotalReceivedBytes () > 1024*1024*1024) if (i2p::transport::transports.GetTotalReceivedBytes () > 1024*1024*1024)
@ -641,7 +652,23 @@ namespace http {
else if (i2p::transport::transports.GetTotalSentBytes () > 1024*1024) else if (i2p::transport::transports.GetTotalSentBytes () > 1024*1024)
s << std::fixed << std::setprecision(1); s << std::fixed << std::setprecision(1);
ShowTraffic (s, i2p::transport::transports.GetTotalSentBytes ()); ShowTraffic (s, i2p::transport::transports.GetTotalSentBytes ());
s << "</span></td></tr>\r\n"; s << "</span>";
if (i2p::context.AcceptsTunnels () && i2p::tunnel::tunnels.CountTransitTunnels()) {
s << " <span class=\"hide\">/</span> <span class=\"transit sent\">";
s << std::fixed << std::setprecision(0);
if (i2p::transport::transports.GetTotalTransitTransmittedBytes () > 1024*1024*1024)
s << std::fixed << std::setprecision(2);
else if (i2p::transport::transports.GetTotalTransitTransmittedBytes () > 1024*1024)
s << std::fixed << std::setprecision(1);
ShowTraffic (s, i2p::transport::transports.GetTotalTransitTransmittedBytes ());
s << std::fixed << std::setprecision(0);
s << "</span>";
}
s << "</td></tr>\r\n";
/*
if (i2p::context.AcceptsTunnels () && i2p::tunnel::tunnels.CountTransitTunnels()) { if (i2p::context.AcceptsTunnels () && i2p::tunnel::tunnels.CountTransitTunnels()) {
s << "<tr><td>" << tr("Transit") << "</td><td><span class=\"transit sent\">"; s << "<tr><td>" << tr("Transit") << "</td><td><span class=\"transit sent\">";
s << std::fixed << std::setprecision(0); s << std::fixed << std::setprecision(0);
@ -657,9 +684,10 @@ namespace http {
else if (i2p::transport::transports.GetTransitBandwidth () > 1024*1024) else if (i2p::transport::transports.GetTransitBandwidth () > 1024*1024)
s << std::fixed << std::setprecision(1); s << std::fixed << std::setprecision(1);
s << " (" << (double) i2p::transport::transports.GetTransitBandwidth () / 1024; s << " (" << (double) i2p::transport::transports.GetTransitBandwidth () / 1024;
// s << "&#8239;" << tr(/* tr: Kibibit/s */ "KiB/s") << ")</span></td></tr>\r\n"; s << "&#8239;" << tr("K/s") << ")</span></td></tr>\r\n";
s << "&#8239;" << tr(/* tr: Kibibit/s */ "K/s") << ")</span></td></tr>\r\n";
} }
*/
s << "<tr><td>" << tr("Build Success") << "</td><td>"; s << "<tr><td>" << tr("Build Success") << "</td><td>";
s << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%</td></tr>\r\n"; s << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%</td></tr>\r\n";
s << "<tr><td>" << tr("Routers") << "</td><td>" << i2p::data::netdb.GetNumRouters () << "</td></tr>\r\n"; s << "<tr><td>" << tr("Routers") << "</td><td>" << i2p::data::netdb.GetNumRouters () << "</td></tr>\r\n";
@ -1355,7 +1383,7 @@ namespace http {
s << "<tr class=\"sectiontitle configuration\"><th colspan=\"2\"><span>" << tr("Transit Tunnels") << "</span></th></tr>"; s << "<tr class=\"sectiontitle configuration\"><th colspan=\"2\"><span>" << tr("Transit Tunnels") << "</span></th></tr>";
s << "<tr><td class=\"center nopadding\" colspan=\"2\">\r\n"; s << "<tr><td class=\"center nopadding\" colspan=\"2\">\r\n";
s << "<div "; s << "<div ";
if (count > 8) if (count > 7)
s << "id=\"transit\" "; s << "id=\"transit\" ";
s << "class=\"list\">\r\n"; s << "class=\"list\">\r\n";
for (const auto& it: i2p::tunnel::tunnels.GetTransitTunnels ()) for (const auto& it: i2p::tunnel::tunnels.GetTransitTunnels ())

View file

@ -16,6 +16,7 @@
--arrow_left: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M4.5 32l30-30v20.2h25v19.6h-25V62z'/%3E%3C/svg%3E"); --arrow_left: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M4.5 32l30-30v20.2h25v19.6h-25V62z'/%3E%3C/svg%3E");
--arrow_right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M59.5 32l-30-30v20.2h-25v19.6h25V62z'/%3E%3C/svg%3E"); --arrow_right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M59.5 32l-30-30v20.2h-25v19.6h25V62z'/%3E%3C/svg%3E");
--arrow_up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M32 4.5l-30 30h20.2v25h19.6v-25H62z'/%3E%3C/svg%3E"); --arrow_up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M32 4.5l-30 30h20.2v25h19.6v-25H62z'/%3E%3C/svg%3E");
--arrow_up_transit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%237f7' viewBox='0 0 64 64'%3E%3Cpath d='M32 4.5l-30 30h20.2v25h19.6v-25H62z'/%3E%3C/svg%3E");
--arrow_down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M32 59.5l-30-30h20.2v-25h19.6v25H62z'/%3E%3C/svg%3E"); --arrow_down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M32 59.5l-30-30h20.2v-25h19.6v25H62z'/%3E%3C/svg%3E");
--arrow_double: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M2.4 32l20.9-20.9v14h6.3v13.7h-6.3v14zM61.6 32L40.7 11.1v14h-6.3v13.7h6.3v14z'/%3E%3C/svg%3E"); --arrow_double: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dbd' viewBox='0 0 64 64'%3E%3Cpath d='M2.4 32l20.9-20.9v14h6.3v13.7h-6.3v14zM61.6 32L40.7 11.1v14h-6.3v13.7h6.3v14z'/%3E%3C/svg%3E");
--error: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg stroke-linejoin='round'%3E%3Cpath fill='none' stroke='%23300' stroke-width='10' d='M58 54.6H6l26-45z'/%3E%3Cpath fill='%23fff' stroke='%23b00' stroke-width='3' d='M58 54.6H6l26-45z'/%3E%3C/g%3E%3Cpath d='M29.5 24.5h5v14.7h-5zm0 18.6h5v5.6h-5z'/%3E%3C/svg%3E"); --error: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg stroke-linejoin='round'%3E%3Cpath fill='none' stroke='%23300' stroke-width='10' d='M58 54.6H6l26-45z'/%3E%3Cpath fill='%23fff' stroke='%23b00' stroke-width='3' d='M58 54.6H6l26-45z'/%3E%3C/g%3E%3Cpath d='M29.5 24.5h5v14.7h-5zm0 18.6h5v5.6h-5z'/%3E%3C/svg%3E");
@ -995,6 +996,10 @@ a:hover .host, a:focus .host, a:active .host {
background: var(--arrow_up) no-repeat right center / 12px; background: var(--arrow_up) no-repeat right center / 12px;
} }
.transit.sent {
background: var(--arrow_up_transit) no-repeat right center / 12px;
}
.recvd { .recvd {
background: var(--arrow_down) no-repeat right center / 12px; background: var(--arrow_down) no-repeat right center / 12px;
} }