Commit Graph

73 Commits

Author SHA1 Message Date
Pea Tyczynska
9f99ebd53b notifications page title for failed letters is titled 'Failed letters' 2019-01-10 15:27:05 +00:00
Chris Hill-Scott
d9da219b7e Use a macro for form tags
This will stop us repeatedly forgetting to add `novalidate` and
`autocomplete='off'` to our forms (which is how most of them are set
up).

It uses sensible defaults, based on how we most-commonly configure
forms:
- most of our forms are `post`ed (but this can be overridden)
- `autocomplete` should only be enabled where it makes sense, otherwise
  it’s more annoying than useful (but this can be overriden)
- we should never be using HTML5 form validation because our own error
  styles and messages are better
2018-09-19 12:43:15 +01:00
Alexey Bezhan
e3a0adc293 Use per-service data retention period to display notifications page
Uses the configured service data retention page to display retention
period length, notification counts and fetch notifications from the
API on the notifications page.
2018-08-13 17:07:49 +01:00
Chris Hill-Scott
d2fc613270 Put counts back on notifications page
We think there is some need for users who don’t need to see the
dashboard to quickly find out which messages have failed.

So this commit brings back the status filters for all users (previously
those with ‘basic view’ wouldn’t have had them).

This makes it less of a drastic change when the `view_activity`
permission is removed from a user.
2018-08-09 11:56:16 +01:00
Chris Hill-Scott
b946a6008d Add H1 to sent messages page
> Suggest making the H1 visible here for consistency, but also to make
> it clear to users what they’re looking at.

> This screen is similar to – but not exactly the same as – the
> individual text, email and letter dashboard screens from Admin view,
> so the H1 could help to distinguish it from them for users who may
> have interacted with both.
2018-07-13 17:02:27 +01:00
Chris Hill-Scott
3902d0a05c Hide ‘7 days’ paragraph from basic view
It looks too prominent as a paragraph on the page. This commit moves
the info about how long we keep data for into the ‘empty’ message we
show when there are no results (ie the message people will see if they
search for something that was sent more than 7 days ago).
2018-07-10 17:08:02 +01:00
Chris Hill-Scott
199c699e11 Hide download all link in basic view
Can’t think of a good reason why someone who is only sending messages
would need a download of all the messages their entire team has sent.

Most of the ‘caseworking’ teams have been getting on fine without this
link; it’s only recently we brought it back.
2018-07-10 15:59:24 +01:00
Chris Hill-Scott
883f51b823 Fix page title on sent messages 2018-07-05 11:53:42 +01:00
Chris Hill-Scott
e3e9333840 Remove counts from sent
Counts of sending/failed/delivered are ‘management information’ or
‘reporting’. We don’t think that caseworkers need to see this
information.

The idea of the caseworking view is to remove stuff that caseworkers
don’t need to see.
2018-07-05 11:53:42 +01:00
Chris Hill-Scott
b0cb9ff58e Add sent notifications page for caseworkers
The other task that caseworkers have to do (much less often than sending
messages) is look at the messages which they’ve sent. The reason for
doing this is usually to find a specific message which someone has
complained about.

This commit adds:
- a page where they can do that
- a navigation item so they can get to that page

We reckon that because this is about finding specific messages, not
reporting that it’s fine to mush all the channels (email, text, letter)
into one table.
2018-07-05 11:53:42 +01:00
Rebecca Law
72b0637f92 Add the download activity link for notifications.
This works locally for a long running request and a large number of messages. However I suspect that nginx may be timing out the request. I'd like to try this on staging.
2018-06-25 16:29:40 +01:00
Chris Hill-Scott
9aa4a7267a Use <button> not <input>s for form submission
Both `<button type='submit'>Submit<button>` and
`<input type='submit' value='Submit'>` can be used to submit a form.

We have historically[1] used `<input>` because it’s better-supported by
IE6 in that:
- the `submit` attribute is mandatory on `<button>`, not on `<input>`
- the `innerHTML` of a button will be submitted to the server, not the
  value (as in other browsers)

Reasons to now use `<button>` instead:
- IE6/7 support is no longer a concern (especially with deprecation of
  TLS 1.0 on the way)
