Make template graphs look consistent with page

The graphs of template usage feel a bit weird to me now.

1. They are counts of messages, but the numbers are very small
   not big like we do everywhere else (eg the counts on a job)

2. There’s a lot of blue, especially for something that you can’t
   click

This commit makes the numbers bigger and the bar chart grey.
This commit is contained in:
Chris Hill-Scott
2016-06-14 11:00:56 +01:00
parent d8c1a5ef8a
commit e5d2514846
6 changed files with 58 additions and 29 deletions
+8 -8
View File
@@ -26,16 +26,16 @@
width: 100%; width: 100%;
margin-bottom: $gutter-half; margin-bottom: $gutter-half;
height: $gutter-half; height: $gutter-half;
color: $govuk-blue; color: $text-colour;
span { span {
box-sizing: border-box; box-sizing: border-box;
display: block; display: inline-block;
background: $govuk-blue; overflow: visible;
color: $white; background: $panel-colour;
height: $gutter-half; color: $black;
padding-left: 5px; padding: 5px 5px 2px 5px;
padding-right: 5px; text-indent: -2px;
margin: 3px 0 5px 0; margin: 3px 0 5px 0;
transition: width 0.6s ease-in-out; transition: width 0.6s ease-in-out;
} }
@@ -49,7 +49,7 @@
color: $govuk-blue; color: $govuk-blue;
max-width: 100%; max-width: 100%;
background: $white; background: $white;
margin-bottom: $gutter; margin-bottom: $gutter-two-thirds;
} }
} }
+1
View File
@@ -26,6 +26,7 @@ from app.utils import (
generate_previous_next_dict, generate_previous_next_dict,
user_has_permissions, user_has_permissions,
generate_notifications_csv) generate_notifications_csv)
from app.statistics_utils import sum_of_statistics
def _parse_filter_args(filter_dict): def _parse_filter_args(filter_dict):
@@ -1,26 +1,40 @@
{% from "components/message-count-label.html" import message_count_label %} {% from "components/message-count-label.html" import message_count_label %}
{% from "components/big-number.html" import big_number %}
<dl> <dl>
{% for item in template_statistics %} {% for item in template_statistics %}
<div class="grid-row"> <div class="grid-row">
<dt class="column-half"> <dt class="column-half">
<span class="spark-bar-label"> <span class="spark-bar-label">
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template.id) }}">{{ item.template.name }}</a> <a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template.id) }}">{{ item.template.name }}</a>
<span class="file-list-hint">
{{ message_count_label(1, item.template.template_type, suffix='template')|capitalize }}
</span>
</span> </span>
</dt> </dt>
<dd class="column-half"> <dd class="column-half">
{% if template_statistics|length > 1 %} {% if template_statistics|length > 1 %}
<span class="spark-bar"> <span class="spark-bar">
<span style="width: {{ item.usage_count / most_used_template_count * 100 }}%"></span> <span style="width: {{ item.usage_count / most_used_template_count * 100 }}%">
{{ item.usage_count }} {{ message_count_label(item.usage_count, item.template.template_type) }} {{ big_number(
</span> item.usage_count,
smallest=True
) }}
<span class="visually-hidden">
{{ message_count_label(item.usage_count, item.template.template_type) }}
</span>
</span>
</span>
{% else %} {% else %}
{{ item.usage_count }} {{ message_count_label(item.usage_count, item.template.template_type) }} <span class="heading-small">
{{ item.usage_count }}
{{ message_count_label(item.usage_count, item.template.template_type) }}
</span>
{% endif %} {% endif %}
</dd> </dd>
</div> </div>
{% endfor %} {% endfor %}
</dl> </dl>
+1 -1
View File
@@ -3,7 +3,7 @@
{% from "components/previous-next-navigation.html" import previous_next_navigation %} {% from "components/previous-next-navigation.html" import previous_next_navigation %}
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import page_footer %}
{% from "components/pill.html" import pill %} {% from "components/pill.html" import pill %}
{% from "components/message-count-label.html" import message_count_label %} {% from "components/message-count-label.html" import message_count_label, recipient_count_label %}
{% block page_title %} {% block page_title %}
{{ message_count_label(99, message_type, suffix='') | capitalize }} GOV.UK Notify {{ message_count_label(99, message_type, suffix='') | capitalize }} GOV.UK Notify
+16 -8
View File
@@ -91,11 +91,15 @@ def test_should_show_recent_templates_on_dashboard(app_,
assert len(table_rows) == 2 assert len(table_rows) == 2
assert page.find_all('dt')[0].text.strip() == 'Pickle feet' assert 'Pickle feet' in page.find_all('dt')[0].text
assert page.find_all('dd')[0].text.strip() == '206 text messages sent' assert 'Text message template' in page.find_all('dt')[0].text
assert '206' in page.find_all('dd')[0].text
assert 'text messages sent' in page.find_all('dd')[0].text
assert page.find_all('dt')[1].text.strip() == 'Brine Shrimp' assert 'Brine Shrimp' in page.find_all('dt')[1].text
assert page.find_all('dd')[1].text.strip() == '13 text messages sent' assert 'Text message template' in page.find_all('dt')[1].text
assert '13' in page.find_all('dd')[1].text
assert 'text messages sent' in page.find_all('dd')[1].text
def test_should_show_all_templates_on_template_statistics_page( def test_should_show_all_templates_on_template_statistics_page(
@@ -129,11 +133,15 @@ def test_should_show_all_templates_on_template_statistics_page(
assert len(table_rows) == 2 assert len(table_rows) == 2
assert page.find_all('dt')[0].text.strip() == 'Pickle feet' assert 'Pickle feet' in page.find_all('dt')[0].text
assert page.find_all('dd')[0].text.strip() == '206 text messages sent' assert 'Text message template' in page.find_all('dt')[0].text
assert '206' in page.find_all('dd')[0].text
assert 'text messages sent' in page.find_all('dd')[0].text
assert page.find_all('dt')[1].text.strip() == 'Brine Shrimp' assert 'Brine Shrimp' in page.find_all('dt')[1].text
assert page.find_all('dd')[1].text.strip() == '13 text messages sent' assert 'Text message template' in page.find_all('dt')[1].text
assert '13' in page.find_all('dd')[1].text
assert 'text messages sent' in page.find_all('dd')[1].text
def _test_dashboard_menu(mocker, app_, usr, service, permissions): def _test_dashboard_menu(mocker, app_, usr, service, permissions):
+11 -5
View File
@@ -32,6 +32,7 @@ def test_should_show_page_for_one_job(
service_one, service_one,
active_user_with_permissions, active_user_with_permissions,
mock_get_service_template, mock_get_service_template,
mock_get_service_statistics,
mock_get_job, mock_get_job,
mocker, mocker,
mock_get_notifications, mock_get_notifications,
@@ -57,6 +58,7 @@ def test_should_show_updates_for_one_job_as_json(
service_one, service_one,
active_user_with_permissions, active_user_with_permissions,
mock_get_notifications, mock_get_notifications,
mock_get_service_statistics,
mock_get_job, mock_get_job,
mocker, mocker,
fake_uuid fake_uuid
@@ -112,6 +114,7 @@ def test_can_show_notifications(
service_one, service_one,
active_user_with_permissions, active_user_with_permissions,
mock_get_notifications, mock_get_notifications,
mock_get_service_statistics,
mocker, mocker,
message_type, message_type,
page_title, page_title,
@@ -166,11 +169,14 @@ def test_can_show_notifications(
assert 'text/csv' in csv_response.headers['Content-Type'] assert 'text/csv' in csv_response.headers['Content-Type']
def test_should_show_notifications_for_a_service_with_next_previous(app_, def test_should_show_notifications_for_a_service_with_next_previous(
service_one, app_,
active_user_with_permissions, service_one,
mock_get_notifications_with_previous_next, active_user_with_permissions,
mocker): mock_get_notifications_with_previous_next,
mock_get_service_statistics,
mocker
):
with app_.test_request_context(): with app_.test_request_context():
with app_.test_client() as client: with app_.test_client() as client:
client.login(active_user_with_permissions, mocker, service_one) client.login(active_user_with_permissions, mocker, service_one)