Commit Graph

12091 Commits

Author SHA1 Message Date
Ben Thorner
39e03cee50 Remove redundant 413 error page
This was used when there was an Nginx instance sitting in front of
Admin [1], but nowadays traffic goes through CloudFront, where we
decided not to implement the same protection:

- The likelihood of large requests being a security threat is small
because it's a difficult attack vector.

- We have put in place specific limits on routes where we the size
of the request is actually important [2].

Note that the other error pages can all still be used based on the
response code we get from API requests [3]. Also worth noting we've
had 0 413 response codes for Admin in the last month.

[1]: https://github.com/alphagov/notifications-aws/blob/master/ansible/roles/nginx/templates/nginx.conf.j2#L29-L30
[2]: https://github.com/alphagov/notifications-admin/pull/4090
[3]: b3c0abc496/app/__init__.py (L407-L416)
2021-12-09 14:48:34 +00:00
Chris Hill-Scott
787cb3ef1f Merge pull request #3994 from alphagov/update-utils-coordinate-transformation
Update utils to bring in coordinate transformation
2021-12-07 11:07:07 +00:00
Ben Thorner
af8cec2f84 Merge pull request #4085 from alphagov/fix-contact-list-validation-177535141
Fix not showing errors for invalid contact uploads
2021-12-02 10:19:20 +00:00
Ben Thorner
c0da7a27ed Fix not showing errors for invalid contact uploads
This code should behave the same way as other CSV uploads [1],
but we had to write it in a hurry [2] and the way we show an
error with the upload field was based off that for PDF uploads,
where we show custom button text instead of an error [3].

This fixes the inconsistency, so that we see the same errors
for CSV uploads here as in other parts of the app.

[1]: 6b52735dac/app/templates/views/send.html (L25)
[2]: 1c02476ee7 (diff-aedd12af78c9737f1c3344d2afbb9c00878eccbcc754b2b3d9e6864c2ad2f7c3R32)
[3]: 3b3f74bbf0
2021-12-01 16:59:30 +00:00
Chris Hill-Scott
6a3aba3bc5 Store CRS to avoid costly lookup
Looking up the coordinate reference system for a given polygon’s bounds
is surprisingly expensive.

We can make things run faster by precomputing it at the time of
generating the simplified polygons, then storing it in the SQLite
database alongside the polygon data.
2021-12-01 14:10:55 +00:00
Chris Hill-Scott
0cf443e9a6 Use already-transformed polygons wherever possible
Transforming full resolution polygons to linear coordinates is somewhat
expensive. We can make things run faster by:
- looking at `simple_polygons` which have fewer points and are therefore
  faster to transform.
- reusing polygons that have already been transformed where possible
2021-12-01 14:10:55 +00:00
Chris Hill-Scott
6cb326f153 Update utils to do linear transformation of polygons
Brings in https://github.com/alphagov/notifications-utils/pull/889/files

At the moment, we are not doing any transformation of features before
applying geometric algorithms to them. This is, in effect, assuming that
the earth is flat.

This new version of utils implements the transformation of our polygons
to a Cartesian plane. In other words, it converts them from being
defined in spherical degrees to metres.

For the admin app this means we need to convert places where the code
expects things to be measured in degrees to work in metres instead.
2021-12-01 14:10:54 +00:00
karlchillmaid
6b52735dac Merge pull request #4076 from alphagov/update-roadmap
Update roadmap content
2021-12-01 09:55:58 +00:00
karlchillmaid
4010888571 small content change 2021-11-30 19:15:52 +00:00
Chris Hill-Scott
80b645eb8a Merge pull request #4083 from alphagov/bump-wtforms
Bump WTForms and Flask-WTF to latest versions
2021-11-30 18:18:31 +00:00
karlchillmaid
00e97e166a Update content
Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2021-11-30 18:12:19 +00:00
karlchillmaid
89a86b04dd Add missing </a> tag
Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2021-11-30 18:12:07 +00:00
Chris Hill-Scott
b74fcf2570 Bump WTForms and Flask-WTF to latest versions
WTForms versions less than 3.0.0 have a security vulnerability where
arbitrary HTML can be inserted into the label of a form, allowing the
possibility of a cross-site scripting attack.

I don’t know if there’s anywhere we put user-generated content into form
labels but it’s possible we are vulnerable somewhere.

This require moving some imports because as of
https://github.com/wtforms/wtforms/pull/614/files
there is no longer a separate module for HTML 5 fields, they are now
considered core fields.

