Commit Graph

52 Commits

Author SHA1 Message Date
Chris Hill-Scott
afdc749e36 Make ‘Add new’ buttons sticky on more pages
For consistency with the template management page.
2019-02-01 14:25:35 +00:00
Alexey Bezhan
6cd18f87de Don't request pagination links for API Message log page
Counting pages for API notifications takes a long time for services
with a lot of sent messages (since it issues a `count(*)` query for
the given filter). Since API message log doesn't have a "Next page"
link we can skip the count by setting a flag on the API request.
2019-01-08 15:35:44 +00:00
Pea Tyczynska
a43e6a8885 Make deletion confirmation banner messages consistent across our app
Also introduce a way to provide context to a banner / flash message
that will be displayed in plain font style.
2018-11-16 11:05:52 +00:00
Chris Hill-Scott
d1c9dcfb1d Put API keys on service model
Similar to how we put templates on the service model, it means less
logic needs to happen in the view code.
2018-11-12 16:11:13 +00:00
Chris Hill-Scott
3caaf74c4a Split paragraph into two
There was an awkward line break in this text, and the line length was
too long because there was no grid on the page.

Splitting it into two paragraphs makes it:
- read nicer
- avoids any awkward line breaks
2018-10-30 13:11:50 +00:00
Chris Hill-Scott
d5d1f7394d Remove old API key and service ID combo
Once all our users have upgraded to the latest clients they won’t need
this. The latest clients only use the combined key and service ID.

Discuss: when can we safely remove it?
2018-10-30 10:01:37 +00:00
Chris Hill-Scott
d9da219b7e Use a macro for form tags
This will stop us repeatedly forgetting to add `novalidate` and
`autocomplete='off'` to our forms (which is how most of them are set
up).

It uses sensible defaults, based on how we most-commonly configure
forms:
- most of our forms are `post`ed (but this can be overridden)
- `autocomplete` should only be enabled where it makes sense, otherwise
  it’s more annoying than useful (but this can be overriden)
- we should never be using HTML5 form validation because our own error
  styles and messages are better
2018-09-19 12:43:15 +01:00
Chris Hill-Scott
2ddf3d5cfe Link to notification from API integration
It’s useful to be able to see what the email or text message looks like,
especially if you’ve sent it with a test API key (so it isn’t in your
inbox or on your phone). We already have the page for this, so we just
need to link to it.
2018-09-06 10:50:18 +01:00
Katie Smith
0633af4e4a Truncate contact link text on settings page
The contact link on the settings page should be truncated instead of the
text being wrapped and overflowing on to multiple lines. This adds in an
option to the text_field macro to truncate long text fields. This
setting has been used to truncate the API callback URLs too on the
services/<service_id>/api/callbacks page.
2018-06-12 10:21:24 +01:00
Katie Smith
4db75f6a58 Display the two new virus states for letters
Precompiled letters can now have two additional states:
* pending-virus-check
* virus-scan-failed

Both new states should show in the notifications dashboard, and
virus-scan-failed should appear as an error state, with a descriptive
message. You should not be able to preview a letter in one of the two
new states, so the preview link has been removed for precompiled letters
in these states.
2018-03-20 14:54:29 +00:00
Ken Tsang
f4a3ec028e Add client reference to API Integration / message log
- makes it clearer for users and easier to copy
- also updated text in preview message
2018-03-16 14:41:07 +00:00
chrisw
5d26d4457f manage api keys permission should be able to see senders 2018-02-08 11:25:49 +00:00
Chris Hill-Scott
9aa4a7267a Use <button> not <input>s for form submission
Both `<button type='submit'>Submit<button>` and
`<input type='submit' value='Submit'>` can be used to submit a form.

We have historically[1] used `<input>` because it’s better-supported by
IE6 in that:
- the `submit` attribute is mandatory on `<button>`, not on `<input>`
- the `innerHTML` of a button will be submitted to the server, not the
  value (as in other browsers)

Reasons to now use `<button>` instead:
- IE6/7 support is no longer a concern (especially with deprecation of
  TLS 1.0 on the way)
- Because an `<input>` element can’t have children, the pseudo-element
  hack[2] used to ensure the top edge of the button is clickable doesn’t
  work. We’re seeing this bug[3] affect real users in research.

