Commit Graph

2038 Commits

Author SHA1 Message Date
Chris Hill-Scott
721b80ffd8 Merge pull request #705 from alphagov/filter-test-messages-jobs
Filter test messages from jobs on the dashboard
2016-06-20 10:16:16 +01:00
Chris Hill-Scott
b7e58b0a5b Unroll unneccessary for loop 2016-06-20 10:07:37 +01:00
Chris Hill-Scott
7416070199 Refactor job conftests to eliminate temp variables
These tests were assigning something to a variable, then immediately
returning that variable. Why not just return the thing itself?
2016-06-20 09:31:29 +01:00
Chris Hill-Scott
8ca7832541 Filter test messages from jobs on the dashboard
While test messages technically have a file and are a job, there’s not
much reason to ever revisit them. So all they end up doing is cluttering
the dashboard and making it harder to find the actual files you’ve
actually uploaded from your computer.

So this commit:

- abstracts the name of test messages into config
- filters out any files whose filename represents a test message
- adds some more thorough tests for the jobs on the dashboard
2016-06-20 09:31:20 +01:00
Chris Hill-Scott
87a8906f1a Merge pull request #701 from alphagov/label-template-statistics
Add some words to the template statistics on the dashboard
2016-06-20 09:27:28 +01:00
Chris Hill-Scott
4c5622a019 Merge pull request #700 from alphagov/tour-into-templates
Redirect to the templates page after the tour
2016-06-17 16:35:00 +01:00
Chris Hill-Scott
5a95f4a7dd Tighten up spacing for better visual grouping 2016-06-17 16:30:02 +01:00
Chris Hill-Scott
077e90d4ff Say templates ‘used’ instead of templates ‘sent’
You _use_ a template to _send_ a message
2016-06-17 16:30:02 +01:00
Chris Hill-Scott
fa7345e9d0 Make template statistics on the dashboard a table
It was a `<dl>` before which is kinda weird. Especially when the jobs
table was a real `<table>`.

It also means we can give it column headings so that new and invited
users have a better idea of what it is.
2016-06-17 16:30:02 +01:00
Chris Hill-Scott
fb6cf3b3f4 Removed unused get template call 2016-06-17 16:15:51 +01:00
Chris Hill-Scott
d01039b9c7 Merge pull request #699 from alphagov/rearrange-breaking-change
Reorder the breaking change page
2016-06-17 16:10:18 +01:00
Leo Hemsted
c3da63975f Merge pull request #698 from alphagov/sign-in-redirect
when not logged in, redirect to sign-in
2016-06-17 15:39:48 +01:00
Chris Hill-Scott
a6ad829947 Redirect to the templates page after the tour
When you’re dropped straight into the ‘edit template’ page it’s still
a bit confusing what the thing you’re typing is—the mental model isn’t
quite there yet.

I think it will help (rather than redirect to the dashboard) to redirect
to the choose template page. You can then choose to edit the example or
add your own template.

This should help people understand that the example is one of a number
of templates that you create.
2016-06-17 14:32:32 +01:00
Chris Hill-Scott
1d68aa87ea Reorder the breaking change page
The table on this page looked too much like something you were supposed
to interact with. To understand what’s expected of you from this page,
you need to know:

- what you’ve done to make this page happen (you changed some stuff)
- what actions are available now (confirm, back)

The rest of the information is supplemenatary—it helps you make a
descision, but it’s not key to understanding what the decision _is_.

This also matches what we do on the upload file page, where the
non-essential example is under the button.
2016-06-17 14:24:00 +01:00
Leo Hemsted
539950d772 when not logged in, redirect to sign-in
parts of the initial setup/login stages were throwing 500s if user
not already in process (ie: user directly navigated to url):
* /resend-email-verification
* /text-not-received
* /send-new-code
* verify
2016-06-17 13:53:48 +01:00
Chris Hill-Scott
7be111d260 Merge pull request #694 from alphagov/failure-rate-jobs-page
Highlight failure rate on the jobs page
2016-06-16 15:14:41 +01:00
catherineheywood
038cc9cde4 Add fields: body, template_version, subject
Add descriptions for fields  body, template_version, subject for response to POST, update coding example.
Replace single ' with double " in coding examples.
2016-06-16 11:58:45 +01:00
Chris Hill-Scott
4bc1cad416 Highlight failure rate on the jobs page
Forgot to do this as part of
56d9c29e91
2016-06-16 11:06:57 +01:00
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