As of https://github.com/wtforms/wtforms/issues/445/files custom
implementations of `pre_validate` or `post_validate` must raise
`ValidationError` to trigger a validation message, where we were raising
`ValueError` this was no longer being caught.

As of https://github.com/wtforms/wtforms/pull/355/files `StringField`
returns `None` for empty data, not `''` but our `validate_email_address`
function only accepts strings.
2021-11-30 17:33:13 +00:00
karlchillmaid
cae17bac9d Fix date 2021-11-30 16:40:42 +00:00
karlchillmaid
9c935ef5b9 Add inset text html 2021-11-30 16:40:03 +00:00
karlchillmaid
8f82a8748c Add ID 2021-11-30 16:38:57 +00:00
karlchillmaid
4fa900eb26 Update figures 2021-11-30 15:45:10 +00:00
karlchillmaid
68e0327901 Update ‘things we’ve done’ 2021-11-30 13:54:29 +00:00
karlchillmaid
01cd97b639 Update the order of the things 2021-11-30 13:36:28 +00:00
karlchillmaid
0018ef79b4 fix paragraph formatting
Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2021-11-30 12:53:26 +00:00
karlchillmaid
9277adab48 Fix links
Swap dashes for underscores and add `main.`
2021-11-30 12:30:05 +00:00
karlchillmaid
47aaeaf05a update link 2021-11-30 12:23:35 +00:00
karlchillmaid
3c4dc1ef46 Update app/templates/views/roadmap.html
Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2021-11-30 12:22:22 +00:00
karlchillmaid
0c7c7d16de Add ‘What we’ve done’ section 2021-11-30 09:03:58 +00:00
Chris Hill-Scott
5e8d0623de Merge pull request #4074 from alphagov/no-egg
Don’t put version number in requirements twice
2021-11-26 14:54:37 +00:00
Chris Hill-Scott
5a96daa307 Merge pull request #4080 from alphagov/remove-sms-allowance-remainder-org-report
Remove free text allowance remaining column from organisation report
2021-11-26 10:59:44 +00:00
Chris Hill-Scott
c9767fc179 Remove free text allowance column from org report
We think that the API is returning incorrect data for this column.

It’s going to take a while to figure out what’s going on with the
queries in the API, so this pull request temporarily removes the column
so we’ve not giving people incorrect data.
2021-11-25 18:08:31 +00:00
David McDonald
64515555a8 Merge pull request #4079 from alphagov/2dp-performance-page
Change performance stats to be 2 decimal places
2021-11-25 16:12:11 +00:00
David McDonald
30330d86b1 Change performance stats to be 2 decimal places
We are starting to see lots of 100.0%s in the current table
and we think this looks suspiciously too good so think it is
beneficial to change it to be 2dp such that we get a few more
non 100.0% values.

This will put all the values in to having 2dp, however it will
also require the API to have a change to
https://github.com/alphagov/notifications-api/blob/master/app/performance_dashboard/rest.py#L81
where it is currently losing the granularity down to a single
decimal place (meaning that if we were really at 99.894% then that
would be shown on the page as 99.90% rather than 99.89%). However,
I don't think it is a blocker that we get that sorted before this
can be merged.
2021-11-25 14:49:38 +00:00
Chris Hill-Scott
adcd1d3e3e Merge pull request #4075 from alphagov/change-send-button-content
Update ‘Send’ button content
2021-11-25 14:42:29 +00:00
Chris Hill-Scott
88046daf8e Merge pull request #4078 from alphagov/2dp-money-org-report
Format monetary values to two decimal places in organisation usage report
2021-11-25 10:51:38 +00:00
Chris Hill-Scott
5c33fbd48a Format monetary values to two decimal places
This means that the data in the report will match what’s on the page,
where the values are rounded to the nearest penny.

