Commit Graph

2735 Commits

Author SHA1 Message Date
Chris Hill-Scott
0185270308 Fix sorting of events
Events should be sorted reverse-chronologically, no matter what order
they come back from the API in, or which field in the API response
they’ve been extracted from.
2019-10-23 15:05:26 +01:00
Chris Hill-Scott
a765920f65 Add years to old dates
Just to disambiguate things without introducing unnecessary noise.
2019-10-23 13:18:58 +01:00
Chris Hill-Scott
600e3affc1 Show user names for events without API changes
This commit introduces a slightly hacky way of putting usernames against
events, given that the API only returns user IDs.

It does so without:
- making changes to the API
- making a pages that could potentially fire off dozens of API calls (ie
  one per user)

This comes with the limitation that it can only get names for those team
members who are still in the team. Otherwise it will say ‘Unknown’.

In the future the API should probably return the name and email address
for the user who initiated the event, and whether that user was acting
in a platform admin capacity.
2019-10-23 13:15:41 +01:00
Chris Hill-Scott
63f6a3ab12 Let users filter by type of event
At the moment we have two types of event, ‘service’ events and ‘API key’
events. They are munged together which is useful initially, but could
get noisy.

This commit adds filters (copied from the choose template page) that let
users narrow down the list to one of the two types of event. This might
help users get a clearer picture of what’s going on.
2019-10-23 13:09:47 +01:00
Chris Hill-Scott
d93ebd99d3 Refactor history off the service model
Directly referencing the `ModelList` instances will let us more easily
make choices at the view layer about which kinds of events to show, and
is one less layer of indirection to jump through.
2019-10-23 13:08:06 +01:00
Chris Hill-Scott
b2ebaf153a Chunk events by day
Scanning the page is difficult at the moment because it’s hard to tell
how far apart in time events are, and thereby determine which events
might be related.

Grouping the events by day quickly lets users narrow their focus to
a meaningful subset of the events.
2019-10-23 13:06:25 +01:00
Chris Hill-Scott
59b4d60c91 Munge stuff into a consistent event data type
We store our audit history in two ways:

  1. A list of versions of a service
  2. A list of events to do with API keys

In the future there could be auditing data which we want to display that
is stored in other formats (for example the event table).

This commit adds some objects which wrap around the different types of
auditing data, and expose a consistent interface to them. This
architecture will let us:
- write clean code in the presentation layer to display these events on
  a page
- add more types of events in the future by subclassing the `Event` data
  type, without having to rewrite anything in the presentation layer
2019-10-23 13:02:11 +01:00
Chris Hill-Scott
055f000020 Merge pull request #3151 from alphagov/history-page-tidy-up
Bring the service history page up to our current coding standards
2019-10-22 13:48:16 +01:00
Chris Hill-Scott
8c7f9a8286 Add a simple test for the history page 2019-10-21 16:29:05 +01:00
Chris Hill-Scott
8db94eafc8 Use service-specific page template for history 2019-10-21 16:29:05 +01:00
Katie Smith
3732e45126 Stop allowing uploaded letters to be sent for trial mode services
We weren't checking if a service was in trial mode when they try to send
an uploaded file. If a service is in trial mode, we now show a banner at
the top of the preview page and no send button.
2019-10-21 14:42:39 +01:00
Katie Smith
b0ffca2774 Only show overlay when content is outside the printable area
The overlay was showing for any invalid pdf - we only want to show the
overlay for invalid pdf files where there is content outside the
printable area.
2019-10-21 11:10:27 +01:00
Katie Smith
3b3f74bbf0 Use the new error messages when uploading a letter
We now use the pattern of showing a box at the top of the page with the
error. The error message has a heading and can have additional details.
Error messages and the invalid pages get stored in the S3 metadata.
2019-10-21 08:37:55 +01:00
Katie Smith
3223956ba2 Allow extra metadata fields when uploading letter to S3 2019-10-21 08:37:55 +01:00
Katie Smith
8f7a05200d Add function to map template-preview errors to user-friendly errors
Template preview now returns a short string as it's error message plus
a list of invalid pages.
2019-10-21 08:35:04 +01:00
David McDonald
3436a190a7 Send precompiled letters with a postage value to the API
We hardcode this as second class for the moment but eventually
will let the user pick.

Currently the API appears to do no validation, e.g. a json
schema, that rejects API calls with the extra key for postage.

Next steps will be to put a PR into the API that will expect a
postage value in the request and save it with the rest of the
notification. Then when that is done we can add the user interface
to the admin app to let the user pick the postage.
2019-10-18 16:35:16 +01:00
Chris Hill-Scott
5c9f238c12 Merge pull request #3097 from alphagov/add-js-tests-for-highlight-tags
Add JS tests for highlight tags module
2019-10-17 15:30:24 +01:00
Pea (Malgorzata Tyczynska)
53ef438a1e Merge pull request #3135 from alphagov/enforce_letter_10_page_limit
Enforce letter 10 page limit
2019-10-16 13:14:30 +01:00
Pea Tyczynska
2ed1e382b4 Move letter length check to utils repo so template-preview can use it, too
Update requirements
2019-10-10 14:25:19 +01:00
Chris Hill-Scott
7f033efc28 Fix email branding request page with only textbox
If there aren’t a range of options (normally presented as radio buttons)
to show the user on the email branding request page then we just show
the textbox. But we were still doing form validation on the radio
buttons, even though the user couldn’t see them to click them. This
stopped the user from being able to submit the form.

