Link to the relevant job from notification page

If a notification has been sent from a job then that’s important context
to know about it. So we should surface that information on the page.

It also gives users an easy way of going back, if that’s the page
they’ve come from.
This commit is contained in:
Chris Hill-Scott
2017-06-19 14:43:01 +01:00
parent 929e2b841f
commit 1eb3a5aca0
2 changed files with 14 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ from flask_login import login_required
from app import (
notification_api_client,
job_api_client,
current_service
)
from app.main import main
@@ -57,11 +58,16 @@ def view_notification(service_id, notification_id):
show_recipient=True,
)
template.values = notification['personalisation']
if notification['job']:
job = job_api_client.get_job(service_id, notification['job']['id'])['data']
else:
job = None
return render_template(
'views/notifications/notification.html',
finished=(notification['status'] in (DELIVERED_STATUSES + FAILURE_STATUSES)),
uploaded_file_name='Report',
template=template,
job=job,
updates_url=url_for(
".view_notification_updates",
service_id=service_id,

View File

@@ -15,7 +15,14 @@
</h1>
<p>
Sent {% if created_by %}by {{ created_by.name }} {% endif %}
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=template.id) }}">{{ template.name }}</a>
sent
{% if job %}
from
<a href="{{ url_for('.view_job', service_id=current_service.id, job_id=job.id) }}">{{ job.original_file_name }}</a>
{% elif created_by %}
by {{ created_by.name }}
{% endif %}
on {{ created_at|format_datetime_short }}
</p>
@@ -23,9 +30,4 @@
{{ ajax_block(partials, updates_url, 'status', finished=finished) }}
{{ page_footer(
secondary_link=url_for('.view_template', service_id=current_service.id, template_id=template.id),
secondary_link_text='Back to {}'.format(template.name)
) }}
{% endblock %}