Split the JSON responses into one key per section

Previously, the AJAX update for the dashboard was returning a big blob
of JSON with one key.

This commit splits it up to return:

- one key for each section of the page
- each containing a smaller chunk of HTML rendered from a partial

The jobs page was already working this way (pretty much) but just needed
a little tweaking to get it the same.
This commit is contained in:
Chris Hill-Scott
2016-06-28 09:07:04 +01:00
parent fe1d63675d
commit c761d57d1d
9 changed files with 135 additions and 131 deletions

View File

@@ -1,16 +1,5 @@
{% from "components/pill.html" import pill %}
<div
{% if not finished %}
data-module="update-content"
data-resource="{{url_for(".view_job_updates", service_id=current_service.id, job_id=job.id, status=status, help=request.args.get('help', 0))}}"
data-key="counts"
aria-live="polite"
{% endif %}
>
<div class="bottom-gutter">
{{ pill('Status', counts, status) }}
</div>
<div class="bottom-gutter">
{{ pill('Status', counts, status) }}
</div>

View File

@@ -1,17 +1,6 @@
{% from "components/table.html" import list_table, field, right_aligned_field_heading, date_field, row_heading %}
<div
{% if notifications %}
class='dashboard-table'
{% endif %}
{% if not finished %}
data-module="update-content"
data-resource="{{url_for(".view_job_updates", service_id=current_service.id, job_id=job.id, status=request.args.get('status'), help=request.args.get('help'))}}"
data-key="notifications"
aria-live="polite"
{% endif %}
>
<div class="dashboard-table">
{% if notifications %}
<p class="bottom-gutter">
<a href="{{ url_for('.view_job_csv', service_id=current_service.id, job_id=job.id, status=status) }}" download="download" class="heading-small">Download as a CSV file</a>
@@ -45,5 +34,4 @@
{{ item.status|format_notification_status(item.template.template_type) }}
{% endcall %}
{% endcall %}
</div>

View File

@@ -1,12 +1,3 @@
<div
{% if not finished %}
data-module="update-content"
data-resource="{{url_for(".view_job_updates", service_id=current_service.id, job_id=job.id, status=status, help=request.args.get('help', 0))}}"
data-key="status"
aria-live="polite"
{% endif %}
>
<p class='heading-small bottom-gutter'>
Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
</p>
</div>
<p class='heading-small bottom-gutter'>
Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }}
</p>