diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 5e5cafc8c..03938f4fd 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -57,11 +57,24 @@ def service_dashboard(service_id): @login_required @user_has_permissions('view_activity', admin_override=True) def service_dashboard_updates(service_id): + dashboard_statistics = get_dashboard_statistics_for_service(service_id) return jsonify(**{ - 'today': render_template( - 'views/dashboard/today.html', - **get_dashboard_statistics_for_service(service_id) - ) + 'totals': render_template( + 'views/dashboard/_totals.html', + **dashboard_statistics + ), + 'template-statistics': render_template( + 'views/dashboard/template-statistics.html', + **dashboard_statistics + ), + 'jobs': render_template( + 'views/dashboard/_jobs.html', + **dashboard_statistics + ), + 'usage': render_template( + 'views/dashboard/_usage.html', + **dashboard_statistics + ), }) diff --git a/app/templates/partials/jobs/count.html b/app/templates/partials/jobs/count.html index a1ad9a0af..a9f91e093 100644 --- a/app/templates/partials/jobs/count.html +++ b/app/templates/partials/jobs/count.html @@ -1,16 +1,5 @@ {% from "components/pill.html" import pill %} -
- -
- {{ pill('Status', counts, status) }} -
- +
+ {{ pill('Status', counts, status) }}
diff --git a/app/templates/partials/jobs/notifications.html b/app/templates/partials/jobs/notifications.html index c045d7bae..e20a37342 100644 --- a/app/templates/partials/jobs/notifications.html +++ b/app/templates/partials/jobs/notifications.html @@ -1,17 +1,6 @@ {% from "components/table.html" import list_table, field, right_aligned_field_heading, date_field, row_heading %} -
- +
{% if notifications %}

Download as a CSV file @@ -45,5 +34,4 @@ {{ item.status|format_notification_status(item.template.template_type) }} {% endcall %} {% endcall %} -

diff --git a/app/templates/partials/jobs/status.html b/app/templates/partials/jobs/status.html index ec4f0a308..92e51a37d 100644 --- a/app/templates/partials/jobs/status.html +++ b/app/templates/partials/jobs/status.html @@ -1,12 +1,3 @@ -
-

- Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }} -

-
+

+ Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }} +

