Commit Graph

39 Commits

Author SHA1 Message Date
Martyn Inglis
08dc8fb13d Use the local APIClient rather than the one from the python-api-client
- ensures that all API calls set the request ID when talking to the API.
2016-11-30 17:01:44 +00:00
Leo Hemsted
8464c67a3d move job statuses to job_api_client
prevent code duplication and a good excuse to use set subtraction
2016-10-11 10:35:33 +01:00
Leo Hemsted
dbe4400441 paginate jobs page
(only views/jobs/jobs.html, which is the drill-down page, not the dashboard view)
2016-10-10 15:43:01 +01:00
Leo Hemsted
be97edce7f make add_rate_to_jobs singular
there was no reason for it to operate on a whole list at a time
2016-10-10 15:43:01 +01:00
Leo Hemsted
549a17c1f7 separate get_job and get_jobs in job_api_client
also remove the status parameter, as we never use it anywhere
2016-10-10 15:43:01 +01:00
Chris Hill-Scott
92aacc1a54 Remove extraneous arguments to super
> dont need self.__class__, self in super - that's a python 2.x crutch.
> super() is equivalent
2016-09-12 14:59:53 +01:00
Chris Hill-Scott
5fda35c89d Make it clear that client do not use __init__
The clients never get passed useful values to their `__init__` methods.
Rather the real values are passed through later using the `init_app`
method.

So it should be an error if the client is relying on the values that
get passed to it’s init method. Easiest way to ensure this is by making
the `__init__` method not expect any arguments and passing fake values
to the `Super` call.
2016-09-12 12:18:19 +01:00
Chris Hill-Scott
fa5e5475e9 Update Python client
Just so that nobody else has to do it.

Implements:
- [x] https://github.com/alphagov/notifications-python-client/pull/29

Which is a breaking change requiring the renaming of method arguments.
2016-09-08 15:55:07 +01:00
Chris Hill-Scott
93ca29eab8 Merge pull request #922 from alphagov/cancelled-jobs
Let users cancel a job
2016-09-06 17:12:19 +01:00
Chris Hill-Scott
eb11615a32 Add a cancel job button
If you schedule a job you might change your mind or circumstances might
change. So you need to be able to cancel it. This commit adds a button
on the job page which hits the `…/cancel` API endpoint for a job.
2016-09-06 16:55:24 +01:00
Martyn Inglis
2f56643e3a Fix up issues caused by merge
- statistics now on job_json
- removed test that validates we handle the case where job has no statistics key - never happens
2016-09-05 14:45:34 +01:00
Martyn Inglis
1ad2665bfe Merge branch 'master' into remove-code-that-handled-old-new-job-api
Conflicts:
	app/main/views/jobs.py
	app/notify_client/job_api_client.py
2016-09-05 14:29:58 +01:00
Martyn Inglis
5f561001eb Merged code from master / fixed conflicts 2016-09-05 13:39:03 +01:00
Chris Hill-Scott
7108646afd Revert "Revert "Remove check for statistics not being on job"" 2016-09-01 13:43:15 +01:00
Chris Hill-Scott
be90cf2783 Make sure create job client can handle statistics
The create job endpoint returns the data about the job with a `data:`
wrapper. This commit makes sure that, when the client is trying to
process a job which has just been created, it looks inside the `data`
wrapper.
2016-09-01 13:43:15 +01:00
Chris Hill-Scott
225a61ddd3 Add a component for picking the time to send a job
Users need to pick a time in the next 24hrs, or send a file immediately.

Rationale for this is a bit lost in time-before-holiday, but generally:

‘Now’ and ‘later’ as the inital choices makes it really clear what
this feature is about conceptually.

The choice of times is absolute, eg ‘1pm’ not ‘in 3 hours’
2016-08-31 16:58:09 +01:00
Chris Hill-Scott
d7a591836d Revert "Remove check for statistics not being on job"
This reverts commit 40e22d8258.

For some reason jobs don’t always have statistics.
2016-08-31 12:00:42 +01:00
Chris Hill-Scott
40e22d8258 Remove check for statistics not being on job
A job will always have statistics.

