Use SlotsSequenceElement to render corrupt shares

This commit is contained in:
Sajith Sasidharan 2020-06-15 13:59:22 -04:00
parent 46cb3b6bc3
commit 4e594b09bf
2 changed files with 15 additions and 15 deletions

View File

@ -560,22 +560,22 @@ class DeepCheckResultsRendererElement(Element, ResultsBase, ReloadMixin):
return tag
return ""
# TODO: Probably should use SlotsSequenceElement to render this.
@renderer
def corrupt_shares(self, req, tag):
return self.monitor.get_status().get_corrupt_shares()
shares = self.monitor.get_status().get_corrupt_shares()
problems = []
@renderer
def share_problem(self, req, tag):
# def render_share_problem(self, req, tag):
server, storage_index, sharenum = data
nickname = server.get_nickname()
tag.fillSlots("serverid", server.get_name())
if nickname:
tag.fillSlots("nickname", self._html(nickname))
tag.fillSlots("si", self._render_si_link(ctx, storage_index))
tag.fillSlots("shnum", str(sharenum))
return tag
for share in shares:
server, storage_index, sharenum = share
problem = {
"serverid": server.get_name(),
"nickname": self._html(nickname),
"si": self._render_si_link(req, storage_index),
"shnum": str(sharenum),
}
problems.append(problem)
return SlotsSequenceElement(tag, problems)
@renderer
def return_to(self, req, tag):

View File

@ -43,13 +43,13 @@
<h2>Corrupt Shares</h2>
<p>If repair fails, these shares need to be manually inspected and removed.</p>
<table t:render="corrupt_shares">
<tr t:pattern="header">
<tr t:render="header">
<td>Server</td>
<td>Server Nickname</td>
<td>Storage Index</td>
<td>Share Number</td>
</tr>
<tr t:pattern="item" t:render="share_problem">
<tr t:render="item">
<td><t:slot name="serverid"/></td>
<td><t:slot name="nickname"/></td>
<td><t:slot name="si"/></td>