1. We inhereted our buttons from Digital Marketplace, here is me making
   that change in their code:  8df7e2e79e (diff-b1420f7b7a25657d849edf90a70ef541)
2. 24e1906c0d (diff-ef0e4eb6f1e90b44b0c3fe39dce274a4R79)

3. https://github.com/alphagov/govuk_elements/issues/545
2018-02-01 13:53:45 +00:00
chrisw
e52921bc00 add view link in message log for letter notifications 2018-01-17 15:39:39 +00:00
Chris Hill-Scott
67b54d850f Add link back to API integration from callbacks
Matches what we do on the API keys and whitelist pages.
2018-01-15 10:10:12 +00:00
Chris Hill-Scott
3f01da05c7 Fix order of callbacks
Delivery comes before inbound. The order of the URLs was jumbled in two
places:
- in the view function
- in the Jinja template

So as the user saw it the URLs were in the right order, because the
double jumbling cancelled itself out. But it made the code _really_
confusing to read.
2017-12-13 11:58:21 +00:00
Chris Hill-Scott
f02ec30979 Make table labels match titles of callback pages
This makes it consistent from page to page, and match the wording that
Thom came up with.
2017-12-13 11:56:26 +00:00
venusbb
3377efb267 Merge branch 'master' of https://github.com/alphagov/notifications-admin into vb-callback-admin
Some content change
Refractor api_integration to api_keys to reduce git difference.
2017-12-11 13:43:29 +00:00
venusbb
482309af3b fixed empty callback dict problem 2017-12-11 11:40:38 +00:00
chrisw
71c9618a26 refactor of api callbacks admin work 2017-12-08 10:53:02 +00:00
chrisw
43c14fb756 Allow service to set callback url for notifications 2017-12-08 10:52:50 +00:00
chrisw
90e18e04ee Updated support views to represent new url structure 2017-11-29 13:58:12 +00:00
Chris Hill-Scott
7fc2a5b134 Remove HTML5 validation
This commit:
- uses WTForms email fields wherever we collect email addresses
- makes sure we don’t let the default HTML5 form validation get trigged
  (using `novalidate`[1])

We don’t want to use the default validation because:
- it looks out of place
- it’s not well supported by assistive technology

1. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#attr-novalidate
2017-10-16 17:17:54 +01:00
Chris Hill-Scott
e2bd2e0439 Ensure only one <h1> per page, even with errors
A page should have only one `<h1>` element. So if there’s an error
message, which contains a `<h1>`, it should replace the page’s normal
`<h1>` element, rather than sit above it.
2017-07-27 11:52:54 +01:00
Chris Hill-Scott
40e79c6827 Use confirmation banner for revoking API keys
Currently revoking an API key takes you to a separate page. It should
work the same way as other destructive actions, ie staying on the same
page but with a banner asking you to confirm the action.
2017-07-27 11:52:54 +01:00
Chris Hill-Scott
8a4c8526fa Use 19px not 16px type in more places
Making the navigation narrower means that we have more space on every
page. So on pages where we had to use 16px type just to fit stuff on the
page we can now bump the type size up to something less miserly. This is
mainly the team and settings pages.

We still need to use 16px on pages which list notifications or previews
of spreadsheets, because we’re still trying to fit a lot of information
onto these pages, so every little space-saving helps.
2017-03-20 11:59:12 +00:00
Chris Hill-Scott
135ff1ee77 Include service name in page <title>
In pages specific to a service (e.g. dashboard and sub pages) the title
needs to distinguish which service it applies to. This is mainly to give
context to screen reader users who could be managing multiple services.

Implementing this uses template inheritance:

`page_title` includes `per_page_title` includes `service_page_title`

‘GOV.UK Notify’ is inserted into every page title.

Pages that set `service_page_title` get the service name inserted too.
2017-02-14 11:53:53 +00:00
Chris Hill-Scott
d2918486e9 Add error summary to whitelist page
> If both sections of the page have errors and the page is submitted,
> focus moves to the mobile numbers section so screen reader users may
> not be aware of preceding errors - focus should move to a dedicated
> error summary at the top of the page.

