Merge pull request #3251 from alphagov/job-model

Make models for individual jobs and collections of jobs
This commit is contained in:
Chris Hill-Scott
2020-01-16 15:52:21 +00:00
committed by GitHub
20 changed files with 385 additions and 304 deletions
+5 -5
View File
@@ -26,22 +26,22 @@
{% endif %}
<span class="file-list-hint">
Sent {{
(item.scheduled_for if item.scheduled_for else item.created_at)|format_datetime_relative
(item.scheduled_for or item.created_at)|format_datetime_relative
}}
</span>
</div>
{% endcall %}
{% call field() %}
{{ big_number(
item.get('notification_count', 0) - item.get('notifications_delivered', 0) - item.get('notifications_failed', 0),
item.notifications_sending,
smallest=True
) }}
{% endcall %}
{% call field() %}
{{ big_number(item.get('notifications_delivered', 0), smallest=True) }}
{{ big_number(item.notifications_delivered, smallest=True) }}
{% endcall %}
{% call field(status='error' if item.get('failure_rate', 0) > 3 else '') %}
{{ big_number(item.get('notifications_failed', 0), smallest=True) }}
{% call field(status='error' if item.high_failure_rate else '') %}
{{ big_number(item.notifications_failed, smallest=True) }}
{% endcall %}
{% endcall %}
</div>
+2 -2
View File
@@ -3,7 +3,7 @@
{% from "components/show-more.html" import show_more %}
<div class="ajax-block-container">
{% if scheduled_jobs %}
{% if current_service.scheduled_jobs %}
<div class='dashboard-table'>
{% if not hide_heading %}
<h2 class="heading-medium heading-upcoming-jobs">
@@ -11,7 +11,7 @@
</h2>
{% endif %}
{% call(item, row_number) list_table(
scheduled_jobs,
current_service.scheduled_jobs,
caption="In the next few days",
caption_visible=False,
empty_message='Nothing to see here',
+1 -1
View File
@@ -35,7 +35,7 @@
{{ ajax_block(partials, updates_url, 'template-statistics', interval=5) }}
{% if partials['has_jobs'] %}
{% if current_service.immediate_jobs %}
{{ ajax_block(partials, updates_url, 'jobs', interval=5) }}
{{ show_more(
url_for('.view_jobs', service_id=current_service.id),
+7 -7
View File
@@ -4,28 +4,28 @@
{% from "components/page-footer.html" import page_footer %}
{% block service_page_title %}
{{ uploaded_file_name }}
{{ job.original_file_name }}
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
{{ uploaded_file_name }}
{{ job.original_file_name }}
</h1>
{% if just_sent %}
{{ banner(just_sent_message, type='default', with_tick=True) }}
{% else %}
{{ ajax_block(partials, updates_url, 'status', finished=finished) }}
{{ ajax_block(partials, updates_url, 'status', finished=job.processing_finished) }}
{% endif %}
{{ ajax_block(partials, updates_url, 'counts', finished=finished) }}
{{ ajax_block(partials, updates_url, 'notifications', finished=finished) }}
{{ ajax_block(partials, updates_url, 'counts', finished=job.processing_finished) }}
{{ ajax_block(partials, updates_url, 'notifications', finished=job.processing_finished) }}
{% if can_cancel_letter_job %}
{% if job.letter_job_can_be_cancelled %}
<div class="js-stick-at-bottom-when-scrolling">
<div class="page-footer">
<span class="page-footer-delete-link page-footer-delete-link-without-button">
<a href="{{ url_for('main.cancel_letter_job', service_id=current_service.id, job_id=job_id) }}">Cancel sending these letters</a>
<a href="{{ url_for('main.cancel_letter_job', service_id=current_service.id, job_id=job.id) }}">Cancel sending these letters</a>
</span>
{% else %}
<div>&nbsp;</div>