- Because an `<input>` element can’t have children, the pseudo-element
  hack[2] used to ensure the top edge of the button is clickable doesn’t
  work. We’re seeing this bug[3] affect real users in research.

1. We inhereted our buttons from Digital Marketplace, here is me making
   that change in their code:  8df7e2e79e (diff-b1420f7b7a25657d849edf90a70ef541)
2. 24e1906c0d (diff-ef0e4eb6f1e90b44b0c3fe39dce274a4R79)

3. https://github.com/alphagov/govuk_elements/issues/545
2018-02-01 13:53:45 +00:00
Rebecca Law
86d1df2a31 Gunicorn will timeout a process after 30 seconds.
The marshmallow schema takes too long, we need to fix the performance of that first.
2018-01-17 12:47:15 +00:00
Rebecca Law
8a026dfdeb The downloading of the CSV is working for as many as 190, 000 notifications.
This PR re-enables the download link and filters the notifications by templates type.
2018-01-15 12:29:03 +00:00
Katie Smith
7386d5ec1c Fix 500 error from notifications/letter.json page
The letters notification page makes ajax calls to update the status - these
were failing because it's making a POST request without a CSRF token.
(The email and SMS notification pages contain a search form that includes
the hidden CSRF input, so this was only occurring with the letters
page.)

This commit adds a hidden form for the letters page which just contains
the CSRF token.
2018-01-15 09:21:12 +00:00
Rebecca Law
135b0ad131 Revert download link.
There is some inconsistencies about how it is working, that needs to be solved.
2018-01-12 16:15:53 +00:00
Rebecca Law
259db9c271 Put the download csv link on the activity page.
Still needs some tests, probably some refactoring as well.
2017-12-30 16:54:39 +00:00
Chris Hill-Scott
57ca2b48ee Add extra letter spacing to phone number search
This is another place where you might be transcribing a phone number and
having it spaced out will make it easier for you to spot errors.
2017-10-31 17:54:22 +00:00
chrisw
43395bc9d9 Added letters info to service / admin dashboard & activity page 2017-10-03 10:28:34 +01:00
Chris Hill-Scott
7411256fc2 Add hidden form to re-post AJAX requests
Serializing the search box form is bad, because the AJAX thing submit
any changes that the user makes to the contents of the box. This results
in unexpected behaviour.
2017-06-14 16:25:20 +01:00
Chris Hill-Scott
681cea1d34 Make AJAX requests on activity page POST not GET
See parent commit for the reason we’re doing this.

Currently our AJAX requests only work as `GET` requests. So this commit
does a bit of work to make them work as `POST` requests. This is
optional behaviour, and will only happen when the element in the page
that should be updated with AJAX has the `data-form` attribute set. It
will take the form that has the corresponding `id`, serialise it, and
use that data as the body of the post request. If not form is specified
it will not do the serialisation, and submit as a `GET` request as
before.
2017-06-13 12:15:04 +01:00
Chris Hill-Scott
e65dcbe199 Make search by recipient form POST not GET
Phone numbers and email addresses are showing up in URLs where we let
users search for sent notifications by phone number or email address.

`GET` requests put the form data as a query string in the URL. This is
problematic when people are searching by a recipient’s phone number or
email address, because the URL may show up:
- in our server logs
- in our analytics
- in the user’s browser history

This is bad because these are all places where we don’t want
people’s personal information. It’s not too bad when this is happening
a handful of times. But it would be bad if we kept aggregating this
information because it would allow us to track users across services.

So, while it’s not especially RESTful, it’s better for the search form
to submit as a `POST` request. This way the phone number or email
address goes in the body of the request and does not show up in the URL.
2017-06-13 12:15:03 +01:00
Chris Hill-Scott
b9bf18b936 Add a form to filter notifications by recipient
Because manually editing the URL isn’t a great user interface, this
commit adds a search field to do this on the user’s behalf.

For this pass at the story it doesn’t do any validation – the user will
just get no results if they search by something which isn’t a phone
number or email address.

