Commit Graph

9975 Commits

Author SHA1 Message Date
Chris Hill-Scott
773f0b9ce7 Add search form
There can be lots of areas in a library, for example local councils. So
when there is, let’s allow people to do the find-as-you-type thing we
support in lots of other places.
2020-07-08 10:28:14 +01:00
Chris Hill-Scott
29ad5cf510 Add a form for choosing areas
Picking multiple areas at once definitely feels like a need, so let’s
make them checkboxes.
2020-07-08 10:28:04 +01:00
Chris Hill-Scott
49444221e9 Style the area labels and polygons
Gives them some colours, borders and stuff to make them visually
consistent with the rest of Notify.

The idea is the tags and polygons have a similar affordances (i.e.
border thickness, colour) to visually link them and imply that they are
two representations of the same thing.
2020-07-08 10:27:57 +01:00
Chris Hill-Scott
d0d3fc6857 Add a map
So you can check you’ve chosen the right areas, and to give you a clear
idea of where the boundaries of an area are.

The Javascript and CSS for the map is only loaded on this page because
it adds quite a few kb, and we don’t want to be sending assets to the
majority of our users who will never see them.
2020-07-08 10:27:50 +01:00
Chris Hill-Scott
18d464d4f0 Add some views for selecting broadcast areas
These are just so we have some pages to click through for now. They
don’t use real templates, or any of the broadcast stuff from the
database.

But I think it’s useful to get some skeleton pages in first so that we
can see the map etc working in production, then build on that, without
having to do it all in one mega PR.

For that reason there are two short term things I’ve done in this commit
which should be revisited soon:
- no tests for the endpoints
- data about which areas are selected is stored in the session
2020-07-08 10:27:42 +01:00
Chris Hill-Scott
b833d83205 Merge pull request #3503 from alphagov/bump-utils-40.2.1
Bump utils to 40.2.1
2020-07-06 09:58:27 +01:00
Chris Hill-Scott
c4458efa21 Bump utils to 40.2.1
Brings in:
- re-usable `SerialisedModel`
- speed improvements to processing CSVs against email templates

I chose not to rename `JSONModel` or `ModelList` to keep the diff nice
and small.
2020-07-06 09:39:54 +01:00
Chris Hill-Scott
98eb3c61f6 Merge pull request #3498 from alphagov/add-broadcast-template
Allow adding broadcast templates
2020-07-06 09:06:16 +01:00
David McDonald
7e154ff408 Merge pull request #3497 from alphagov/revert-3496-revert-3495-statsd-to-prometheus
Revert "Revert "Statsd to prometheus""
2020-07-03 15:59:42 +01:00
Chris Hill-Scott
01ec2ad9c7 Add template type hint on choose page 2020-07-03 15:47:29 +01:00
Chris Hill-Scott
e832d18002 Make error message specific to template type 2020-07-03 15:46:00 +01:00
Chris Hill-Scott
f3115c0cea Remove redundant line 2020-07-03 14:52:38 +01:00
Chris Hill-Scott
dad025c21b Merge pull request #3501 from alphagov/add-leaflet-js
Add Leaflet.js for rendering slippy maps
2020-07-03 14:31:55 +01:00
Chris Hill-Scott
9ff7b85d04 Merge pull request #3502 from alphagov/serivce-permission-decorator
Add service permission decorator
2020-07-03 14:31:15 +01:00
Chris Hill-Scott
dd2b737d24 Use service_has_permission decorator on inbox
This proves that the decorator works, because the inbox code is already
tested:
bad1e69cc3/tests/app/main/views/test_dashboard.py (L353-L367)
2020-07-03 10:12:55 +01:00
Chris Hill-Scott
d4627a2f3a Add service_has_permission decorator
Similar to how we can restrict routes to only users with a given
permission, this new decorator lets us restrict routes to services that
have a given permission.

