mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 11:39:49 -04:00
Use a ModelList for lists of jobs
This follows the pattern of what we’ve done with services, users and events. It gives us a way of neatly instantiating a model for each item in the list we get back from the API and reduces the complexity of the view layer code. Now is a good time to do this because we’re going to be making a bunch of changes to the jobs pages, and those changes will be easier to code and understand with a sensible model behind them.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user