mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-26 08:01:06 +00:00
Update events tables renderer
This commit is contained in:
parent
c14c437152
commit
c4b63ada55
@ -512,14 +512,15 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
|
|||||||
def download_results(self):
|
def download_results(self):
|
||||||
return defer.maybeDeferred(self.download_status.get_results)
|
return defer.maybeDeferred(self.download_status.get_results)
|
||||||
|
|
||||||
def relative_time(self, t):
|
def _relative_time(self, t):
|
||||||
if t is None:
|
if t is None:
|
||||||
return t
|
return t
|
||||||
if self.download_status.first_timestamp is not None:
|
if self._download_status.first_timestamp is not None:
|
||||||
return t - self.download_status.first_timestamp
|
return t - self._download_status.first_timestamp
|
||||||
return t
|
return t
|
||||||
def short_relative_time(self, t):
|
|
||||||
t = self.relative_time(t)
|
def _short_relative_time(self, t):
|
||||||
|
t = self._relative_time(t)
|
||||||
if t is None:
|
if t is None:
|
||||||
return ""
|
return ""
|
||||||
return "+%.6fs" % t
|
return "+%.6fs" % t
|
||||||
@ -532,19 +533,27 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
|
|||||||
time_s = self.render_time(None, seconds)
|
time_s = self.render_time(None, seconds)
|
||||||
if seconds != 0:
|
if seconds != 0:
|
||||||
rate = self.render_rate(None, 1.0 * bytes / seconds)
|
rate = self.render_rate(None, 1.0 * bytes / seconds)
|
||||||
return T.span(title=rate)[time_s]
|
return tags.span(time_s, title=rate)
|
||||||
return T.span[time_s]
|
return tags.span(time_s)
|
||||||
|
|
||||||
def render_events(self, ctx, data):
|
@renderer
|
||||||
if not self.download_status.storage_index:
|
def events(self, req, tag):
|
||||||
|
if not self._download_status.storage_index:
|
||||||
return
|
return
|
||||||
srt = self.short_relative_time
|
|
||||||
l = T.div()
|
|
||||||
|
|
||||||
t = T.table(align="left", class_="status-download-events")
|
srt = self._short_relative_time
|
||||||
t[T.tr[T.th["serverid"], T.th["sent"], T.th["received"],
|
|
||||||
T.th["shnums"], T.th["RTT"]]]
|
l = tags.div()
|
||||||
for d_ev in self.download_status.dyhb_requests:
|
|
||||||
|
t = tags.table(align="left", class_="status-download-events")
|
||||||
|
|
||||||
|
t(tags.tr(tags.th("serverid"),
|
||||||
|
tags.th("sent"),
|
||||||
|
tags.th("received"),
|
||||||
|
tags.th("shnums"),
|
||||||
|
tags.th("RTT")))
|
||||||
|
|
||||||
|
for d_ev in self._download_status.dyhb_requests:
|
||||||
server = d_ev["server"]
|
server = d_ev["server"]
|
||||||
sent = d_ev["start_time"]
|
sent = d_ev["start_time"]
|
||||||
shnums = d_ev["response_shnums"]
|
shnums = d_ev["response_shnums"]
|
||||||
@ -554,20 +563,31 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
|
|||||||
rtt = received - sent
|
rtt = received - sent
|
||||||
if not shnums:
|
if not shnums:
|
||||||
shnums = ["-"]
|
shnums = ["-"]
|
||||||
t[T.tr(style="background: %s" % _color(server))[
|
|
||||||
[T.td[server.get_name()], T.td[srt(sent)], T.td[srt(received)],
|
|
||||||
T.td[",".join([str(shnum) for shnum in shnums])],
|
|
||||||
T.td[self.render_time(None, rtt)],
|
|
||||||
]]]
|
|
||||||
|
|
||||||
l[T.h2["DYHB Requests:"], t]
|
t(tags.tr(style="background: %s" % _color(server))(
|
||||||
l[T.br(clear="all")]
|
(tags.td(server.get_name()),
|
||||||
|
tags.td(srt(sent)),
|
||||||
|
tags.td(srt(received)),
|
||||||
|
tags.td(",".join([str(shnum) for shnum in shnums])),
|
||||||
|
tags.td(self.render_time(None, rtt)),
|
||||||
|
)))
|
||||||
|
|
||||||
t = T.table(align="left",class_="status-download-events")
|
l(tags.h2("DYHB Requests:"), t)
|
||||||
t[T.tr[T.th["range"], T.th["start"], T.th["finish"], T.th["got"],
|
l(tags.br(clear="all"))
|
||||||
T.th["time"], T.th["decrypttime"], T.th["pausedtime"],
|
|
||||||
T.th["speed"]]]
|
t = tags.table(align="left",class_="status-download-events")
|
||||||
for r_ev in self.download_status.read_events:
|
|
||||||
|
t(tags.tr((
|
||||||
|
tags.th("range"),
|
||||||
|
tags.th("start"),
|
||||||
|
tags.th("finish"),
|
||||||
|
tags.th("got"),
|
||||||
|
tags.th("time"),
|
||||||
|
tags.th("decrypttime"),
|
||||||
|
tags.th("pausedtime"),
|
||||||
|
tags.th("speed"))))
|
||||||
|
|
||||||
|
for r_ev in self._download_status.read_events:
|
||||||
start = r_ev["start"]
|
start = r_ev["start"]
|
||||||
length = r_ev["length"]
|
length = r_ev["length"]
|
||||||
bytes = r_ev["bytes_returned"]
|
bytes = r_ev["bytes_returned"]
|
||||||
@ -581,21 +601,33 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
|
|||||||
rtt = self.render_time(None, rtt)
|
rtt = self.render_time(None, rtt)
|
||||||
paused = self.render_time(None, r_ev["paused_time"])
|
paused = self.render_time(None, r_ev["paused_time"])
|
||||||
|
|
||||||
t[T.tr[T.td["[%d:+%d]" % (start, length)],
|
t(tags.tr(
|
||||||
T.td[srt(r_ev["start_time"])], T.td[srt(r_ev["finish_time"])],
|
tags.td("[%d:+%d]" % (start, length)),
|
||||||
T.td[bytes], T.td[rtt],
|
tags.td(srt(r_ev["start_time"])),
|
||||||
T.td[decrypt_time], T.td[paused],
|
tags.td(srt(r_ev["finish_time"])),
|
||||||
T.td[speed],
|
tags.td(str(bytes)),
|
||||||
]]
|
tags.td(rtt),
|
||||||
|
tags.td(decrypt_time),
|
||||||
|
tags.td(paused),
|
||||||
|
tags.td(speed),
|
||||||
|
))
|
||||||
|
|
||||||
l[T.h2["Read Events:"], t]
|
l(tags.h2("Read Events:"), t)
|
||||||
l[T.br(clear="all")]
|
l(tags.br(clear="all"))
|
||||||
|
|
||||||
t = T.table(align="left",class_="status-download-events")
|
t = tags.table(align="left",class_="status-download-events")
|
||||||
t[T.tr[T.th["segnum"], T.th["start"], T.th["active"], T.th["finish"],
|
|
||||||
T.th["range"],
|
t(tags.tr(
|
||||||
T.th["decodetime"], T.th["segtime"], T.th["speed"]]]
|
tags.th("segnum"),
|
||||||
for s_ev in self.download_status.segment_events:
|
tags.th("start"),
|
||||||
|
tags.th("active"),
|
||||||
|
tags.th("finish"),
|
||||||
|
tags.th("range"),
|
||||||
|
tags.th("decodetime"),
|
||||||
|
tags.th("segtime"),
|
||||||
|
tags.th("speed")))
|
||||||
|
|
||||||
|
for s_ev in self._download_status.segment_events:
|
||||||
range_s = "-"
|
range_s = "-"
|
||||||
segtime_s = "-"
|
segtime_s = "-"
|
||||||
speed = "-"
|
speed = "-"
|
||||||
@ -615,36 +647,50 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
|
|||||||
# not finished yet
|
# not finished yet
|
||||||
pass
|
pass
|
||||||
|
|
||||||
t[T.tr[T.td["seg%d" % s_ev["segment_number"]],
|
t(tags.tr(
|
||||||
T.td[srt(s_ev["start_time"])],
|
tags.td("seg%d" % s_ev["segment_number"]),
|
||||||
T.td[srt(s_ev["active_time"])],
|
tags.td(srt(s_ev["start_time"])),
|
||||||
T.td[srt(s_ev["finish_time"])],
|
tags.td(srt(s_ev["active_time"])),
|
||||||
T.td[range_s],
|
tags.td(srt(s_ev["finish_time"])),
|
||||||
T.td[decode_time],
|
tags.td(range_s),
|
||||||
T.td[segtime_s], T.td[speed]]]
|
tags.td(decode_time),
|
||||||
|
tags.td(segtime_s),
|
||||||
|
tags.td(speed)))
|
||||||
|
|
||||||
l[T.h2["Segment Events:"], t]
|
l(tags.h2("Segment Events:"), t)
|
||||||
l[T.br(clear="all")]
|
|
||||||
t = T.table(align="left",class_="status-download-events")
|
l(tags.br(clear="all"))
|
||||||
t[T.tr[T.th["serverid"], T.th["shnum"], T.th["range"],
|
|
||||||
T.th["txtime"], T.th["rxtime"],
|
t = tags.table(align="left",class_="status-download-events")
|
||||||
T.th["received"], T.th["RTT"]]]
|
|
||||||
for r_ev in self.download_status.block_requests:
|
t(tags.tr(
|
||||||
|
tags.th("serverid"),
|
||||||
|
tags.th("shnum"),
|
||||||
|
tags.th("range"),
|
||||||
|
tags.th("txtime"),
|
||||||
|
tags.th("rxtime"),
|
||||||
|
tags.th("received"),
|
||||||
|
tags.th("RTT")))
|
||||||
|
|
||||||
|
for r_ev in self._download_status.block_requests:
|
||||||
server = r_ev["server"]
|
server = r_ev["server"]
|
||||||
rtt = None
|
rtt = None
|
||||||
if r_ev["finish_time"] is not None:
|
if r_ev["finish_time"] is not None:
|
||||||
rtt = r_ev["finish_time"] - r_ev["start_time"]
|
rtt = r_ev["finish_time"] - r_ev["start_time"]
|
||||||
color = _color(server)
|
color = _color(server)
|
||||||
t[T.tr(style="background: %s" % color)[
|
t(tags.tr(style="background: %s" % color)
|
||||||
T.td[server.get_name()], T.td[r_ev["shnum"]],
|
(
|
||||||
T.td["[%d:+%d]" % (r_ev["start"], r_ev["length"])],
|
tags.td(server.get_name()),
|
||||||
T.td[srt(r_ev["start_time"])], T.td[srt(r_ev["finish_time"])],
|
tags.td(str(r_ev["shnum"])),
|
||||||
T.td[r_ev["response_length"] or ""],
|
tags.td("[%d:+%d]" % (r_ev["start"], r_ev["length"])),
|
||||||
T.td[self.render_time(None, rtt)],
|
tags.td(srt(r_ev["start_time"])),
|
||||||
]]
|
tags.td(srt(r_ev["finish_time"])),
|
||||||
|
tags.td(str(r_ev["response_length"]) or ""),
|
||||||
|
tags.td(self.render_time(None, rtt)),
|
||||||
|
))
|
||||||
|
|
||||||
l[T.h2["Requests:"], t]
|
l(tags.h2("Requests:"), t)
|
||||||
l[T.br(clear="all")]
|
l(tags.br(clear="all"))
|
||||||
|
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user