Having this is a decorator is cleaner than putting if statements inside
the endpoint code.
2020-07-03 09:56:11 +01:00
Chris Hill-Scott
8e1c75883a Add Leaflet.js for rendering slippy maps
Leaflet seems to be the go-to library for rendering maps these days. It
will be useful for the broadcast work.

This commit add the leaflet Javascript and CSS to our asset pipeline.
The Javascript is already minified so all we need to do is copy it. The
CSS is uncompressed so we put it through the same pipe as our other
stylesheets.

I’m keeping these as separate files because they’re quite heavy (or the
JS is at least – 38kb minified) so I want them to only be loaded on the
pages where they’re used. Most users of Notify will never need to see a
map.
2020-07-03 09:53:41 +01:00
Pea M. Tyczynska
bad1e69cc3 Merge pull request #3499 from alphagov/hint-text-org
When changing service name, use organisation of the service for hint
2020-07-02 12:24:51 +01:00
Pea Tyczynska
e1f1f2a9c2 When changing service name, use organisation of the service for hint
text if available. If service is not attached to any organisation yet,
use default org for the user.
2020-07-02 12:01:48 +01:00
Pea M. Tyczynska
0ad449883d Merge pull request #3484 from alphagov/add-service-name-hint-text-for-local-authorities
Add service name hint text for local authorities
2020-07-02 10:11:34 +01:00
Chris Hill-Scott
724e8d1838 Make it possible to preview a broadcast template
At the moment this won’t look like much, but it will let us do an
end-to-end run of adding a broadcast template.

At the moment all you can do with a broadcast template is edit it, so
there’s no ‘Send’ link on the page.
2020-07-01 17:49:55 +01:00
Chris Hill-Scott
154d4bdb85 Allow adding broadcast templates
At the moment the page is the same as for text message templates,
except:
- different H1
- no guidance about personalisation, links, etc (until we decide how
  these should work)

For now you won’t be able to really create a broadcast template, because
the API doesn’t support it (the API will respond with a 400). But that’s
OK because no real services have the broadcast permission yet.

This required a bit of refactoring of how we check which template types
a service can use, because there were some hard-coded assumptions about
emails and text messages.
2020-07-01 17:17:46 +01:00
Pea M. Tyczynska
1b2727197a Use en dashes for better formatting
Co-authored-by: Chris Hill-Scott <me@quis.cc>
2020-07-01 15:30:57 +01:00
Tom Byers
4eea8bfe57 Add variant page for service-settings/name
Includes correction of class used for bulleted
list.
2020-07-01 14:57:45 +01:00
Pea Tyczynska
b3bc3a6447 Write test for separate page for service name change for local orgs
Also make a bullet list gov uk style
2020-07-01 14:57:45 +01:00
Pea Tyczynska
d0dd6218f7 Show different page for local org users when adding new service 2020-07-01 14:57:44 +01:00
Tom Byers
a381c6d37d Add test for local auth' version of add-service 2020-07-01 14:57:43 +01:00
karlchillmaid
18435d3455 Update bullets to use default user organisation 2020-07-01 14:57:43 +01:00
karlchillmaid
e15c670585 Create a separate page for service name changing for local services
This new page has a special hint text that will help local authorities
name their services well.

Add new hint text – old hint text left intact for now
2020-07-01 14:56:21 +01:00
karlchillmaid
e6f49825e5 Create a separate page for Create service journey for local org users
This page has a special hint text that will help local org users name
their services well.