If the user navigates to a different ‘bucket’ of notifications (eg
delivered, failed) then the search term is reset, because they’ve
changed the filter which is at a level above the search term.
2017-05-30 15:11:34 +01:00
Chris Hill-Scott
f41830e5d3 Add query string parameter to search by recipient
> Service teams that use the admin interface often need to know the
> outcome of a message... at the moment they have to page through all
> the results in the activity stream. They should be able to find
> notifications by email address or phone number.

– https://www.pivotaltracker.com/n/projects/1443052

This commit adds an additional query string parameter (`to`) to the URL,
which users can use to filter down the list of notifications.

It:
- takes the status into account
- doesn’t update the counts based on the search term (in reality each
  service will only send a handful of notifications to one person in any
  7 day period)

In other words the funnel that filters down the notifications looks
like:

> all notifications for service → only failed → only to this phone
> number
2017-05-30 15:06:56 +01:00
Chris Hill-Scott
135ff1ee77 Include service name in page <title>
In pages specific to a service (e.g. dashboard and sub pages) the title
needs to distinguish which service it applies to. This is mainly to give
context to screen reader users who could be managing multiple services.

Implementing this uses template inheritance:

`page_title` includes `per_page_title` includes `service_page_title`

‘GOV.UK Notify’ is inserted into every page title.

Pages that set `service_page_title` get the service name inserted too.
2017-02-14 11:53:53 +00:00
Chris Hill-Scott
3069858a9f Fix pagination on activity page
The activity page was AJAXified in
https://github.com/alphagov/notifications-admin/pull/952 but this
didn’t take pagination into account.

So if you visited page 2, the contents of the page would be replaced by
Javascript with the contents of page 1. So you’d never be able to see
anything beyond page 1, expect for a brief fraction of a second when the
page loaded.

This commit makes sure the AJAX request uses whatever page parameter is
in the URL of the original page.
2016-09-30 15:41:46 +01:00
Chris Hill-Scott
d9eac94f1e Make the activity page update with AJAX
The activity page looks the same as the job page. So it should behave
the same and not need manually refreshing to see the new stuff.
2016-09-27 15:34:47 +01:00
Chris Hill-Scott
0d936e373a Removed repeated if statements 2016-09-27 13:24:48 +01:00
Chris Hill-Scott
6c961cc792 Remove date table field type
No longer used anywhere.
2016-09-13 10:37:38 +01:00
Chris Hill-Scott
95506e7c3b Refactor notification status into its own field type 2016-09-13 10:37:38 +01:00
Chris Hill-Scott
17d5af1a6e Show delivery time even for failed notifications
We reckon it’s probably still useful.
2016-09-13 10:37:38 +01:00
Chris Hill-Scott
2d7ed4d34f Fix overlapping text on tables of notifications
This commit changes the tables of notifications from 3 columns to two
columns. This is so the text has more room, so it doesn’t start
overlapping.

It also makes sure that if the recipient gets really long that it will
be cut off with an ellipsis, rather than overlapping…

I hypothesize that if a notification fails you probably don’t care when
it failed, just that it failed.
2016-09-13 10:37:38 +01:00
Chris Hill-Scott
4342b721f1 Show upcoming jobs on the dashboard
On the dashboard:
- adds a new ‘in the next 24 hours’ section to the dashboard which lists
  upcoming jobs
- tweaks some spacing on the dashboard so that it doesn’t look like too
  much of a mess
- don’t show scheduled jobs in the table of normal jobs

On the jobs page:
- don’t show scheduled jobs
2016-08-31 16:58:43 +01:00
Chris Hill-Scott
01bb2ada0a Don’t let _set_status_filters mutate original list
Mutating stuff is scary and prone to problems. Better for it to
return a new list instead.
2016-08-05 11:02:30 +01:00
Chris Hill-Scott
9e6111fd00 Make ‘download’ wording consistent
We changed this on the jobs page in
9a5fbca707

