mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Show confirmation after pressing big green button
There’s no immediate feedback with letter jobs, unlike email or text messages jobs where you see the numbers starting to tick over straight away. We need to reassure the user that the thing they asked us to do (send letters) is underway. ‘Printing’ feels like the natural first state of the letter-making process. So this commit adds a banner to tell the user that printing is the thing that’s happening.
This commit is contained in:
@@ -110,6 +110,13 @@ def view_job(service_id, job_id):
|
||||
|
||||
total_notifications = job.get('notification_count', 0)
|
||||
processed_notifications = job.get('notifications_delivered', 0) + job.get('notifications_failed', 0)
|
||||
|
||||
template = service_api_client.get_service_template(
|
||||
service_id=service_id,
|
||||
template_id=job['template'],
|
||||
version=job['template_version']
|
||||
)['data']
|
||||
|
||||
return render_template(
|
||||
'views/jobs/job.html',
|
||||
finished=(total_notifications == processed_notifications),
|
||||
@@ -122,7 +129,11 @@ def view_job(service_id, job_id):
|
||||
job_id=job['id'],
|
||||
status=request.args.get('status', ''),
|
||||
),
|
||||
partials=get_job_partials(job),
|
||||
partials=get_job_partials(job, template),
|
||||
just_sent=bool(
|
||||
request.args.get('just_sent') == 'yes' and
|
||||
template['template_type'] == 'letter'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -171,8 +182,16 @@ def cancel_job(service_id, job_id):
|
||||
@main.route("/services/<service_id>/jobs/<job_id>.json")
|
||||
@user_has_permissions('view_activity', admin_override=True)
|
||||
def view_job_updates(service_id, job_id):
|
||||
|
||||
job = job_api_client.get_job(service_id, job_id)['data']
|
||||
|
||||
return jsonify(**get_job_partials(
|
||||
job_api_client.get_job(service_id, job_id)['data']
|
||||
job,
|
||||
service_api_client.get_service_template(
|
||||
service_id=current_service['id'],
|
||||
template_id=job['template'],
|
||||
version=job['template_version']
|
||||
)['data'],
|
||||
))
|
||||
|
||||
|
||||
@@ -343,17 +362,12 @@ def _get_job_counts(job):
|
||||
]
|
||||
|
||||
|
||||
def get_job_partials(job):
|
||||
def get_job_partials(job, template):
|
||||
filter_args = _parse_filter_args(request.args)
|
||||
filter_args['status'] = _set_status_filters(filter_args)
|
||||
notifications = notification_api_client.get_notifications_for_service(
|
||||
job['service'], job['id'], status=filter_args['status']
|
||||
)
|
||||
template = service_api_client.get_service_template(
|
||||
service_id=current_service['id'],
|
||||
template_id=job['template'],
|
||||
version=job['template_version']
|
||||
)['data']
|
||||
|
||||
if template['template_type'] == 'letter':
|
||||
counts = render_template(
|
||||
|
||||
@@ -499,7 +499,13 @@ def start_job(service_id, upload_id):
|
||||
)
|
||||
|
||||
return redirect(
|
||||
url_for('main.view_job', job_id=upload_id, service_id=service_id, help=request.form.get('help'))
|
||||
url_for(
|
||||
'main.view_job',
|
||||
job_id=upload_id,
|
||||
service_id=service_id,
|
||||
help=request.form.get('help'),
|
||||
just_sent='yes',
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,11 @@
|
||||
{{ uploaded_file_name }}
|
||||
</h1>
|
||||
|
||||
{{ ajax_block(partials, updates_url, 'status', finished=finished) }}
|
||||
{% if just_sent %}
|
||||
{{ banner('We’ve started printing your letters', type='default', with_tick=True) }}
|
||||
{% else %}
|
||||
{{ ajax_block(partials, updates_url, 'status', finished=finished) }}
|
||||
{% endif %}
|
||||
{{ ajax_block(partials, updates_url, 'counts', finished=finished) }}
|
||||
{{ ajax_block(partials, updates_url, 'notifications', finished=finished) }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user