Commit Graph

7170 Commits

Author SHA1 Message Date
Chris Hill-Scott
14de80ac34 Merge pull request #692 from alphagov/python-3.4-unpacking
Python 3.4 unpacking
2016-06-16 10:43:54 +01:00
Chris Hill-Scott
bc3dc94392 Make Travis use same Python version as our boxes
Our boxes are running Python 3.4.3. Travis was set to use 3.5. This is
bad because it means that tests can pass on Travis but then the app can
fail to start.
2016-06-16 10:15:05 +01:00
Chris Hill-Scott
c544e1a830 Fix unpacking syntax for Python 3.4
Python 3.5 introduced the ability to do unpacking before keyword
arguments, eg
```
my_method(**dictionary, foo=bar)
```

This was introduced in https://www.python.org/dev/peps/pep-0448/

This is not valid syntax in Python 3.4, which is what’s running on our
boxes.

This commit changes an instance of this syntax which was introduced in
56d9c29e91
2016-06-16 10:10:36 +01:00
Chris Hill-Scott
1b2add0349 Merge pull request #687 from alphagov/add-failure-rate-to-jobs
Highlight failing jobs on the dashboard
2016-06-16 09:13:33 +01:00
Chris Hill-Scott
56d9c29e91 Highlight failing jobs on the dashboard
> When we have jobs that have over 3% failure rates we should highlight
> those so that peoples attention is drawn to deal with the failure.
>
> They would then go to the job view to see what the details are where
> they could filter by failure, but that's a different story...
>
> This is just about calculating and highlighting those that need their
> attention.

— https://www.pivotaltracker.com/story/show/121206123

This commit:

- calculates the failure rate for each job
- makes jobs with a failure rate of > 3% go red on the dashboard
2016-06-15 10:25:48 +01:00
Chris Hill-Scott
9eb777b867 Merge pull request #688 from alphagov/fix-empty-table-width
Fix incorrect width on empty tables
2016-06-15 10:14:06 +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
f57f004687 Merge pull request #676 from alphagov/big-number-no-show-more
Remove ‘show more’ from big number pattern
2016-06-15 09:51:22 +01:00
Chris Hill-Scott
eed11ea561 Remove ‘show more’ from big number pattern
This isn’t used anywhere.
2016-06-15 09:44:18 +01:00
Chris Hill-Scott
18578af75c Merge pull request #686 from alphagov/no-jump-email
Stop page jumping on first load with a long email
2016-06-15 09:38:56 +01:00
Chris Hill-Scott
7a7fe7fec1 Merge pull request #681 from alphagov/tables-of-notifications
Make dashboard and activity pages consistently clickable
2016-06-15 09:37:35 +01:00
Chris Hill-Scott
ee8ad47e29 Merge pull request #685 from alphagov/delete-template-bug
fix bug - calling wrong template_statistic endpoint causing 500 error…
2016-06-15 09:37:29 +01:00
Chris Hill-Scott
66a33e4e47 Stop page jumping on first load with a long email
A long email message needs to be collapsed to only show the first few
lines. The problem is that we were doing this by adding a class with
Javascript, meaning that the email wasn’t being collapsed until the
script in the footer ran.

This caused a jump in the page because the browser was painting the
whole email message, then repainting it once it was collapsed.

This commit takes advantage of the `.js-enabled` class added to the
`<body>` by a script in the `<head>` of GOV.UK template.

This means that the email message is collapsed with CSS before the first
paint of the page, so no jump.

This introduces some complexity in how we determine which emails get the
expander toggle. Because they’re already collapsed we can’t get their
height and work out if they’re long enough to need collapsing.

So we need to take a copy of the message, put it off-screen, expand it,
get its height, then remove it from the DOM. Bit of a faff.

