Updates to display of jobs

This commit:
- adds the template to the jobs page (and puts it at the top of the send SMS
  page) so that it consistently appears in the same place throughout the
  journey
- put the real data about a job on the jobs page and on the dashboard
This commit is contained in:
Chris Hill-Scott
2016-02-03 14:43:16 +00:00
parent 3e7bb42323
commit 856296df5d
13 changed files with 63 additions and 50 deletions

View File

@@ -25,19 +25,21 @@
{% macro list_table(items, caption='', empty_message='', field_headings=[], field_headings_visible=True, caption_visible=True) -%}
{% set parent_caller = caller %}
{% if items %}
{% call mapping_table(caption, field_headings, field_headings_visible, caption_visible) %}
{% for item in items %}
{% call row() %}
{{ parent_caller(item) }}
{% endcall %}
{% endfor %}
{%- endcall %}
{% else %}
<p class="table-empty-message">
{{ empty_message }}
</p>
{% endif %}
{% call mapping_table(caption, field_headings, field_headings_visible, caption_visible) %}
{% for item in items %}
{% call row() %}
{{ parent_caller(item) }}
{% endcall %}
{% endfor %}
{% if not items %}
{% call row() %}
<td class="table-empty-message" colspan="10">
{{ empty_message }}
</td>
{% endcall %}
{% endif %}
{%- endcall %}
{%- endmacro %}

View File

@@ -4,8 +4,9 @@
{% for category, message in messages %}
{{ banner(
message,
'default' if category == 'default' else 'dangerous',
delete_button="Yes, delete this template" if 'delete' == category else None
'default' if category == 'default' or 'default_with_tick' else 'dangerous',
delete_button="Yes, delete this template" if 'delete' == category else None,
with_tick=True if category == 'default_with_tick' else False
)}}
{% endfor %}
{% endif %}

View File

@@ -10,7 +10,7 @@
{% block maincolumn_content %}
<h1 class="heading-large">Send text messages</h1>
<h1 class="heading-large">Check and confirm</h1>
{% if upload_result.rejects %}
<h3 class="heading-small">The following numbers are invalid</h3>
@@ -22,8 +22,7 @@
{% else %}
{{ sms_message(
message_template|replace_placeholders(upload_result.valid[0]),
name='Preview'
message_template|replace_placeholders(upload_result.valid[0])
)}}
<form method="POST" enctype="multipart/form-data">

View File

@@ -2,23 +2,33 @@
{% from "components/table.html" import list_table, field, right_aligned_field_heading %}
{% from "components/big-number.html" import big_number %}
{% from "components/banner.html" import banner %}
{% from "components/sms-message.html" import sms_message %}
{% block page_title %}
GOV.UK Notify | Notifications activity
GOV.UK Notify | Notifications activity
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
{{ uploaded_file_name }}
Sent text messages
</h1>
<p>
{{ banner(flash_message, with_tick=True) }}
{{ sms_message(
template['content'],
)}}
<p class='heading-small'>
Started {{ uploaded_file_time|format_datetime }}
</p>
<ul class="grid-row job-totals">
<li class="column-one-third">
<li class="column-one-quarter">
{{ big_number(
counts.total, 'queued'
)}}
</li>
<li class="column-one-quarter">
{{ big_number(
counts.total,
'text message' if 1 == counts.total else 'text messages'
@@ -27,7 +37,7 @@ GOV.UK Notify | Notifications activity
<li class="column-one-third">
{{ big_number(
counts.failed,
'failed delivery' if 1 == counts.failed else 'failed deliveries'
'failed'
)}}
</li>
<li class="column-one-third">
@@ -37,14 +47,10 @@ GOV.UK Notify | Notifications activity
</li>
</ul>
<p>
Sent with template <a href="{{ url_for('.edit_service_template', service_id=service_id, template_id=template_used) }}">{{ template_used }}</a> on {{ uploaded_file_time | format_datetime}}
</p>
{% call(item) list_table(
messages,
caption='Messages',
caption_visible=False,
caption=uploaded_file_name,
empty_message="Messages go here",
field_headings=[
'To',
'Message',

View File

@@ -8,9 +8,12 @@
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Send text messages</h1>
<form method="POST" enctype="multipart/form-data">
<h1 class="heading-large">Send text messages</h1>
{{ sms_message(template.content) }}
{{ banner(
'You can only send notifications to yourself',

View File

@@ -1,5 +1,5 @@
{% extends "withnav_template.html" %}
{% from "components/table.html" import list_table, field %}
{% from "components/table.html" import list_table, field, right_aligned_field_heading %}
{% from "components/big-number.html" import big_number %}
{% block page_title %}
@@ -31,7 +31,7 @@
subhead='Get started',
type="tip"
)}}
{% else %}
{% elif not jobs %}
{{ banner(
'<a href="{}">Try sending a text message</a>'.format(
url_for(".choose_sms_template", service_id=service_id)
@@ -41,23 +41,20 @@
)}}
{% endif %}
{% if [] %}
{% if jobs %}
{% call(item) list_table(
[],
jobs,
caption="Recent text messages",
empty_message='You havent sent any text messages yet',
field_headings=['Job', 'File', 'Time', 'Status']
field_headings=['Job', 'Created', right_aligned_field_heading('Status')]
) %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=456) }}">{{ item.file }}</a>
<a href="{{ url_for('.view_job', service_id=service_id, job_id=item.id) }}">{{ item.original_file_name }}</a>
{% endcall %}
{% call field() %}
<a href="{{ url_for('.view_job', service_id=service_id, job_id=456) }}">{{ item.job }}</a>
{{ item.created_at|format_datetime }}
{% endcall %}
{% call field() %}
{{ item.time }}
{% endcall %}
{% call field() %}
{% call field(align='right') %}
{{ item.status }}
{% endcall %}
{% endcall %}