This uses the same string formatting to round the numbers which the
`big_number` component does, so it should round the numbers in the same
way.
2021-11-25 10:34:18 +00:00
Chris Hill-Scott
0eb967bb7c Refactor into list expression
This is maybe a bit of personal preference but generally I find list
expressions a bit more Pythonic that `append`-ing.
2021-11-25 10:30:23 +00:00
Chris Hill-Scott
0e13cda9e5 Split out unit and monetary columns
This is so we can treat them slightly differently later on.
2021-11-25 10:30:05 +00:00
Chris Hill-Scott
3df49acb73 Add test coverage for link button on template page 2021-11-24 16:35:34 +00:00
karlchillmaid
77991b5893 Update roadmap content 2021-11-24 16:15:02 +00:00
karlchillmaid
90a959463f Update ‘Send’ button content 2021-11-24 15:10:21 +00:00
Chris Hill-Scott
1aa79eb9a6 Don’t put version number in requirements twice
It’s a pain having to remember to update both of them. Looks like `pip`
now supports a different syntax without the `egg` bit which means a git
dependency only needs the version number changing in one place.
2021-11-23 11:27:12 +00:00
Pea Tyczynska
ded7fa524f Merge pull request #4071 from alphagov/downloadable-org-use-report
Add downloadable report for org usage
2021-11-23 11:10:53 +00:00
Pea Tyczynska
47e303b8c3 Add downloadable report for org usage
This is so org level users can use this data easier for things
like determining spending per service.

We do not include sms fragments sent column and remove other sms columns

consistency.

Do not add sms fragments sent column for now until we agree on an
unambiguous name for it. The data in this column is sms billing units
multiplied by international sms weighing. My favourite for a clear
name would be 'text message credits used', but we need a naming
strategy for this.
2021-11-23 10:57:48 +00:00
Tom Byers
d00d13fc2d Merge pull request #4068 from alphagov/fix-map-key-in-high-contrast
Fix map key in high contrast
2021-11-18 14:36:50 +00:00
Tom Byers
2e53a2b6f8 Add GOVUK visually hidden style for map key
The sentences in the key to the map have 2 forms:
1. the visual form, with an graphic pattern
   alongside text saying what the pattern means
   in the map
2. the semantic form, with text describing what
   the pattern means and how big an area it covers
   for this alert

This is achieved by making the graphic
non-semantic and having hidden words in the
sentence for each paragraph.

While the spaces between words are correct for
both forms of these sentences, we observed screen
readers speaking some groups of words as one when
they spoke the sentence. Most noticably, 'the
alert' was spoken as 'thealert'.

Swapping the class used to hide the visually
hidden words from ours to the GOVUK one seemed to
fix this. It's unclear why it does but the
`govuk-visually-hidden` class adds the following
styles to those in ours:
- width: 1px
- height: 1px
- white-space: nowrap

It also has `margin: 0` instead of `margin: -1px`.
2021-11-18 11:40:37 +00:00
Tom Byers
bc22c206b9 Make images in key of map SVGs
At the moment, the icons in the key of the map
showing what each type of area drawn on the map
means change colour in high contrast mode. This
causes a mismatch between the areas on the map and
the key.

These changes remake the images in SVG to prevent
the colours changing in high contrast modes. They
also add a white background to the icons, to make
sure they match the areas they refer to in the
map.
2021-11-18 11:40:36 +00:00
Tom Byers
c82b78941e Merge pull request #4067 from alphagov/high-contrast-issues-alerts-pages
High contrast issues alerts pages
2021-11-18 11:39:27 +00:00
Chris Hill-Scott
d84fbc9f72 Merge pull request #4070 from alphagov/install-pyproj
Check that PyProj can be installed on PaaS
2021-11-18 08:56:22 +00:00
Pea Tyczynska
00a629befc Link to downloadable report for org usage
Link is sticky so that it is easy to spot even when
an org has many services.
2021-11-17 17:58:06 +00:00
Chris Hill-Scott
89de57c521 Check that PyProj can be installed on PaaS
Previously when trying to bring in
https://github.com/alphagov/notifications-utils/pull/889 we had trouble
because there were no wheels available for the version of Pip that we
were using. Now that we have upgraded to Python 3.9 we are using a
newer buildpack which should have the necessary wheels available.

This commit is just installing the package and nothing else, to give us
more confidence that we can merge
https://github.com/alphagov/notifications-utils/pull/915/files without
having to subsequently revert it.
2021-11-17 09:54:04 +00:00
Chris Hill-Scott
223b275507 Merge pull request #4010 from alphagov/refactor-duplicate-method
Refactor `get_simple_polygons` method for reuse
2021-11-15 11:21:50 +00:00
Chris Hill-Scott
47797cf686 Merge pull request #4034 from alphagov/refactor-services-models
Refactor services and organisations models for users
2021-11-15 11:21:43 +00:00
Chris Hill-Scott
0c2b586e40 Make organisations natively sortable 2021-11-11 14:59:06 +00:00