Because of this there’s still a quick flash of the toggle if you see an
email message that’s too short to need collapsing. I think this is the
lesser of two evils—very short email messages will be few and far
between in the real world.
2016-06-15 09:35:55 +01:00
Adam Shimali
e2b855e7ae Merge pull request #682 from alphagov/resend-verification-code
Resend verification code
2016-06-14 12:02:41 +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
Leo Hemsted
845fee69c4 fix bug - calling wrong template_statistic endpoint causing 500 error on delete
- also unrolled a test with a for loop into a parametrized test
2016-06-14 11:01:33 +01:00
Chris Hill-Scott
5f0dc749f5 Make the job page look close to the activity page
We can’t filter a job by notification status yet, but we can:

- put the download link in the same place
- make the table line up the same
2016-06-14 11:01:13 +01:00
Chris Hill-Scott
a0f6956eab Give headline numbers a blue, not black background
These numbers don’t look very clickable white-on-black.

Blue is the colour of links, so lets see if they are more clickable in
blue.

The same clicking-a-big-number thing is also happening on the activity
page, so this commit also changes the activity page to look the same.
2016-06-14 11:00:56 +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
minglis
d8c1a5ef8a Merge pull request #683 from alphagov/remove-download-link
Removed download link
2016-06-14 09:55:01 +01:00
Martyn Inglis
80d4c4e346 Removed download link 2016-06-14 09:47:23 +01:00
Adam Shimali
56c3401a39 Requesting a resend of verify code for a user that has not completed
registration will allow user to check and modify mobile number.

Registered (active) users will only be able to request resend to their
existing registered number.
2016-06-13 16:31:54 +01:00
Chris Hill-Scott
cdc900b7ef Merge pull request #675 from alphagov/fix-table-display
Fix table display
2016-06-13 11:39:08 +01:00
Chris Hill-Scott
ea10c313d9 Merge pull request #674 from alphagov/js-updater-update
Improve AJAX behaviour when server is slow/erroring
2016-06-13 11:31:38 +01:00
Chris Hill-Scott
281c54b80b Make job counters smaller
With sending, delivered and failed all on one line there’s not much
space. When these numbers get relatively big (in the 000s) they can
start mushing into each other.

This commit makes them smaller so that they remain separate.
2016-06-13 10:26:01 +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
5c5f504292 Merge pull request #673 from alphagov/all-versions-link
Link back to all template versions from 1 version
2016-06-13 10:24:11 +01:00
Chris Hill-Scott
40564df15e Link back to all template versions from 1 version
If you get linked to a single version of a template, you’re at a dead
end. Let’s add a link to go back up a level to where you can understand
the current version in context.
2016-06-12 14:35:58 +01:00
Chris Hill-Scott
33b18cedeb Revert "Comment out ajax queries to update content on frontend."
This reverts commit 651584d056.

Should be safe to turn the AJAX back on now it’s not going to
denial-of-service any slow pages.
2016-06-12 14:16:27 +01:00
Chris Hill-Scott
940170159a Handle AJAX errors when updating content
With the change in implementation in the previous commit, any error
(eg server responds with `500`) would cause the page to not be updated
again.

This is better than the previous implementation, whereby the browser
would re-request as fast as it could until it got a successful response.

This commit handles errors by clearing the render queue if the server
returns an error. So:

- Any updates that would have been performed based on this request are
  dropped
- Subsequent updates will be attempted as if it was the first load of
  the page, ie after a delay of `x` seconds
2016-06-12 14:16:27 +01:00
Chris Hill-Scott
9c92a2bd86 Stop AJAX updates queuing requests
The `updateContent` module updates a section of the page based on an
AJAX request.

The current implementation will poll every `x` seconds. If the server
takes a long time to respond, this results in a the browser queuing up
requests. If a particular endpoint is slow, this can result in one
client making enough requests to slow down the whole server, to the
point where it gets removed from the loadbalancer, eventually bringing
the whole site down.

This commit rewrites the module so that it queues up the render
operations, not the requests.

There is one queue per endpoint, so for
`http://example.com/endpoint.json`:

1. Queue is empty
```javascript
{
  'http://example.com/endpoint.json': []
}
```

2. Inital re-render is put on the queue…
```javascript
{
  'http://example.com/endpoint.json': [
    function render(){…}
  ]
}
```

