mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-22 19:55:16 +00:00
web: status: add 'started' timestamps to all operations
This commit is contained in:
parent
cedc653aa5
commit
ca1a1762e2
@ -364,7 +364,10 @@ class DownloadStatus:
|
||||
self.active = True
|
||||
self.results = None
|
||||
self.counter = self.statusid_counter.next()
|
||||
self.started = time.time()
|
||||
|
||||
def get_started(self):
|
||||
return self.started
|
||||
def get_storage_index(self):
|
||||
return self.storage_index
|
||||
def get_size(self):
|
||||
|
@ -1453,6 +1453,9 @@ class IClientStatus(Interface):
|
||||
started downloads."""
|
||||
|
||||
class IUploadStatus(Interface):
|
||||
def get_started():
|
||||
"""Return a timestamp (float with seconds since epoch) indicating
|
||||
when the operation was started."""
|
||||
def get_storage_index():
|
||||
"""Return a string with the (binary) storage index in use on this
|
||||
upload. Returns None if the storage index has not yet been
|
||||
@ -1489,6 +1492,9 @@ class IUploadStatus(Interface):
|
||||
page can generate a suitable hyperlink."""
|
||||
|
||||
class IDownloadStatus(Interface):
|
||||
def get_started():
|
||||
"""Return a timestamp (float with seconds since epoch) indicating
|
||||
when the operation was started."""
|
||||
def get_storage_index():
|
||||
"""Return a string with the (binary) storage index in use on this
|
||||
download. This may be None if there is no storage index (i.e. LIT
|
||||
|
@ -211,7 +211,10 @@ class RetrieveStatus:
|
||||
self.status = "Not started"
|
||||
self.progress = 0.0
|
||||
self.counter = self.statusid_counter.next()
|
||||
self.started = time.time()
|
||||
|
||||
def get_started(self):
|
||||
return self.started
|
||||
def get_storage_index(self):
|
||||
return self.storage_index
|
||||
def using_helper(self):
|
||||
@ -783,7 +786,10 @@ class PublishStatus:
|
||||
self.status = "Not started"
|
||||
self.progress = 0.0
|
||||
self.counter = self.statusid_counter.next()
|
||||
self.started = time.time()
|
||||
|
||||
def get_started(self):
|
||||
return self.started
|
||||
def get_storage_index(self):
|
||||
return self.storage_index
|
||||
def using_helper(self):
|
||||
|
@ -575,7 +575,10 @@ class UploadStatus:
|
||||
self.active = True
|
||||
self.results = None
|
||||
self.counter = self.statusid_counter.next()
|
||||
self.started = time.time()
|
||||
|
||||
def get_started(self):
|
||||
return self.started
|
||||
def get_storage_index(self):
|
||||
return self.storage_index
|
||||
def get_size(self):
|
||||
|
@ -11,6 +11,7 @@
|
||||
<h1>File Download Status</h1>
|
||||
|
||||
<ul>
|
||||
<li>Started: <span n:render="started"/></li>
|
||||
<li>Storage Index: <span n:render="si"/></li>
|
||||
<li>Helper?: <span n:render="helper"/></li>
|
||||
<li>Total Size: <span n:render="total_size"/></li>
|
||||
|
@ -11,6 +11,7 @@
|
||||
<h1>Mutable File Publish Status</h1>
|
||||
|
||||
<ul>
|
||||
<li>Started: <span n:render="started"/></li>
|
||||
<li>Storage Index: <span n:render="si"/></li>
|
||||
<li>Helper?: <span n:render="helper"/></li>
|
||||
<li>Current Size: <span n:render="current_size"/></li>
|
||||
|
@ -11,6 +11,7 @@
|
||||
<h1>Mutable File Retrieve Status</h1>
|
||||
|
||||
<ul>
|
||||
<li>Started: <span n:render="started"/></li>
|
||||
<li>Storage Index: <span n:render="si"/></li>
|
||||
<li>Helper?: <span n:render="helper"/></li>
|
||||
<li>Current Size: <span n:render="current_size"/></li>
|
||||
|
@ -36,6 +36,7 @@
|
||||
<h2>Recent Operations:</h2>
|
||||
<table n:render="sequence" n:data="recent_operations" border="1">
|
||||
<tr n:pattern="header">
|
||||
<td>Started</td>
|
||||
<td>Type</td>
|
||||
<td>Storage Index</td>
|
||||
<td>Helper?</td>
|
||||
@ -44,6 +45,7 @@
|
||||
<td>Status</td>
|
||||
</tr>
|
||||
<tr n:pattern="item" n:render="row">
|
||||
<td><n:slot name="started"/></td>
|
||||
<td><n:slot name="type"/></td>
|
||||
<td><n:slot name="si"/></td>
|
||||
<td><n:slot name="helper"/></td>
|
||||
|
@ -11,6 +11,7 @@
|
||||
<h1>File Upload Status</h1>
|
||||
|
||||
<ul>
|
||||
<li>Started: <span n:render="started"/></li>
|
||||
<li>Storage Index: <span n:render="si"/></li>
|
||||
<li>Helper?: <span n:render="helper"/></li>
|
||||
<li>Total Size: <span n:render="total_size"/></li>
|
||||
|
@ -1638,6 +1638,12 @@ class UploadStatusPage(UploadResultsRendererMixin, rend.Page):
|
||||
d.addCallback(_got_results)
|
||||
return d
|
||||
|
||||
def render_started(self, ctx, data):
|
||||
TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
|
||||
started_s = time.strftime(TIME_FORMAT,
|
||||
time.localtime(data.get_started()))
|
||||
return started_s
|
||||
|
||||
def render_si(self, ctx, data):
|
||||
si_s = base32.b2a_or_none(data.get_storage_index())
|
||||
if si_s is None:
|
||||
@ -1841,6 +1847,12 @@ class DownloadStatusPage(DownloadResultsRendererMixin, rend.Page):
|
||||
d.addCallback(_got_results)
|
||||
return d
|
||||
|
||||
def render_started(self, ctx, data):
|
||||
TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
|
||||
started_s = time.strftime(TIME_FORMAT,
|
||||
time.localtime(data.get_started()))
|
||||
return started_s
|
||||
|
||||
def render_si(self, ctx, data):
|
||||
si_s = base32.b2a_or_none(data.get_storage_index())
|
||||
if si_s is None:
|
||||
@ -1868,6 +1880,12 @@ class DownloadStatusPage(DownloadResultsRendererMixin, rend.Page):
|
||||
class RetrieveStatusPage(rend.Page):
|
||||
docFactory = getxmlfile("retrieve-status.xhtml")
|
||||
|
||||
def render_started(self, ctx, data):
|
||||
TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
|
||||
started_s = time.strftime(TIME_FORMAT,
|
||||
time.localtime(data.get_started()))
|
||||
return started_s
|
||||
|
||||
def render_si(self, ctx, data):
|
||||
si_s = base32.b2a_or_none(data.get_storage_index())
|
||||
if si_s is None:
|
||||
@ -1895,6 +1913,12 @@ class RetrieveStatusPage(rend.Page):
|
||||
class PublishStatusPage(rend.Page):
|
||||
docFactory = getxmlfile("publish-status.xhtml")
|
||||
|
||||
def render_started(self, ctx, data):
|
||||
TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
|
||||
started_s = time.strftime(TIME_FORMAT,
|
||||
time.localtime(data.get_started()))
|
||||
return started_s
|
||||
|
||||
def render_si(self, ctx, data):
|
||||
si_s = base32.b2a_or_none(data.get_storage_index())
|
||||
if si_s is None:
|
||||
@ -1936,10 +1960,18 @@ class Status(rend.Page):
|
||||
IClient(ctx).list_recent_publish() +
|
||||
IClient(ctx).list_recent_retrieve())
|
||||
if not o.get_active()]
|
||||
recent.sort(lambda a,b: cmp(a.get_started(), b.get_started()))
|
||||
recent.reverse()
|
||||
return recent
|
||||
|
||||
def render_row(self, ctx, data):
|
||||
s = data
|
||||
|
||||
TIME_FORMAT = "%H:%M:%S %d-%b-%Y"
|
||||
started_s = time.strftime(TIME_FORMAT,
|
||||
time.localtime(s.get_started()))
|
||||
ctx.fillSlots("started", started_s)
|
||||
|
||||
si_s = base32.b2a_or_none(s.get_storage_index())
|
||||
if si_s is None:
|
||||
si_s = "(None)"
|
||||
|
Loading…
x
Reference in New Issue
Block a user