This commit adds the dedicate error summary at the top of the page,
following the GOV.UK Elements style from:
http://govuk-elements.herokuapp.com/errors/
2017-02-14 11:51:19 +00:00
Rebecca Law
b9d88cccc3 Merge pull request #1103 from alphagov/testing-doc
Testing doc
2017-02-03 10:44:38 +00:00
Pete Herlihy
d040527dec Merge pull request #1102 from alphagov/api-key-labels
Api key labels updated to clarify Live, Team and Test
2017-02-02 13:33:28 +00:00
Pete Herlihy
97a4975985 Stopped hiding the label that showed if a key was a live key
Happy to be overruled by @quis on this one....
2017-02-02 13:01:15 +00:00
Pete Herlihy
4040429f41 Updated API key type hint text on list of keys page 2017-02-02 12:52:11 +00:00
Rebecca Law
e929088bea Updates to the integration_testing documentation.
Added a link to this doc in the documentation page.
2017-02-01 10:27:02 +00:00
Imdad Ahad
3ccfc34d0f Update documentation page with .NET client link 2016-12-13 13:32:20 +00:00
Chris Hill-Scott
4ae28386a6 Always show live key, reword key labels
This is trying to resolve these confusions:

- that you’re in trial mode, which means you can’t have a live key yet (
  or you can but it wont work, which is what we used to have)
- what does simulate mean

The create key page is the right place to resolve these confusions
because it’s where users are actively reading.

This commit also removes the trial mode banner from API integration
page because this where users _aren’t_ actively reading. A whole bunch
of users weren’t seeing this banner at all.

The implementation of the disabled API key options is kinda clunky
because WTForms doesn’t have a native way of doing this.

¯\_(ツ)_/¯
2016-11-04 14:05:30 +00:00
Chris Hill-Scott
9ec1f21f72 Add a message to the whitelist
The confusion about the whitelist was how it related to your team. This
commit adds some text to make the relationship clearer.
2016-11-04 13:11:53 +00:00
Chris Hill-Scott
101392c350 Fix page title to match H1 on create API key page
The page `<title>` was using previous wording.
2016-11-04 13:11:52 +00:00
Chris Hill-Scott
2d2e701e22 Open links to documentation in new tabs
Because users have difficulty getting back to the Notify admin
interface.