…AJAX request fires
```
GET http://example.com/endpoint.json
```

3. Every `x` seconds, another render operation is put on the queue
```javascript
{
  'http://example.com/endpoint.json': [
    function render(){…},
    function render(){…},
    function render(){…}
  ]
}
```

4. AJAX request returns queue is flushed by executing each queued
render function in sequence
```javascript
render(response); render(response); render(response);
```
```javascript
{
  'http://example.com/endpoint.json': []
}
```

5. Repeat

This means that, at most, the AJAX requests will never fire more than
once every `x` seconds, where `x` defaults to `1.5`.
2016-06-12 14:15:04 +01:00
NIcholas Staples
50a81a96a3 Merge pull request #670 from alphagov/remove_ajax_calls
Comment out ajax queries to update content on frontend.
2016-06-10 14:00:50 +01:00
Nicholas Staples
651584d056 Comment out ajax queries to update content on frontend. 2016-06-10 12:31:35 +01:00
Chris Hill-Scott
6f0f91e9a7 Merge pull request #667 from alphagov/make-tables-line-up
Make tables line up
2016-06-09 13:25:19 +01:00
Chris Hill-Scott
04ef730fd1 Remove redundant if statement on job page
We had this if statement to lay out the table differently with and
without row numbers.

Since we don’t show row numbers at all, this isn’t needed.
2016-06-09 11:36:22 +01:00
Chris Hill-Scott
a9f79bcf07 Truncate items that don’t fit in the first column
The first column of a table is a heading, and will always be 50% wide.

It makes the table harder to scan when the information in the first
column breaks onto multiple lines, and introduces uneven whitespace in
the table.

This commit adds some CSS to force things in the first column to only
ever be one line. If they are too long to fit, they get truncated with
an ellipsis (`…`)
2016-06-09 11:36:22 +01:00
Chris Hill-Scott
2e8e650733 Put same info in both tables of notifications
We have tables listing notifications on:
- the job page
- the ‘activity’ page

Previously that had subtly different information, in a different order.
This commit makes them exactly the same.
2016-06-09 11:36:22 +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
Adam Shimali
d005406682 Merge pull request #661 from alphagov/invite-accepted-bug
Change when invite gets marked as accepted.
2016-06-08 13:32:20 +01:00
Chris Hill-Scott
29f8b94612 Merge pull request #657 from alphagov/make-activity-consistent
Make activity consistent
2016-06-08 12:57:07 +01:00
Pete Herlihy
94e88cf6f7 Merge pull request #647 from alphagov/placeholder-appearance
Make placeholders look more consistent and editable
2016-06-08 12:20:35 +01:00
Adam Shimali
0544ea776b Change when invite gets marked as accepeted. 2016-06-08 11:52:26 +01:00
Chris Hill-Scott
3d7f07493b Add filters for ‘processed’ and sending states
- _Processed_ is all the notifications that we know about, ie sending,
  failed and delivered

- _Sending_ is notifications that we have either put into a queue or are
  waiting to hear back from the provider about.

The big numbers on the dashboard are a count of all the messages we’ve
processed. So when you click them, the table of notifications you see
on the dashboard should contain that number of notifications.

This also gets the activity page one step closer to being like the job
page:

         | Before                     | After
---------|----------------------------|---------------------------------
Activity | Sending, failed, both      | Processed, sending, failed, delivered
Job page | Sending, failed, delivered | Sending, failed, delivered
2016-06-07 16:37:06 +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
e1b2999371 Move test for downloads CSV of notifications
Downloading a CSV of notifications is very similar to viewing them on
a webpage. So I think it’s sensible to move the assertions about the
CSV download link into the same test, rather than it being it’s own
test.

This means being able to reuse the parametrization introuced in this
commit’s parent.
2016-06-07 16:35:49 +01:00
Chris Hill-Scott
9b099d78c7 Make test for activity page more thorough
This commit paramaterizes the test for the activity page, so that it
checks all combinations of template type and notification status.
2016-06-07 16:35:49 +01:00