[#7] Refactor job report page to include all errors

This commit is contained in:
amercader 2013-03-06 13:43:40 +00:00
parent bec31a611e
commit ef2defbcf9
2 changed files with 94 additions and 54 deletions

View File

@ -0,0 +1,32 @@
{#
Displays a table with a summary of the most common errors for a job
error_summary - List of tuples with (message, count)
Example:
{% snippet 'snippets/job_error_summary.html', summary=c.job.object_error_summary %}
#}
<table class="table table-striped table-bordered table-condensed harvest-error-summary">
<colgroup>
<col width="8">
<col width="92">
</colgroup>
<thead>
<tr>
<th class="count">{{ _('Count') }}</th>
<th>{{ _('Message') }}</th>
</tr>
</thead>
<tbody>
{% for error in summary %}
<tr>
<td class="count">{{ error[1] }}</td>
<td>{{ error[0] }}</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -14,7 +14,7 @@
{% if c.job.status == 'Finished' %}
{% if c.job.error_summary|length == 0 %}
{% if c.job.object_error_summary|length == 0 and c.job.gather_error_summary|length == 0 %}
<h2>{{ _('Error Summary') }}</h2>
<p class="empty">{{ _('No errors for this job') }}</p>
{% else %}
@ -22,42 +22,50 @@
{{ _('Error Summary') }}
<small>{{ _('Only the 20 most frequent errors are shown') }}</small>
</h2>
<table class="table table-striped table-bordered table-condensed harvest-error-summary">
<colgroup>
<col width="8">
<col width="92">
</colgroup>
<thead>
<tr>
<th class="count">{{ _('Count') }}</th>
<th>{{ _('Message') }}</th>
</tr>
</thead>
{% if c.job.gather_error_summary|length > 0 %}
<h3>{{ _('Job Errors') }}</h3>
{% snippet 'snippets/job_error_summary.html', summary=c.job.gather_error_summary %}
{% endif %}
{% if c.job.object_error_summary|length > 0 %}
<h3>{{ _('Document Errors') }}</h3>
{% snippet 'snippets/job_error_summary.html', summary=c.job.object_error_summary %}
{% endif %}
{% endif %}
{% if c.job_report.gather_errors|length > 0 or c.job_report.object_errors.keys()|length > 0 %}
<h2>
{{ _('Error Report') }}
</h2>
{% if c.job_report.gather_errors|length > 0 %}
<h3>{{ _('Job Errors') }}</h3>
<table class="table table-bordered table-hover harvest-error-list">
<tbody>
{% for error in c.job.error_summary %}
{% for error in c.job_report.gather_errors %}
<tr>
<td class="count">{{ error[1] }}</td>
<td>{{ error[0] }}</td>
<td>
<div class="error">
{{ error.message }}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% if c.job.error_summary|length %}
<h2>
{{ _('Error Report') }}
<small>{{ c.job_report.keys()|length}} {{ _('documents with errors') }}</small>
</h2>
{% if c.job_report.object_errors.keys()|length > 0 %}
<h3>{{ _('Document Errors') }}
<small>{{ c.job_report.object_errors.keys()|length}} {{ _('documents with errors') }}</small>
</h3>
<table class="table table-bordered table-hover harvest-error-list">
<tbody>
{% for harvest_object_id in c.job_report.keys() %}
{% for harvest_object_id in c.job_report.object_errors.keys() %}
{% set object = c.job_report.object_errors[harvest_object_id] %}
<tr>
<td>
<span class="btn-group pull-right">
{% if 'original_url' in c.job_report[harvest_object_id] %}
<a href="{{ c.job_report[harvest_object_id].original_url }}" class="btn btn-small">
{% if 'original_url' in object%}
<a href="{{ object.original_url }}" class="btn btn-small">
{{ _('Remote content') }}
</a>
{% endif %}
@ -66,8 +74,8 @@
</a>
</span>
<h5>{{ c.job_report[harvest_object_id].guid }}</h5>
{% for error in c.job_report[harvest_object_id].errors %}
<h5>{{ object.guid }}</h5>
{% for error in object.errors %}
<div class="error">
{{ error.message }}
{% if error.line %}
@ -83,5 +91,5 @@
{% endif %}
{% endif %}
{% endif %}
{% endblock %}