Use SlotsSequenceElement to render pre-repair problems

This commit is contained in:
Sajith Sasidharan 2020-06-12 17:30:39 -04:00
parent c7aa789a22
commit f168dcd19c
2 changed files with 7 additions and 10 deletions

View File

@ -754,23 +754,20 @@ class DeepCheckAndRepairResultsRendererElement(Element, ResultsBase, ReloadMixin
return tag return tag
return "" return ""
# TODO: use SlotsSequenceElement
@renderer @renderer
def pre_repair_problems(self, req, tag): def pre_repair_problems(self, req, tag):
all_objects = self.monitor.get_status().get_all_results() all_objects = self.monitor.get_status().get_all_results()
problems = []
for path in sorted(all_objects.keys()): for path in sorted(all_objects.keys()):
r = all_objects[path] r = all_objects[path]
assert ICheckAndRepairResults.providedBy(r) assert ICheckAndRepairResults.providedBy(r)
cr = r.get_pre_repair_results() cr = r.get_pre_repair_results()
if not cr.is_healthy(): if not cr.is_healthy():
yield path, cr problem = self._join_pathstring(path), ": ", self._html(cr.get_summary())
problems.append(problem)
@renderer return SlotsSequenceElement(tag, problems)
def problem(self, req, tag):
# TODO: figure this out
# path, cr = data
return tag(self._join_pathstring(path), ": ",
self._html(cr.get_summary()))
@renderer @renderer
def post_repair_problems_p(self, req, tag): def post_repair_problems_p(self, req, tag):

View File

@ -35,8 +35,8 @@
<h2>Files/Directories That Had Problems:</h2> <h2>Files/Directories That Had Problems:</h2>
<ul t:render="pre_repair_problems"> <ul t:render="pre_repair_problems">
<li t:pattern="item" t:render="problem"/> <li t:render="item"/>
<li t:pattern="empty">None</li> <li t:render="empty">None</li>
</ul> </ul>
</div> </div>