It’s always assigned:
bcfa83de79/app/job/rest.py (L48)

And the structure should always be the same, even if the counts are
zero because they’re generated from this query:
668e6c9716/app/dao/jobs_dao.py (L11-L22)

This line suggests that it’s a hangover from the aggregate tables:
8c159da3ea (diff-9886486bf41b0680d23588b190c252eaL24)

Since it’s no long necessary this commit removes it.
2016-08-31 10:46:43 +01:00
Chris Hill-Scott
37a1eb22b0 Use default dict for default job stats
This is just some refactoring.

`defaultdict` is a data structure which won’t raise a `KeyError` if you
try to access a key that doesn’t exist.

By passing `int` as the first argument, trying to access the value of
any key that doesn’t exists will return the value of `int()`, ie `0`
2016-08-30 14:59:23 +01:00
Chris Hill-Scott
7324b30dbc Re-add a 'requested' stat to a job
It’s useful to know how many notifications we’ve handed off to our
providers. This is a measure of how complete the processing of the job
is.

This is important, because once the job processing is complete then you
can accurately reconcile the report with the CSV file that you’ve
uploaded.
2016-08-30 14:57:28 +01:00
Martyn Inglis
8c159da3ea Fix for admin app to show job data on dashboard page
- uses the new stats block in the API to build the stats expected by the dashboard page
- all work done in client
2016-08-26 15:21:10 +01:00
Martyn Inglis
fb9b33e3de Removed check on notifications-sent, that was used to check whether it was old or new style API.
Now new style is deployed it's not needed.

Tests updated to reflect this,
2016-08-25 12:54:23 +01:00
Martyn Inglis
5b2ae43d5d Wrote some tests around the stats conversions.
Properly named the finished parameter.

Handled the root JSON key
2016-08-24 10:35:04 +01:00
Martyn Inglis
4a551329c5 Parse the JOB API response converting new style response to old style object
- allows migration of API
2016-08-23 16:58:50 +01:00
Chris Hill-Scott
da1fa2e61c Make _attach_current_user a pure function
Mutating dictionaries is gross and doesn’t work as you’d expect. Better
to have the function return a new dictionary instead.

Means we can be explicit that `created_by` is one of the allowed params
when updating a service.
2016-08-11 17:07:55 +01:00
Chris Hill-Scott
6d7d5a4e46 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.
2016-06-14 11:12:46 +01:00
Rebecca Law
6af2b71696 Removed the else statement in the job_api_client.get_job 2016-05-26 09:00:00 +01:00
Rebecca Law
47352af38a Add limit_days query param to the get_job endpoint. 2016-05-25 12:04:51 +01:00
Nicholas Staples
2085792742 Add created_by to all appropriate requests. 2016-04-15 11:08:19 +01:00
Nicholas Staples
8f8cdabfff Upload csv location updated, all tests passing. 2016-04-07 12:56:57 +01:00
Martyn Inglis
c51d44fe43 Merge branch 'master' into celery-jobs
Conflicts:
	app/main/views/sms.py
2016-02-24 15:46:38 +00:00
Martyn Inglis
6e1267826f Removed print statement 2016-02-24 15:45:46 +00:00
Adam Shimali
6c56f9be31 Add count of rows in csv file as a notification count. 2016-02-22 14:53:37 +00:00
Nicholas Staples
48368584d9 notifications-python_client upgraded to 0.2.5 2016-02-11 15:27:08 +00:00
Adam Shimali
90a17bc0a7 Service and job id were incorrectly in bucket name. 2016-02-04 12:06:06 +00:00
Adam Shimali
b73a5d8710 Pass selected template id to api when creating job.
Moved query params for original file name and template id
to session.
2016-02-01 11:28:36 +00:00
Adam Shimali
4ea50499c3 List and individual job pages now fetch data from api.
Few bug fixes around job uuid.
2016-01-29 15:35:35 +00:00
Adam Shimali
5196436645 Better bucket name pending possible change to uuid for service primary
key.

Also small bugfix around file name and original file name
2016-01-29 12:19:50 +00:00
Adam Shimali
0995cd2e3c Uploading csv creates job via api 2016-01-29 10:30:02 +00:00