Add new hint text – old hint text left intact
2020-07-01 14:54:36 +01:00
karlchillmaid
8a1d86633c Merge pull request #3486 from alphagov/update-guest-list-content
Update guest list introduction
2020-07-01 14:34:27 +01:00
David McDonald
9c82e61eaa Move init of gds metrics before csrf
This solves two problems
- it makes our response times more accurate as it means we start
  measuring the response time earlier (otherwise we aren't recording the
  time spent by `csrf` and `login_manager`s `before_request` functions
- is a temporary fix for a bug in the gds python metrics library as
  explained below.

Currently, when a request comes in it goes through various
`before_request` functions. Currently it goes through the function
introduced by the csrf client and then the one introduced by the metrics
client. If an exception is thrown by the csrf.before_request function
then we do not run the `metrics.before_request` function. This would
happen in the case that a CSRF token is invalid and then the main body
of the request would not process but then all `teardown_request`
functions will run. When the `metrics.teardown_request` function runs it
looks for `g._gds_metrics_start_time`, however this attribute is not
availble on the flask global object as it was not created as the
`metrics.before_request` function that creates it did not run. This then
throws an `AttributeError` and results in a 500 for the user. The short
term solution for this (initing metrics before csrf) means that
`_gds_metrics_start_time` will be set before csrf is at risk of throwing
an exception.

A separate PR will be put into the gds metrics python library to remove
the risk of an `AttributeError` and instead to log a warning instead of
throwing an uncaught exception.
2020-07-01 14:07:47 +01:00
David McDonald
d4ed909d0f Revert "Revert "Statsd to prometheus"" 2020-07-01 13:27:12 +01:00
David McDonald
4e165ae3d3 Merge pull request #3496 from alphagov/revert-3495-statsd-to-prometheus
Revert "Statsd to prometheus"
2020-07-01 10:29:36 +01:00
David McDonald
5fb58260e2 Revert "Statsd to prometheus" 2020-07-01 10:00:39 +01:00
David McDonald
e260110d60 Merge pull request #3495 from alphagov/statsd-to-prometheus
Statsd to prometheus
2020-06-30 15:37:40 +01:00
David McDonald
043e6ac69c Add GDS metrics package to admin app
Follows the code from the API
2020-06-30 14:24:34 +01:00
Chris Hill-Scott
9b98298d76 Merge pull request #3494 from alphagov/broadcast-service-permission
add broadcast service permission to service settings
2020-06-30 14:11:35 +01:00
Chris Hill-Scott
cbe0ecc022 Merge pull request #3493 from alphagov/pyup-scheduled-update-2020-06-29
Scheduled weekly dependency update for week 26
2020-06-30 14:11:21 +01:00
Chris Hill-Scott
7d6802b415 Freeze requirements 2020-06-30 13:50:05 +01:00
pyup-bot
20a53ad32a Update humanize from 2.4.0 to 2.4.1 2020-06-30 13:49:42 +01:00
Leo Hemsted
8b3aa43101 add broadcast service permission 2020-06-30 13:06:26 +01:00
David McDonald
6958c0d677 Remove statsd
We don't expose these metrics anywhere anyway and we want to move to
prometheus too (which will be done in the next commit)
2020-06-30 11:08:11 +01:00
Chris Hill-Scott
ee8270aa2c Merge pull request #3480 from alphagov/request-cache
Import request cache from utils
2020-06-29 16:22:21 +01:00
Chris Hill-Scott
c98d21da12 Merge pull request #3491 from alphagov/platform-admin-services-layout
Platform admin services layout
2020-06-29 16:22:16 +01:00
Chris Hill-Scott
fb4076dc5b Don’t break statistics down by sending/failed/delivered
This should:
- make the page load faster because it has to render less HTML for each
  service
- make the page easier to scan for services that are sending lots of
  text messages or letters

We used to scan this page to look for services with high failure rates,
and the design of the page was gear towards this. Now we have alerting
for high failure rates, so the page can focus on volumes instead.

This commit also puts the service name above the statistics, so that
long service names don’t break the layout of the page.
2020-06-24 11:45:32 +01:00
Chris Hill-Scott
2762be233d Put archived label alongside service name 2020-06-24 10:41:12 +01:00
Chris Hill-Scott
37673bce32 Merge pull request #3490 from alphagov/remove-letter-contact-block-field
Stop expecting letter contact block in service JSON
2020-06-24 09:17:17 +01:00
karlchillmaid
ab3e76a5b1 Change 'the' to 'a' 2020-06-23 14:54:11 +01:00
karlchillmaid
b549fda0a2 Update key name 2020-06-23 14:38:48 +01:00