Missed doing it on the notifications page.
2016-08-05 10:59:49 +01:00
Chris Hill-Scott
940815b33c Tighten up spacing around download link 2016-08-05 10:59:49 +01:00
Chris Hill-Scott
5f67560b1e Link to failure reasons from job/activity pages
If something has failed and you don’t know why, you should be able to
find out why. Let’s try adding a link to the page explaining why, so
it’s not just buried in the footer.
2016-07-11 14:01:42 +01:00
Chris Hill-Scott
c3a060eb8f Fix incorrect width on empty tables
Empty tables shouldn’t have `table-display: fixed` because it stops them
filling the width of their container.
2016-06-15 09:56:45 +01:00
Chris Hill-Scott
e7e0b2f227 Put counts into the notification filters
We can filter notifications on the activity page by state.

This commit adds counts to those filters.

This is mainly so that we can consistently do the same thing on the job
page later on.
2016-06-14 11:00:56 +01:00
Chris Hill-Scott
e5d2514846 Make template graphs look consistent with page
The graphs of template usage feel a bit weird to me now.

1. They are counts of messages, but the numbers are very small
   not big like we do everywhere else (eg the counts on a job)

2. There’s a lot of blue, especially for something that you can’t
   click

This commit makes the numbers bigger and the bar chart grey.
2016-06-14 11:00:56 +01:00
Chris Hill-Scott
4077e2860d Fix display of spreadsheet tables
a9f79bcf07 made all tables have a `fixed`
layout. This causes issues with the spreadsheet-looking tables.

This commit treats tables with half-width first columns as the
exception, not the rule, and makes other tables display as before.
2016-06-13 10:26:01 +01:00
Chris Hill-Scott
c31762265c Colour code notification statuses
Makes the table easier to scan.

Delivered stays as before.

Sending is greyed out.

All other statuses are failure, and stand out by being red and bold.
2016-06-09 11:36:22 +01:00
Chris Hill-Scott
d213e2cc67 Give each row in a table a heading
The first columns of our tables are always headings for the
subsequent columns, even though they go horizontally.

HTML has the `<th>` tag, which doesn’t just have to be used for headings
along the top of a table. So this commit changes the first column to be
a `<th>`.

This then allows us to style these elements differently, specifically
making them 50% wide. This makes pages like the dashboard align more
nicely.
2016-06-09 11:36:22 +01:00
Chris Hill-Scott
b1852f4b78 Make permanent failure status more human
Replace with ‘Phone number doesn’t exist’ or ‘Email address doesn’t’
exist.
2016-06-09 11:36:21 +01:00
Chris Hill-Scott
0a337a2663 On the activity page, only link to template or job
If the notification has come from an API call, the template is the
only thing that exists

If it’s a job, then we need to tell you name of the file. But you can
click though to see the template.
2016-06-09 11:06:53 +01:00
Chris Hill-Scott
8d7850ead1 Use .csv extension not querystring parameter
The link to download a CSV of notifications looks like
`/endpoint?download=csv`. This not not very web idiomatic.

The service manual recommends:
> Only use query strings for URLs with unordered parameters like options
> to search pages.

The CSV is a different representation of the same data, it does not
perform searching or filtering on the data.

The proper way (as we do elsewhere in this app) is to put an extension
on the endpoint to indicate an alternate representation, eg
`/endpoint.csv`
2016-06-07 16:35:49 +01:00
Chris Hill-Scott
06903d54be Remove template type filter from activity
This commit splits the activity page into two pages, one for emails
and one for SMS.

Technically this means moving from having template type in the
querystring and putting in it the URL, eg:

*Before*:
`/services/abc/notifications/?template_type=sms`

*After*:
`/services/abc/notifications/sms`
This commit changes the activity page to only have controls
2016-06-07 16:35:49 +01:00
Chris Hill-Scott
5b5ad2c5dc Fix 500 on job page when notifications are sending
Sending notifications don’t have an `updated_at`. This causes the time
formatting to throw a wobly, because it doesn’t expect `None`.

This commit changes the template to also look for the `created_at`,
which all notifications have.
2016-06-06 13:53:49 +01:00
Rebecca Law
6c14d925c5 Fix test to use a real status 2016-05-18 12:05:26 +01:00
Adam Shimali
a20fc1aa47 If user clicks failed or both filters for notifications status view,
append all other failure states to query to api.
2016-05-18 11:44:58 +01:00