Commit Graph

1365 Commits

Author SHA1 Message Date
Chris Hill-Scott
5625ef6eee Merge pull request #558 from alphagov/template-stats-2
Make template usage on dashboard easier to scan
2016-05-17 11:26:49 +01:00
Rebecca Law
c4de547b74 Merge pull request #568 from alphagov/template_history_view
Template history view
2016-05-17 08:50:40 +01:00
Adam Shimali
18a0b94d98 Admin app settings to save reply to email address for service. 2016-05-16 13:10:51 +01:00
Chris Hill-Scott
000d630cae Use Spreadsheet class to generate example CSVs
This means not repeating a bunch of `with StringIO` blocks all
over the place.
2016-05-16 13:05:41 +01:00
Chris Hill-Scott
e84436d0e1 Make s3upload function return the UUID
Generating the UUID can be can be contained within this function,
thus any other part of the code using it doesn’t have to do the
ID-generating stuff itself.
2016-05-16 13:05:41 +01:00
Rebecca Law
d4225de45e Update json structure for unit tests. 2016-05-16 11:53:22 +01:00
Chris Hill-Scott
7bbc307a3e Handle files that can’t be interpreted as spreadsheets
There shouldn’t be a case where we see a `ValueError` on upload any
more. Our file handling should be robust enough to deal with whatever is
thrown at it.

This commit:
- adds test files with bad data (PNG files with their extensions changed to look
  like spreadsheets)
- catches whatever exceptions are raised by trying to parse these files
- returns a helpful flash message to the user

Anything else should raise a `500`, eg if the file can’t be uploaded to S3.
2016-05-15 22:11:01 +01:00
Chris Hill-Scott
1409ca36ca Accept common spreadsheet formats, not just CSV
We require users to export their spreadsheets as CSV files before
uploading them. But this seems like the sort of thing a computer should
be able to do.

So this commit adds a wrapper class which:
- takes a the uploaded file
- returns it in a normalised format, or reads it using pyexcel[1]
- gives the data back in CSV format

This allows us to accept `.csv`, `.xlsx`, `.xls` (97 and 95), `.ods`,
`.xlsm` and `.tsv` files. We can upload the resultant CSV just like
normal, and process it for errors as before.

Testing
---

To test this I’ve added a selection of common spreadsheet files as test
data. They all contain the same data, so the tests look to see that the
resultant CSV output is the same for each.

UI changes
---

This commit doesn’t change the UI, apart from to give a different error
message if a user uploads a file type that we still don’t understand.

I intend to do this as a separate pull request, in order to fulfil
https://www.pivotaltracker.com/story/show/119371637
2016-05-15 22:10:58 +01:00
Rebecca Law
fcf277c413 Merge branch 'master' into template_history_view
Conflicts:
	requirements.txt
2016-05-13 17:30:33 +01:00
Chris Hill-Scott
c3d78f5652 Show template stats even if there’s only 1 row
If you’re only ever sending one template it’s really useful to be able
to jump straight to that template from the dashboard. So this commit:
- shows the template stats even if there’s only one row
- hides the bar chart if there’s only one row (because it will always be
  100%, and won’t be obvious what it is without its siblings)
2016-05-13 10:26:57 +01:00
Chris Hill-Scott
8a4b0ba88c Add a message count component
The logic to say ‘1 email sent’ vs ‘12 text messages sent’ is repeated
all over the place. So this commit adds a component to put it in one
place.
2016-05-13 10:26:57 +01:00
Chris Hill-Scott
3dc349c8a7 Include template type in bar graph label
It’s possible that users will have email and SMS templates with similar
names, and will send them depending on their users’ contact preferences.

So it’s useful to be able to compare how many emails vs SMS you’re
sending, even if the template names are similar.
2016-05-13 10:19:46 +01:00
Chris Hill-Scott
1b8236f5f8 Make template usage on dashboard easier to scan
The dashboard looked a bit table-y. This commit makes four main changes:

- show a bar chart (drawn in CSS) for template usage (only shown if
  you’ve used more than one template recently)
- only break down template usage by template name, not template type
  (because that’s happening with the big numbers)
- change the style of the ‘show more’ links under each section so that
  they are all consistent, and a little less busy (one less keyline)
- remove the ‘recent templates‘ title so that the first two sections of
  the page group under ‘in the last 7 days’
2016-05-13 09:59:41 +01:00
Nicholas Staples
64e7a7b010 Update all dates to use utc, only in the template is it converted to british time.
Template versions and template version pages added.

Fix merge changes.
2016-05-12 21:34:39 +01:00
Martyn Inglis
af59ecb379 Record start of request so we can time all requests 2016-05-12 13:56:14 +01:00
Chris Hill-Scott
3fd7457a21 Merge pull request #560 from alphagov/code-formatting-in-docs
Give the <code> example in docs better CSS
2016-05-12 13:09:08 +01:00
Chris Hill-Scott
a659c75276 Give the <code> example in docs better CSS
- adds a background colour, to words wrapped in `<code>` tags, like we
  have for whole snippets of code
- reduces the font size of all code blocks
  a) to differentiate them further
  b) to fit more on the screen