diff --git a/app/templates/views/dashboard/_jobs.html b/app/templates/views/dashboard/_jobs.html index 79b523a7b..b414e4456 100644 --- a/app/templates/views/dashboard/_jobs.html +++ b/app/templates/views/dashboard/_jobs.html @@ -1,12 +1,12 @@ {% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading %} -{% from "components/big-number.html" import big_number %} +{% from "components/big-number.html" import big_number -%}
{% call(item, row_number) list_table( jobs, - caption="Recent batch jobs", + caption="Recent files uploaded", caption_visible=False, - empty_message='You haven’t sent any batch messages yet', + empty_message='You haven’t uploaded any files recently', field_headings=[ 'File', 'Sending', diff --git a/app/templates/views/dashboard/_totals.html b/app/templates/views/dashboard/_totals.html index 7ddc9d4eb..213f73c93 100644 --- a/app/templates/views/dashboard/_totals.html +++ b/app/templates/views/dashboard/_totals.html @@ -1,25 +1,27 @@ {% from "components/big-number.html" import big_number_with_status %} {% from "components/message-count-label.html" import message_count_label %} -
- {{ big_number_with_status( - statistics.emails_requested, - message_count_label(statistics.emails_requested, 'email', suffix=''), - statistics.emails_failed, - statistics.get('emails_failure_rate', 0.0), - statistics.get('emails_failure_rate', 0)|float > 3, - failure_link=url_for(".view_notifications", service_id=current_service.id, message_type='email', status='failed'), - link=url_for(".view_notifications", service_id=current_service.id, message_type='email', status='sending,delivered,failed') - ) }} -
-
- {{ big_number_with_status( - statistics.sms_requested, - message_count_label(statistics.sms_requested, 'sms', suffix=''), - statistics.sms_failed, - statistics.get('sms_failure_rate', 0.0), - statistics.get('sms_failure_rate', 0)|float > 3, - failure_link=url_for(".view_notifications", service_id=current_service.id, message_type='sms', status='failed'), - link=url_for(".view_notifications", service_id=current_service.id, message_type='sms', status='sending,delivered,failed') - ) }} +
+
+ {{ big_number_with_status( + statistics.emails_requested, + message_count_label(statistics.emails_requested, 'email', suffix=''), + statistics.emails_failed, + statistics.get('emails_failure_rate', 0.0), + statistics.get('emails_failure_rate', 0)|float > 3, + failure_link=url_for(".view_notifications", service_id=current_service.id, message_type='email', status='failed'), + link=url_for(".view_notifications", service_id=current_service.id, message_type='email', status='sending,delivered,failed') + ) }} +
+
+ {{ big_number_with_status( + statistics.sms_requested, + message_count_label(statistics.sms_requested, 'sms', suffix=''), + statistics.sms_failed, + statistics.get('sms_failure_rate', 0.0), + statistics.get('sms_failure_rate', 0)|float > 3, + failure_link=url_for(".view_notifications", service_id=current_service.id, message_type='sms', status='failed'), + link=url_for(".view_notifications", service_id=current_service.id, message_type='sms', status='sending,delivered,failed') + ) }} +
diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index 9906e2377..70de92640 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -32,47 +32,64 @@
-
- {% include 'views/dashboard/_totals.html' %} -
- {{ show_more( - url_for('.weekly', service_id=current_service.id), - 'Compare to previous weeks' - ) }} -
-
- - {% if template_statistics|length %} - {% include 'views/dashboard/template-statistics.html' %} - {{ show_more( - url_for('.template_history', service_id=current_service.id), - 'See all templates used this year' - ) }} - {% endif %} - - {% if jobs %} - {% include 'views/dashboard/_jobs.html' %} - {{ show_more( - url_for('.view_jobs', service_id=current_service.id), - 'See all uploaded files' - ) }} - {% endif %} - - {% if current_user.has_permissions(['manage_settings'], admin_override=True) %} -

This year

- {% include 'views/dashboard/_jobs.html' %} - {{ show_more( - url_for(".usage", service_id=current_service['id']), - 'See usage breakdown' - ) }} - {% endif %} - + {% include 'views/dashboard/_totals.html' %}
+ {{ show_more( + url_for('.weekly', service_id=current_service.id), + 'Compare to previous weeks' + ) }} + {% if template_statistics|length %} +
+ {% include 'views/dashboard/template-statistics.html' %} +
+ {{ show_more( + url_for('.template_history', service_id=current_service.id), + 'See all templates used this year' + ) }} + {% endif %} + + {% if jobs %} +
+ {% include 'views/dashboard/_jobs.html' %} + {{ show_more( + url_for('.view_jobs', service_id=current_service.id), + 'See all uploaded files' + ) }} + {% endif %} + + {% if current_user.has_permissions(['manage_settings'], admin_override=True) %} +

This year

+
+ {% include 'views/dashboard/_usage.html' %} +
+ {{ show_more( + url_for(".usage", service_id=current_service['id']), + 'See usage breakdown' + ) }} + {% endif %}
diff --git a/app/templates/views/dashboard/jobs.html b/app/templates/views/dashboard/jobs.html deleted file mode 100644 index f06ce67aa..000000000 --- a/app/templates/views/dashboard/jobs.html +++ /dev/null @@ -1,26 +0,0 @@ -{% from "components/table.html" import list_table, field, right_aligned_field_heading, hidden_field_heading %} - -{% call(item, row_number) list_table( - jobs, - caption="Recent batch jobs", - empty_message='You haven’t sent any batch messages yet', - field_headings=['File', 'Started', right_aligned_field_heading('Rows')] -) %} - {% call field() %} - {{ item.original_file_name }} - {{ item.created_at|format_datetime }} - {% endcall %} - {% call field() %} - - {% endcall %} - {% call field(align='right') %} - {{ item.notification_count }} - {% endcall %} -{% endcall %} -{% if more_jobs_to_show %} - {% if current_user.has_permissions(['send_texts', 'send_emails', 'send_letters']) %} - - {% endif %} -{% endif %} diff --git a/app/templates/views/jobs/job.html b/app/templates/views/jobs/job.html index 17059f702..74e01624e 100644 --- a/app/templates/views/jobs/job.html +++ b/app/templates/views/jobs/job.html @@ -28,10 +28,40 @@ )}} {% endif %} - {% include 'partials/jobs/status.html' %} +
+ {% include 'partials/jobs/status.html' %} +
- {% include 'partials/jobs/count.html' %} +
+ {% include 'partials/jobs/count.html' %} +
- {% include 'partials/jobs/notifications.html' %} +
+ {% include 'partials/jobs/notifications.html' %} +
{% endblock %}