mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-21 03:55:27 +00:00
Wrap renderer results in tags
This commit is contained in:
parent
8c92187d92
commit
3e7dea7dda
@ -38,11 +38,11 @@ class StorageStatusElement(Element):
|
|||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def nickname(self, req, tag):
|
def nickname(self, req, tag):
|
||||||
return self._nickname
|
return tag(self._nickname)
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def nodeid(self, req, tag):
|
def nodeid(self, req, tag):
|
||||||
return idlib.nodeid_b2a(self._storage.my_nodeid)
|
return tag(idlib.nodeid_b2a(self._storage.my_nodeid))
|
||||||
|
|
||||||
def _get_storage_stat(self, key):
|
def _get_storage_stat(self, key):
|
||||||
"""Get storage server statistics.
|
"""Get storage server statistics.
|
||||||
@ -110,20 +110,20 @@ class StorageStatusElement(Element):
|
|||||||
@renderer
|
@renderer
|
||||||
def accepting_immutable_shares(self, req, tag):
|
def accepting_immutable_shares(self, req, tag):
|
||||||
accepting = self._get_storage_stat("storage_server.accepting_immutable_shares")
|
accepting = self._get_storage_stat("storage_server.accepting_immutable_shares")
|
||||||
return {True: "Yes", False: "No"}[bool(accepting)]
|
return tag({True: "Yes", False: "No"}[bool(accepting)])
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def last_complete_bucket_count(self, req, tag):
|
def last_complete_bucket_count(self, req, tag):
|
||||||
s = self._storage.bucket_counter.get_state()
|
s = self._storage.bucket_counter.get_state()
|
||||||
count = s.get("last-complete-bucket-count")
|
count = s.get("last-complete-bucket-count")
|
||||||
if count is None:
|
if count is None:
|
||||||
return "Not computed yet"
|
return tag("Not computed yet")
|
||||||
return str(count)
|
return tag(str(count))
|
||||||
|
|
||||||
@renderer
|
@renderer
|
||||||
def count_crawler_status(self, req, tag):
|
def count_crawler_status(self, req, tag):
|
||||||
p = self._storage.bucket_counter.get_progress()
|
p = self._storage.bucket_counter.get_progress()
|
||||||
return self.format_crawler_progress(p)
|
return tag(self.format_crawler_progress(p))
|
||||||
|
|
||||||
def format_crawler_progress(self, p):
|
def format_crawler_progress(self, p):
|
||||||
cycletime = p["estimated-time-per-cycle"]
|
cycletime = p["estimated-time-per-cycle"]
|
||||||
|
Loading…
Reference in New Issue
Block a user