From 75100c335f394399de3794a61d51252945e5d088 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Mon, 27 Feb 2017 00:00:27 +0100 Subject: [PATCH] Small cosmetical changes on stats page --- plugins/Stats/StatsPlugin.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/plugins/Stats/StatsPlugin.py b/plugins/Stats/StatsPlugin.py index 4b815e6f..333630b2 100644 --- a/plugins/Stats/StatsPlugin.py +++ b/plugins/Stats/StatsPlugin.py @@ -9,7 +9,7 @@ from Config import config @PluginManager.registerTo("UiRequest") class UiRequestPlugin(object): - def formatTableRow(self, row): + def formatTableRow(self, row, class_name=""): back = [] for format, val in row: if val is None: @@ -22,7 +22,7 @@ class UiRequestPlugin(object): else: formatted = format % val back.append("%s" % formatted) - return "%s" % "".join(back) + return "%s" % (class_name, "".join(back)) def getObjSize(self, obj, hpy=None): if hpy: @@ -59,7 +59,8 @@ class UiRequestPlugin(object): """ @@ -91,9 +92,9 @@ class UiRequestPlugin(object): yield "Connections (%s, total made: %s):
" % ( len(main.file_server.connections), main.file_server.last_connection_id ) - yield "" + yield "
id proto type ip open crypt ping
" yield "" - yield "" + yield "" for connection in main.file_server.connections: if "cipher" in dir(connection.sock): cipher = connection.sock.cipher()[0] @@ -101,7 +102,6 @@ class UiRequestPlugin(object): cipher = connection.crypt yield self.formatTableRow([ ("%3d", connection.id), - ("%s", connection.protocol), ("%s", connection.type), ("%s:%s", (connection.ip, connection.port)), ("%s", connection.handshake.get("port_opened")), @@ -112,7 +112,7 @@ class UiRequestPlugin(object): ("since", max(connection.last_send_time, connection.last_recv_time)), ("since", connection.start_time), ("%.3f", connection.last_sent_time - connection.last_send_time), - ("%.3fs", connection.cpu_time), + ("%.3f", connection.cpu_time), ("%.0fkB", connection.bytes_sent / 1024), ("%.0fkB", connection.bytes_recv / 1024), ("%s", connection.last_cmd), @@ -139,8 +139,8 @@ class UiRequestPlugin(object): for site in sorted(self.server.sites.values(), lambda a, b: cmp(a.address,b.address)): yield self.formatTableRow([ ( - """%s""", - (site.settings["serving"], site.address, site.address) + """%s""", + (site.address, site.address) ), ("%s", [peer.connection.id for peer in site.peers.values() if peer.connection and peer.connection.connected]), ("%s/%s/%s", ( @@ -154,7 +154,7 @@ class UiRequestPlugin(object): )), ("%.0fkB", site.settings.get("bytes_sent", 0) / 1024), ("%.0fkB", site.settings.get("bytes_recv", 0) / 1024), - ]) + ], "serving-%s" % site.settings["serving"]) yield "" yield "
id type ip open crypt pingbuff bad idle open delay cpu out in last sentwaiting version sites
wait version sites
"