Commit Graph

13479 Commits

Author SHA1 Message Date
Leo Hemsted
86c413557c move financial deets to an environment variable
lets us keep cabinet office financials safe in the credentials repo

the dict in the creds repo will either be an empty dict or a full dict,
so the env var on paas will always contain some parseable json. But
locally it might not, so if it's not set at all then default to the
string `null` so the json parsing doesn't throw a wobbly.
2021-09-08 10:19:46 +01:00
Leo Hemsted
2b8289a5d8 update content on how-to-pay page 2021-09-08 10:19:46 +01:00
Leo Hemsted
a0adf3c63c add new billing details page
contains both signed in and signed out versions (when signed in you can
see bank details etc)
2021-09-08 10:19:42 +01:00
Leo Hemsted
85f6881a56 rename api key component to copy_to_clipboard
does what it says on the tin, and is also consistent with prior art:
https://components.publishing.service.gov.uk/component-guide/copy_to_clipboard
2021-09-08 10:18:17 +01:00
Ben Thorner
1d4326b9b2 Merge pull request #4014 from alphagov/support-custom-broadcasts-178986763
Fix areas not showing for custom broadcasts
2021-09-08 09:40:42 +01:00
Ben Thorner
e801bacad3 Fix "flask shell" not working on PaaS instances
This is consistent with API [1]. Other apps don't need this as they
follow the Flask convention of it being the "app" module or package.

[1]: https://github.com/alphagov/notifications-api/blob/master/manifest.yml.j2#L112
2021-09-07 17:46:55 +01:00
Ben Thorner
bda49a4e0c Merge pull request #4012 from alphagov/remove-migration-command-178986763
Remove redundant command to migrate areas
2021-09-07 14:20:03 +01:00
Tom Byers
8d3ec9284b Merge pull request #3996 from alphagov/improve-map-accessibility
Accessibility fixes for interactive map
2021-09-07 11:37:51 +01:00
Tom Byers
c6ecbf647a Change comment about turning part of focus style off
Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2021-09-07 10:10:05 +01:00
Ben Thorner
748ba2fdee Remove pointless 'list-routes' command
This is superseded by the native 'flask routes' command.
2021-09-07 09:35:45 +01:00
Ben Thorner
fd6d7f8b7a Remove redundant command to migrate areas
The data migration is now complete.
2021-09-07 09:35:03 +01:00
Ben Thorner
cf3f69199a Support new broadcasts (without area IDs)
Previously we relied on the API defaulting this field to an empty
array [1], but that conflicts with using it to decide whether a
broadcast is custom or created in this app.

[1]: 3779146cc5/app/models.py (L2342)
2021-09-06 12:40:32 +01:00
Ben Thorner
baf20e0075 Support broadcasts with no areas data
Previously we used to return an empty CustomBroadcastAreas object,
which doesn't make sense for broadcasts created in this app.
2021-09-06 12:40:31 +01:00
Ben Thorner
411fda81c0 Support custom broadcasts (without area IDs)
Custom broadcasts created directly via the API app won't have area
IDs since [1], where we started to distinguish between "names" (all
broadcasts have these) and IDs (for broadcasts created in this app).
We forgot to propagate the distinction into the code here.

This code fixes the bug for all broadcasts created after [1]. Any
custom broadcasts created before [1] will have their "ids" field set
instead of "names" so we won't show anything for them. This seems
reasonable as we don't support custom broadcasts yet.

[1]: 023a06d5fb
2021-09-06 12:40:30 +01:00
Ben Thorner
47132d28d6 Remove redundant arguments for broadcast JSON
These are set automatically.
2021-09-06 12:40:27 +01:00
Ben Thorner
bab5c21148 Rename test to include method under test 2021-09-06 12:11:42 +01:00
Ben Thorner
b3cc10ac7d Merge pull request #4011 from alphagov/fix-area-migration-command-178986763
Small fixes for command to migrate areas
2021-09-03 16:36:39 +01:00
Ben Thorner
306394e011 Small fixes for command to migrate areas
Previously there was no way to run it for reals.
2021-09-03 13:24:24 +01:00
Tom Byers
87674aef08 Fixes for the comments in the map CSS
Based on a range of comments made in the
associated pull request:
- 7c2f4adfd5 (r701234728)
- 7c2f4adfd5 (r701235330)
- 7c2f4adfd5 (r701235586)
- 7c2f4adfd5 (r701242035)
- 7c2f4adfd5 (r701241659)

Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2021-09-03 12:13:15 +01:00
Tom Byers
c1c80802e2 Give outline reset same precedence as for focus
The CSS that cancelled outline on focus events not
fired by the :focus-visible heuristic is being
overridden by the higher precedence of the outline
style for :focus, due to its use of !important.

This adds !important to the cancelling CSS. This
brings that block up to the same level as that for
:focus, meaning the :focus-visible styles will win
because they sit lower in the stylesheet.
2021-09-03 11:20:41 +01:00
Tom Byers
7c2f4adfd5 Refactor JS
Based on these comments on the associated pull
request:
- add area/areas condition to the array used to
  build the label prefix
  e2af2f63a4 (r55831534)
