Don’t show blue boxes once notifications have gone

You can click the blue boxes to filter the list of notifications. Once
the notifications have gone there’s nothing to filter, so we should just
show the numbers but without them being clickable.
This commit is contained in:
Chris Hill-Scott
2019-12-30 16:53:45 +00:00
parent 9446b35e3b
commit 93d2d47f4e
3 changed files with 32 additions and 3 deletions

View File

@@ -446,7 +446,10 @@ def get_job_partials(job, template):
counts = render_template(
'partials/count.html',
counts=_get_job_counts(job),
status=filter_args['status']
status=filter_args['status'],
notifications_deleted=(
job['job_status'] == 'finished' and not notifications['notifications']
),
)
service_data_retention_days = current_service.get_days_of_retention(template['template_type'])
can_letter_job_be_cancelled = False

View File

@@ -1,5 +1,18 @@
{% from "components/big-number.html" import big_number %}
{% from "components/pill.html" import pill %}
<div class="bottom-gutter ajax-block-container">
{{ pill(counts, request.args.get('status', '')) }}
<div class="ajax-block-container">
{% if notifications_deleted %}
<div class="grid-row bottom-gutter-1-2">
{% for label, query_param, url, count in counts %}
<div class="column-one-quarter">
{{ big_number(count, label, smaller=True) }}
</div>
{% endfor %}
</div>
{% else %}
<div class="bottom-gutter">
{{ pill(counts, request.args.get('status', '')) }}
</div>
{% endif %}
</div>

View File

@@ -294,6 +294,12 @@ def test_should_show_job_in_progress(
service_id=service_one['id'],
job_id=fake_uuid,
)
assert [
normalize_spaces(link.text)
for link in page.select('.pill a')
] == [
'10 sending', '0 delivered', '0 failed'
]
assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…'
@@ -313,6 +319,12 @@ def test_should_show_job_without_notifications(
service_id=service_one['id'],
job_id=fake_uuid,
)
assert [
normalize_spaces(link.text)
for link in page.select('.pill a')
] == [
'10 sending', '0 delivered', '0 failed'
]
assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…'
assert page.select_one('tbody').text.strip() == 'No messages to show yet…'
@@ -333,6 +345,7 @@ def test_should_show_old_job(
service_id=service_one['id'],
job_id=fake_uuid,
)
assert not page.select('.pill a')
assert not page.select('p.hint')
assert not page.select('a[download]')
assert page.select_one('tbody').text.strip() == (