mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 19:04:33 -04:00
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:
@@ -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,
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user