- use a for loop instead of while when looping
  through nodes
  e2af2f63a4 (r55831693)
2021-09-02 14:43:07 +01:00
Tom Byers
6de836b2f2 Rewrite map CSS comments 2021-09-02 14:43:07 +01:00
Tom Byers
ee3e3c6c90 Change how line between map buttons is styled
There is a slight variance in how the line between
the map buttons is rendered when in forced-colors
mode and when not. This is not helped by it
alternately being rendered as either:
- a gap between buttons, showing the container
  colour
- a border-bottom on the first button

This attempts to flatten these styles so it is
only styled as a gap between the buttons so
changes to how its colour renders in different
modes can just be dealt with on the container.
2021-09-02 14:43:07 +01:00
Ben Thorner
4921e6d46e Merge pull request #4003 from alphagov/aggregate-areas-178986763
Add utility function to aggregate alert areas
2021-09-02 13:14:39 +01:00
Ben Thorner
4bae4eec6c Start sending aggregate area names to API
The aggregate names don't need to be sorted, but it helps to do
this for the tests, since the implementation of sets may not be
stable between machines and lead to sporadic test failures.

I did also toy with sorting granular area names so they have a
similar ordering, but this would take them out-of-order with IDs
and really the important thing is that the ordering is stable.
2021-09-02 12:59:18 +01:00
Ben Thorner
a94291d5a4 Clarify comments for aggregation algorithm
In response to [1] and [2].

[1]: https://github.com/alphagov/notifications-admin/pull/4003#discussion_r695919270
[2]: https://github.com/alphagov/notifications-admin/pull/4003#discussion_r695920213
2021-09-02 12:59:17 +01:00
Ben Thorner
de804805ac Refactor logic to identify types of areas
I did consider whether to store this explicitly in the SQLite DB,
but this is less effort for now and we can always switch to that
more robust approach in future if we need to.
2021-09-02 12:59:16 +01:00
Ben Thorner
bcfa21428f Support aggregating local authority clusters
This applies some heuristics to try and keep the overall list of
areas short when many are selected in the same wider area.

