mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 09:28:26 -04:00
Put some statistics on the dashboard
This commit adds two new sections to the dashboard 1. A banner telling you about trial mode, including a count of how many messages you have left today, which is a restriction of trial mode 2. Panels with counts of how many emails and text messages have been sent in a day, plus the failure rates for each It does **not**: - link through to any further information about what trial mode is (coming later) - link through to pages for the failure rates (coming later) - change the ‘recent jobs’ section to ‘recent notifications’
This commit is contained in:
20
app/templates/views/dashboard/dashboard.html
Normal file
20
app/templates/views/dashboard/dashboard.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
|
||||
{% block page_title %}
|
||||
{{ session.get('service_name', 'Dashboard') }} – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{% if service.restricted %}
|
||||
{% include 'views/dashboard/trial-mode-banner.html' %}
|
||||
{% endif %}
|
||||
|
||||
{% if not jobs %}
|
||||
{% include 'views/dashboard/get-started.html' %}
|
||||
{% else %}
|
||||
{% include 'views/dashboard/today.html' %}
|
||||
{% include 'views/dashboard/jobs.html' %}
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
19
app/templates/views/dashboard/get-started.html
Normal file
19
app/templates/views/dashboard/get-started.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
|
||||
<h2 class="heading-medium">Get started</h2>
|
||||
<ol class="grid-row">
|
||||
{% if current_user.has_permissions(['manage_templates']) %}
|
||||
<li class="column-half">
|
||||
{% call banner_wrapper(type="tip", subhead='1.' if not templates else None, with_tick=templates|length) %}
|
||||
<a href='{{ url_for(".add_service_template", service_id=service_id, template_type="sms") }}'>Add a template</a>
|
||||
{% endcall %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if current_user.has_permissions(['send_texts', 'send_emails', 'send_letters']) %}
|
||||
<li class="column-half">
|
||||
{% call banner_wrapper(type="tip", subhead='2.') %}
|
||||
<a href='{{ url_for(".choose_template", service_id=service_id, template_type="sms") }}'>Send yourself a message</a>
|
||||
{% endcall %}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ol>
|
||||
28
app/templates/views/dashboard/jobs.html
Normal file
28
app/templates/views/dashboard/jobs.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{% from "components/table.html" import list_table, field, right_aligned_field_heading, hidden_field_heading %}
|
||||
|
||||
{% call(item) list_table(
|
||||
jobs,
|
||||
caption="Recent batch jobs",
|
||||
empty_message='You haven’t sent any text messages yet',
|
||||
field_headings=['File', 'Started', right_aligned_field_heading('Rows'), right_aligned_field_heading('Sent')]
|
||||
) %}
|
||||
{% call field() %}
|
||||
<a href="{{ url_for('.view_job', service_id=service_id, job_id=item.id) }}">{{ item.original_file_name }}</a>
|
||||
{% endcall %}
|
||||
{% call field() %}
|
||||
{{ item.created_at|format_datetime }}
|
||||
{% endcall %}
|
||||
{% call field(align='right') %}
|
||||
{{ item.notification_count }}
|
||||
{% endcall %}
|
||||
{% call field(align='right') %}
|
||||
{{ item.notifications_sent }}
|
||||
{% endcall %}
|
||||
{% endcall %}
|
||||
{% if more_jobs_to_show %}
|
||||
{% if current_user.has_permissions(['send_texts', 'send_emails', 'send_letters']) %}
|
||||
<p class="table-show-more-link">
|
||||
<a href="{{ url_for('.view_jobs', service_id=service_id) }}">See all sent text messages</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
25
app/templates/views/dashboard/today.html
Normal file
25
app/templates/views/dashboard/today.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{% from "components/big-number.html" import big_number_with_status %}
|
||||
|
||||
<h2 class="heading-medium">
|
||||
Sent today
|
||||
</h2>
|
||||
<div class="grid-row">
|
||||
<div class="column-half">
|
||||
{{ big_number_with_status(
|
||||
statistics.get('emails_requested', 0),
|
||||
'email' if statistics.get('emails_requested') == 1 else 'emails',
|
||||
'{}%'.format(statistics.get('emails_failure_rate', 0)),
|
||||
'failed',
|
||||
statistics.get('emails_percentage_of_danger_zone', 0)
|
||||
) }}
|
||||
</div>
|
||||
<div class="column-half">
|
||||
{{ big_number_with_status(
|
||||
statistics.get('sms_requested', 0),
|
||||
'text message' if statistics.get('sms_requested') == 1 else 'text messages',
|
||||
'{}%'.format(statistics.get('sms_failure_rate', 0)),
|
||||
'failed',
|
||||
statistics.get('sms_percentage_of_danger_zone', 0)
|
||||
) }}
|
||||
</div>
|
||||
</div>
|
||||
24
app/templates/views/dashboard/trial-mode-banner.html
Normal file
24
app/templates/views/dashboard/trial-mode-banner.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/big-number.html" import big_number %}
|
||||
|
||||
{% call banner_wrapper(type="mode") %}
|
||||
|
||||
<div class="grid-row">
|
||||
<div class="column-one-half">
|
||||
<h2 class="heading-medium">Trial mode</h2>
|
||||
<p>
|
||||
We’ll only deliver messages to you and members of your team
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="column-one-sixth">
|
||||
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
{{ big_number(
|
||||
service.limit - statistics.get('emails_requested', 0) - statistics.get('sms_requested', 0),
|
||||
'messages left today'
|
||||
) }}
|
||||
</div>
|
||||
</div>
|
||||
{% endcall %}
|
||||
Reference in New Issue
Block a user