Make jobs filterable by notification status

We can filter all notifications by status already. This commit reuses
the same code to filter the notifications for a job by status.

This means that, visually we can show the count on a job the same as
we do for all notifications, which is similar to how we show the counts
on the dashboard, so hopefully it feels like a bit more of a solid
thing.

This also applies to CSV downloads and AJAX updates, which will inherit
any filtering that their parent page has applied.
This commit is contained in:
Chris Hill-Scott
2016-06-08 16:34:26 +01:00
parent 5f0dc749f5
commit 6d7d5a4e46
6 changed files with 128 additions and 35 deletions

View File

@@ -14,9 +14,12 @@ class JobApiClient(BaseAPIClient):
self.client_id = app.config['ADMIN_CLIENT_USER_NAME']
self.secret = app.config['ADMIN_CLIENT_SECRET']
def get_job(self, service_id, job_id=None, limit_days=None):
def get_job(self, service_id, job_id=None, limit_days=None, status=None):
if job_id:
return self.get(url='/service/{}/job/{}'.format(service_id, job_id))
params = {}
if status is not None:
params['status'] = status
return self.get(url='/service/{}/job/{}'.format(service_id, job_id), params=params)
params = {}
if limit_days is not None:
params['limit_days'] = limit_days