Add usage to the dashboard

Takes the number of emails and SMS fragments sent from:
https://github.com/alphagov/notifications-api/pull/273

Using these numbers it’s possible to show:
- how much of your allowance is left
- or how much you have spent

For now the allowance and rates are hard coded.

Only for users that have manage service.
This commit is contained in:
Chris Hill-Scott
2016-04-20 15:37:17 +01:00
parent f6ba5ec8d0
commit 00030bc254
14 changed files with 197 additions and 13 deletions

View File

@@ -159,6 +159,9 @@ class ServiceAPIClient(NotificationsAPIClient):
def get_service_history(self, service_id):
return self.get('/service/{0}/history'.format(service_id))
def get_service_usage(self, service_id):
return self.get('/service/{0}/fragment/aggregate_statistics'.format(service_id))
class ServicesBrowsableItem(BrowsableItem):