2016-05-12 11:34:57 +01:00
Chris Hill-Scott
bda3aa98f8 Change "test run" to "test message"
Because reasons.
Obvs.
2016-05-12 11:22:14 +01:00
minglis
daf33b03ad Merge pull request #557 from alphagov/notification_show_updated_at
Notifications display updated_at instead of created_at.
2016-05-11 16:55:37 +01:00
minglis
2388c395e3 Merge pull request #552 from alphagov/primary-providers
Added provider management pages in.
2016-05-11 16:49:47 +01:00
Henry Hadlow
e3fa1ac253 Tidy up text on forgot your password screens
Display updated_at instead of created_at for notifications.
2016-05-11 16:30:15 +01:00
Martyn Inglis
31f14fd0ec Removed print statements 2016-05-11 15:39:03 +01:00
Pete Herlihy
f18972755a Merge pull request #547 from alphagov/make-forgot-your-password-text-consistent
Tidy up text on forgot your password screens
2016-05-11 15:10:46 +01:00
Rebecca Law
9232ab51d5 Merge pull request #554 from alphagov/add-created_by-to-jobs
Update the jobs and activity page to show the user that created the job.
2016-05-11 14:55:29 +01:00
Rebecca Law
53fb1dcc4b Use Uploaded by instead of Created by for the label.
Move status to the last column on the table
2016-05-11 14:45:20 +01:00
Rebecca Law
46d5065297 Update the jobs and activity page to show the user that created the job. 2016-05-11 11:57:31 +01:00
Nicholas Staples
af500a96e7 Update all dates to use utc, only in the template is it converted to british time. 2016-05-11 11:20:45 +01:00
Martyn Inglis
6699442f6b Added provider management pages in.
- see priority
- change priority
2016-05-11 09:43:55 +01:00
Henry Hadlow
36da188d04 Tidy up text on forgot your password screens 2016-05-10 11:36:49 +01:00
Nicholas Staples
05882aafb2 Fix for user with only send permissions. 2016-05-09 10:55:02 +01:00
Adam Shimali
5d7ff0cb47 Merge pull request #542 from alphagov/previous-weeks
Add a page to show delivery rates week-by-week
2016-05-09 10:17:59 +01:00
Chris Hill-Scott
b5d5689d5c Make right-aligned big numbers left aligned 2016-05-05 11:01:34 +01:00
Chris Hill-Scott
50427ecd3f Add a page to show delivery rates week-by-week
Implements
https://github.com/alphagov/notifications-api/pull/286

Will always show weeks as Monday to Sunday.
2016-05-05 10:56:20 +01:00
Chris Hill-Scott
6917e11207 Make ‘send emails/text messages’ link bold
It:
- makes this whole block of links slightly more prominent
- reinforces that ‘send’ is the primary action
2016-05-05 08:58:13 +01:00
Chris Hill-Scott
a8c62ee40a Make ‘Back’ button go to the right place
When you send yourself a test clicking the grey ‘Back’ button should
send you back to the page with the textboxes, if that’s where you came
from.
2016-05-05 08:58:13 +01:00
Chris Hill-Scott
687ccad018 Make send a test teach you how placeholders work
This commit does two main things:

- adds textboxes to the send yourself a test page, so you can replace
  ((name)) with ‘Chris’, or whatever your name is
- rejigs the send page a bit to make it clearer what the CSV upload is
  for and how to use it

The idea being that, since most users go into ‘send yourself a test’
first, it teaches them about how placeholders work by making them do the
replacing themselves.
2016-05-05 08:53:00 +01:00
Chris Hill-Scott
9d37040d49 Add recipient to message previews
When previewing a template on the send page, having the recipient appear
as a placeholder should help reinforce the relationship between the
columns in the CSV and the placeholders.

Then, when previewing a message, having the template populated with the
first recipient’s email address/phone number should reinforce that
relationship again.
2016-05-05 08:45:29 +01:00
Adam Shimali
09117e5eeb Updated flask-login to version 0.3.2 2016-05-04 14:06:14 +01:00
Chris Hill-Scott
cb93e8ada5 Merge pull request #534 from alphagov/footer-changes
Footer links moved around to more sensible groupings
2016-05-03 15:42:00 +01:00
Chris Hill-Scott
e8bb0ee889 Merge pull request #533 from alphagov/relabel-usage
Rename ‘this year’
2016-05-03 13:51:30 +01:00
NIcholas Staples
bd0afce745 Merge pull request #527 from alphagov/windows_csv
Only check on csv is the file extension.
2016-05-03 12:50:34 +01:00
Pete Herlihy
061cbfa82d Footer links moved around to more sensible groupings 2016-05-03 12:26:44 +01:00
Chris Hill-Scott
71f7e144a4 Rename ‘this year’
Make it clear that this section is about what you’ve used, ie your usage

Click ‘breakdown’ to see how the maths is done, and what time period it
covers.
2016-05-03 12:25:01 +01:00
Chris Hill-Scott
1d0b28f156 Merge pull request #524 from alphagov/usage
Add usage to the dashboard
2016-05-03 11:35:11 +01:00
Chris Hill-Scott
00030bc254 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.
2016-05-03 11:06:12 +01:00
NIcholas Staples
9e94d2382d Merge pull request #532 from alphagov/british_time
Times from api are now formatted to the british time.
2016-05-03 11:02:21 +01:00
Chris Hill-Scott
f6ba5ec8d0 Merge pull request #528 from alphagov/activity-improvements
Link up the last 7 days
2016-05-03 10:58:51 +01:00
Nicholas Staples
e1f3975c9a Times from api are now formatted to the british time. 2016-05-03 10:55:37 +01:00
catherineheywood
d4c77f3164 Resize image file 2016-05-03 10:42:31 +01:00
catherineheywood
e11879ede7 Change JWT to JSON Web Tokens 2016-05-03 10:20:53 +01:00