The `rel` attribute mitigates against [a nasty cross-domain
vulnerability](https://mathiasbynens.github.io/rel-noopener/).
2016-10-18 13:50:25 +01:00
Chris Hill-Scott
6946d3af54 Make API key combination of secret and service ID
In research we’ve seen people mix up the service ID and API key because
they’re both 36 character UUIDs. We can’t get rid of the service ID
because it’s used to look up the API key.

Instead, we should change API key to be one long string, which contains
both the service ID, API key and (optionally) the name of the key. For
example:

```
casework_production-8b3aa916-ec82-434e-b0c5-d5d9b371d6a3-dcdc5083-2fee-4fba-8afd-51f3f4bcb7b0
```

We still need to keep the old, separate, key and service ID for a while
until people have updated their clients. But they’re now both on this
page, rather than on two separate pages, which should make for less
fussing anyway.

This shouldn’t be rolled out until the new clients are available.

- [ ] https://github.com/alphagov/notifications-python-client/pull/36
- [ ] https://github.com/alphagov/notifications-node-client/pull/10
- [ ] https://github.com/alphagov/notifications-ruby-client/pull/15
- [ ] https://github.com/alphagov/notifications-java-client/pull/38
- [ ] PHP????
2016-10-18 12:21:00 +01:00
Chris Hill-Scott
4ddc99781f Make revoked message in API keys table lighter
It’s secondary information so works better in the secondary text colour.
2016-10-18 11:57:46 +01:00
Chris Hill-Scott
c13f1aa5d1 Fix API log page in Firefox
The details of each notification were not being hidden on page load in
Firefox.

Firefox does not natively support the `<details>` element, so we
polyfill it.

Because of the way the polyfill is written[1]

1. There can’t be any `<div>` elements inside the `<summary>` (this
   commit changes them to be `<span>`s instead, and adds CSS to make
   sure they wrap as before)
2. The contents to be shown/hidden must be wrapped in a `<div>` (which
   this commit adds)

***

1. 48fde82c72/public/javascripts/govuk/details.polyfill.js (L90)
2016-10-12 15:28:38 +01:00
Chris Hill-Scott
73469c1067 Make whitelist available to live services
Why would a live servie need the whitelist? Because the team key will
also let you send to members of your whitelist (so this commit relabels
it to say so).
2016-10-07 15:01:49 +01:00
Chris Hill-Scott
fdeb2997fb Stop whitelist form autocompleting
The browser tries to be helpful by autofilling email addresses and
phone numbers. But it gets confused and tries to fill all the fields
with the same email address or phone number. This looks broken.

This commit disables autocomplete for these form fields.
2016-09-29 10:21:08 +01:00
Chris Hill-Scott
6c96b90922 Make relative timestamps update automatically
It’s weird to be on a page that says ‘2 seconds ago’ and stays stuck
there.

We don’t want to AJAX the whole page because it would get in the way of
interacting with the list of notifications.

This commit adds the venerable jQuery Timeago[1] plugin to keep the
relative times accurate and fresh.

1. http://timeago.yarp.com/
2016-09-29 09:28:13 +01:00
Chris Hill-Scott
48891babc4 Add log of notifications to API integration page
Now that we’ve removed simulated notifications from the dashboard and
activity pages they’re not visible anywhere in the app.

While they should’t be visible to non-technical users, developers have
a real need for Notify to confirm that their code is doing what they
expect. This is needed especially when they’re just getting started with
Notify.

There’s no way of seeing this info from the API either, because a key
can only get notifications created with a key of that type.

It doesn’t make sense to make this a ‘mode’ of the dashboard or activity
because the information about notifications that developers need is
also different. So this commit adds up to 50 of the most recent
notifications sent via the API to the page that developers use as their
‘home’ page.

This also lets us explain the 7 days thing to developers via the
empty slate state of this area of the page.
2016-09-29 09:28:04 +01:00
Chris Hill-Scott
3e42042156 Add a page to manage a service’s whitelist
Services who are in alpha or building prototypes need a way of sending
to any email address or phone number without having to sign the MOU.

This commit adds a page where they can whitelist up to 5 email addresses
and 5 phone numbers.

It uses the ‘list entry’ UI pattern from the Digital Marketplace
frontend toolkit [1] [2] [3].

I had to do some modification:
- of the Javascript, to make it work with the GOV.UK Module pattern
- of the template to make it work with WTForms
- of the content security policy, because the list entry pattern uses
  Hogan[1], which needs to use `eval()` (this should be fine if we’re
  only allowing it for scripts that we serve)
- of our SASS lint config, to allow browser-targeting mixins to come
  after normal rules (so that they can override them)

This commit also adds a new form class to validate and populate the two
whitelists. The validation is fairly rudimentary at the moment, and
doesn’t highlight which item in the list has the error, but it’s
probably good enough.

The list can only be updated all-at-once, this is how it’s possible to
remove items from the list without having to make multiple `POST`
requests.

1. 434ad30791/toolkit/templates/forms/list-entry.html
2. 434ad30791/toolkit/scss/forms/_list-entry.scss
3. 434ad30791/toolkit/javascripts/list-entry.js
4. http://twitter.github.io/hogan.js/
2016-09-29 09:27:38 +01:00
Chris Hill-Scott
4a596c1dd2 Add a new banner for telling you about trial mode
We’ve found in research that developers have no idea they’re in trial
mode until they hit an error. And even then they don’t really know what
trial mode means.

So this commit:
- adds a message to the API integration page about trial mode
- puts it in a really yellow banner to draw attention to it
- adds the same banner to the settings page
2016-09-28 17:00:46 +01:00
Chris Hill-Scott
f514d377f7 Add a new pattern for sub-navigation
This is like the ‘pill’ pattern that we use for filtering lists of
notifications. However it is meant for navigating between discrete
things, not a filtered view of the same list.

This is why is has a gutter between each item, and no selected state.

Turns out we already had a pattern about this on the dashboard, so this
commit also changes the dashboard to use the same code.
2016-09-28 17:00:46 +01:00
Chris Hill-Scott
dfa3a9242f Add a separate page for linking to documentation
It’s going to get too cluttered to have these links on the API index
page.
2016-09-28 17:00:45 +01:00
Chris Hill-Scott
70a9582c91 Make ‘add new’ button line up with <h1>
Having changed the layout of the API keys page a bit the vertical
misalignment was apparent.
2016-09-28 17:00:45 +01:00