Show inbound messages on the dashboard

This commit adds two things:

a section on the dashboard to show how many inbound messages the
service has received in the last 7 days, and how recently an inbound
message has been received
---

Doesn’t show the contents of any messages, just like how the rest of the
dashboard is an aggregation, never individual messages.

a page to show all the inbound messages the service has received in
the last 7 days
---

This shows the first line of the message. Eventually this will link
through to a ‘conversation’ page, where a service can see all the
messages it’s received from a given phone number.
This commit is contained in:
Chris Hill-Scott
2017-05-22 17:02:03 +01:00
parent 56354a0177
commit e373296bd9
13 changed files with 300 additions and 14 deletions

View File

@@ -135,6 +135,16 @@ def monthly(service_id):
)
@main.route("/services/<service_id>/inbox")
@login_required
@user_has_permissions('manage_settings', admin_override=True)
def inbox(service_id):
return render_template(
'views/dashboard/inbox.html',
messages=service_api_client.get_inbound_sms(service_id),
)
def aggregate_usage(template_statistics, sort_key='count'):
return sorted(
template_statistics,
@@ -166,6 +176,10 @@ def get_dashboard_partials(service_id):
'views/dashboard/_upcoming.html',
scheduled_jobs=scheduled_jobs
),
'inbox': render_template(
'views/dashboard/_inbox.html',
inbound_sms_summary=service_api_client.get_inbound_sms_summary(service_id),
),
'totals': render_template(
'views/dashboard/_totals.html',
service_id=service_id,