This commit fixes the problem by, in this specific case, pre-ticking the
‘Something else’ radio button.
2019-10-09 16:42:30 +01:00
Pea Tyczynska
c524b0bbf5 Rebase and set upload status to invalid if too many pages 2019-10-09 16:03:48 +01:00
Pea Tyczynska
12ec2870af Move letter too long banner message over from utils, also refactor 2019-10-09 16:03:47 +01:00
Pea Tyczynska
028d156dc7 Do not allow to send job of letters if letters longer than 10 pages 2019-10-09 16:03:47 +01:00
Pea Tyczynska
c690434b1f One off letter flow does not allow to send letter longer than 10 pages 2019-10-09 16:03:47 +01:00
Pea Tyczynska
0adf80f294 Do not allow to send uploaded pdf letters longer than 10 pages 2019-10-09 16:03:46 +01:00
Pea Tyczynska
579ae72abb Do not allow to send a letter template longer than 10 pages 2019-10-09 16:03:46 +01:00
Katie Smith
11543e15be Store all data about uploaded letters in the S3 metadata
We had been storing whether or not a file was valid in the S3 metadata,
but using the query string of the URL to store the original filename
and the page count. This meant that if you tried to view the preview
letter page without the query string you would see a `500`. It was
possible for this to happen if you were signed out of Notify while on
the preview page - you would be redirected back to the preview page but
without the query string, causing an error.
2019-10-08 15:34:00 +01:00
Pea (Malgorzata Tyczynska)
28c901d5b9 Merge pull request #3130 from alphagov/notification-coubt
Get notification count from api instead of getting list of notifications from api
2019-10-08 12:19:55 +01:00
karlchillmaid
c281cd64a5 Merge pull request #3127 from alphagov/update-validation-errors
Update spreadsheet validation errors
2019-10-03 14:46:27 +01:00
Chris Hill-Scott
3d2f7c3fcf Refine error messages and fix tests
Removing the word ‘duplicate’ because:
- it suggests that the whole column is the same, which it might not be
- it suggests that having duplicate column names is a problem, which is
  only true in the case of recipient columns

Reverts back to saying the column names ‘need to’ match, because we feel
it’s more instructive.
2019-10-03 14:24:28 +01:00
Chris Hill-Scott
78e57dbff9 Clear service cache for when updating org branding
Updating an organisation’s branding might now also update the branding
of services associated to that organisation. This is similar to how
updating an organisation’s type can update the organisation type for its
services.

In the latter case we already make sure to clear the cached version of
these services which is held in Redis.

This commit does the same clearing of the caches when updating an
organisation’s branding (and does a bit of refactoring to do so without
duplication of code.)
2019-10-03 12:10:53 +01:00
Tom Byers
605f027c61 Add tests for highlight tags module 2019-10-03 07:59:19 +01:00
Chris Hill-Scott
8b9cc5f4dc Merge pull request #3134 from alphagov/relative-dates-jobs
Use relative dates for jobs on dashboard
2019-10-02 16:19:44 +01:00
Tom Byers
0543dca23d Improve description of cancel link tests 2019-10-01 14:19:06 +01:00
Tom Byers
b6b1e7682b Rename the 'clear selection' link
In response to the sensible comments here:

https://github.com/alphagov/notifications-admin/pull/3053#discussion_r329957545
2019-10-01 14:10:22 +01:00
Tom Byers
8b9c8f2f95 Fix typo in comment 2019-10-01 08:26:08 +01:00
Tom Byers
5bd1e4bb7e Move template list fixture function into helpers
This will be needed in other tests so should be
made into a helper.
2019-10-01 08:26:08 +01:00
Tom Byers
f495288034 Add tests for integration with sticky JS 2019-10-01 08:26:08 +01:00
Tom Byers
60389d7087 Add tests for templateFolderForm JS interactions 2019-10-01 08:26:08 +01:00
Tom Byers
a93a7172e2 Merge pull request #3092 from alphagov/add-js-tests-for-file-upload
Add tests for fileUpload module
2019-09-30 11:08:31 +01:00
Chris Hill-Scott
79369c38c7 Use relative dates for jobs on dashboard
For scheduled files we say ‘sending today at 5:00pm’ or ‘sending
tomorrow at 11:00am’. But once we’ve started processing these files we
say ‘Sent 27 September at 5:00pm’. This makes it sound like 27 September
is not today.

This commit makes the dates shown on the dashboard consistent, by saying
‘today’ and ‘yesterday’ instead of absolute dates.
2019-09-27 13:20:13 +01:00
Pea Tyczynska
9058b13ff2 Get notification count from api instead of list of notifications
when checking if job can be cancelled. This makes query lighter,
less likely to fall over if job is large and removes
pagination bug.
2019-09-24 19:07:20 +01:00
Chris Hill-Scott
98240b4780 Fix test 2019-09-23 13:22:29 +01:00
Rebecca Law
18e3eb6b32 Update tests for content changes. 2019-09-23 13:22:28 +01:00
karlchillmaid
c3d806dd50 Replace haven't with have not 2019-09-23 13:22:28 +01:00
karlchillmaid
3e45b0f738 Replace haven't with have not 2019-09-23 13:22:28 +01:00
karlchillmaid
74e9b343fd Replace haven't with have not 2019-09-23 13:22:28 +01:00
karlchillmaid
5b616a0734 Replace haven't with have not 2019-09-23 13:22:28 +01:00
karlchillmaid
852699e3e8 Replace hasn't with has not 2019-09-23 13:22:26 +01:00
karlchillmaid
8539d6fc66 Replace doesn't with does not 2019-09-23 13:22:17 +01:00