Currently we only have relationship information between upper and
lower tier local authorities, so we can't / won't aggregate up to
Greater London (it's own special thing) or whole countries.
2021-09-02 12:59:13 +01:00
Ben Thorner
2d912cef42 Support area aggregation for custom polygons 2021-09-02 12:55:53 +01:00
Ben Thorner
a210d87dee Add function method to aggregate areas
This is standalone for now - we'll plumb it in later.
2021-09-02 12:55:52 +01:00
Ben Thorner
12978f0a9a Simplify creating BroadcastMessage instances
This avoids passing loads of unnecessary boilerplate values.
2021-09-02 12:55:51 +01:00
Ben Thorner
f96b75b401 Add method to get wards for custom polygon
This will be used as part of the area aggregation in the following
commits.
2021-09-02 12:55:47 +01:00
Tom Byers
9c9e7a7c61 Fix code for map focus style
@benthorner pointed out a few things about these
styles that could do with changes:
- the outline-offset will only appear when the
  outline does, which is in forced-color mode when
  the browser assigns a colour to it, so it
  doesn't need to be assigned in a media query
  targeting forced-color mode
- the `&:focus:not(:focus-visible)` selector
  stops the focus styles showing in scenarios
  where:
  1. the browser supports :focus-visible
  2. focus comes from something other than tabbing
     to the map
  ...so we don't need to target :focus-visible
  specifically.

This applies changes to these styles to remove
those not needed and move some to a better place.

Related to this comment on the associated pull
request:

https://github.com/alphagov/notifications-admin/pull/3996#discussion_r699246969
2021-09-02 11:27:45 +01:00
Tom Byers
f52dd23e35 Correct term in map CSS comment
Co-authored-by: Ben Thorner <benthorner@users.noreply.github.com>
2021-09-01 20:38:06 +01:00
Tom Byers
e2af2f63a4 Fix issues with JS added to map code
This addresses the following issues with the JS:
1. fix string listing the alert areas so their
  'remove' text isn't included
2. use `!==` instead of `>` for index comparison
3. put code for adding the label and description
into separate functions

Those issues are (matching the list above):
1. https://github.com/alphagov/notifications-admin/pull/3996#discussion_r699235376
2. https://github.com/alphagov/notifications-admin/pull/3996#discussion_r699220672
3. https://github.com/alphagov/notifications-admin/pull/3996#discussion_r699230038
2021-09-01 20:26:12 +01:00
Ben Thorner
51b786e544 Merge pull request #4006 from alphagov/continue-areas-migration-178986763
Complete migration to new "areas" API format
2021-09-01 17:10:47 +01:00
karlchillmaid
c406f64bd3 Merge pull request #4008 from alphagov/update-service-name-advice
Update service name advice
2021-09-01 12:32:33 +01:00
karlchillmaid
9f302050c4 Add 'initialism' 2021-09-01 11:31:48 +01:00
karlchillmaid
e0617004f5 Add 'initialism' 2021-09-01 11:30:01 +01:00
Ben Thorner
cfdd244325 Complete migration to new "areas" API format
Depends on: https://github.com/alphagov/notifications-api/pull/3314

Previously:

- We introduced a new "areas_2" API field that's can
populate the "areas" column in the same way.

- We updated the Admin app to use the new field, so that
the old "areas" and "simple_polygons" API fields are unused.

- We repurposed the unused "areas" API field to use
the new "areas_2" format.

This PR:

- We can switch the Admin app back to the "areas" field,
but in the new format.

Future PRs:

- Remove support for the unused "areas_2" field (migration complete)
2021-08-27 14:34:49 +01:00
karlchillmaid
ef112df5eb Merge pull request #4005 from alphagov/update-security-page
Update Security page content
2021-08-27 14:30:46 +01:00
karlchillmaid
fd5a1d980b Fix link text, add security classification info 2021-08-27 13:58:10 +01:00
Tom Byers
23f0bb096e Add accessible name and description to map
The map is already in the tabbing order, so can be
moved to by tabbing and by programs like screen
readers or speech recognition, but it doesn't have
an accessible name so when assistive tech' that
requires this for identification gets the contents
read out instead, which is confusing.

This adds an accessible name, via aria-label, made
out of the areas the alert targets.

This also adds some help text, explaining how to
use the map via aria-describedby. This is a pretty
common pattern and is used in native UI like
selectboxes where a range of commands are
available to control the UI 'widget'. Using
aria-describedby means the help text is not used
every time the widget is focused but is available
if the user gets stuck. For example, Voiceover
announces it if the widget is focused but
not interacted with for a period of time, or when
a shortcut key is pressed.

Finally, I also added a role of 'region' because
when I tested with the NVDA screen reader, the
accessible name wasn't announced but this fixed
that. I think it's because the div isn't being
recognised as having a role without it being set
explicitly and is therefore ignored.
2021-08-27 13:49:49 +01:00
Ben Thorner
6c4340c5eb Merge pull request #4004 from alphagov/areas-refactor-178986763
Prepare to migrate to new format for "areas"
2021-08-27 11:49:07 +01:00
Tom Byers
a3854e49b6 Fix issue with jumping buttons
The content of the map buttons jumped on Chrome
and Safari when focused.

It turns out this was because I was testing in
Firefox which Leaflet had identified as having
touch capability (and so added the .leaflet-touch
class). Leaflet makes the buttons 30px rather than
26px for touch-capable devices/browsers so the
jumping was down to the line-height being set for
the wrong container height.

This adds styles to give a different line-height
when touch is available, to match the Leaflet
styles.
2021-08-26 16:35:13 +01:00
Tom Byers
542be8832d Turn outlines off on map control buttons
Leaflet does this anyway when they're focused
(through JS) but we found holding shift when on a
focused button, which you do when tabbing
backwards, turns this off for some reason so you
see the outline the browser applies by default.

This turns all outlines off to stop that
happening.

Worth nothing that focus is indicated by:
- a change of background colour instead when
  tabbing
- a border in forced-color mode

...so the outline is not needed.
2021-08-26 15:42:12 +01:00
Tom Byers
83bf78156b Rewrite comment on part of the focus style
The original comment doesn't describe what the
code does. Raised in this comment on the
associated pull request:

https://github.com/alphagov/notifications-admin/pull/3996#discussion_r692093945
2021-08-26 15:34:48 +01:00
Tom Byers
4950b08d71 Fix CSS that removes rounded corners on controls
Users on devices/browsers that support touch have
the rounded corners styles applied by this
selector:

.leaflet-touch .leaflet-bar a:first-child,
.leaflet-touch .leaflet-bar a:last-child

It has a higher precedence than the existing
selector we use to override it so our overrides
are ignored:

.leaflet-bar a:first-child,
.leaflet-bar a:last-child

This changes the selector for our block of styles
to include one matching the existing styles above
so devices/browsers also get our styles.

Note 1: this actually means some styles were no
longer needed so this also removes them.

Note 2: oddly, this was spotted in Firefox when
displaying high contrast mode on desktop. So not a
touch device but leaflet's JS is marking it as
such.
2021-08-26 15:31:36 +01:00
Ben Thorner
9667433b7e Add temporary command to migrate data for "areas"
This will be run with a CSV of all broadcast messages. Since very
few users are creating or updating broadcasts, it's highly unlikely
we'll encounter a race condition during the update.
2021-08-26 13:08:05 +01:00
Ben Thorner
39a1212508 Switch existing command to standard approach
This is the suggested approach in the documentation [1] and using
it makes it clearer what's going on and to add other commands with
arguments, which we'll do in the next commit.

[1]: https://flask.palletsprojects.com/en/2.0.x/cli/#custom-commands
2021-08-26 12:49:55 +01:00