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 tag
return "" return ""
# TODO: Probably should use SlotsSequenceElement to render this.
@renderer @renderer
def corrupt_shares(self, req, tag): def corrupt_shares(self, req, tag):
return self.monitor.get_status().get_corrupt_shares() shares = self.monitor.get_status().get_corrupt_shares()
problems = []
@renderer for share in shares:
def share_problem(self, req, tag): server, storage_index, sharenum = share
# def render_share_problem(self, req, tag): problem = {
server, storage_index, sharenum = data "serverid": server.get_name(),
nickname = server.get_nickname() "nickname": self._html(nickname),
tag.fillSlots("serverid", server.get_name()) "si": self._render_si_link(req, storage_index),
if nickname: "shnum": str(sharenum),
tag.fillSlots("nickname", self._html(nickname)) }
tag.fillSlots("si", self._render_si_link(ctx, storage_index)) problems.append(problem)
tag.fillSlots("shnum", str(sharenum))
return tag return SlotsSequenceElement(tag, problems)
@renderer @renderer
def return_to(self, req, tag): def return_to(self, req, tag):

View File

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