From e049e691fd5e35cb4690f55a853812cd000a83bb Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 25 Apr 2016 09:48:26 +0100 Subject: [PATCH 1/3] Use the API key pattern for showing service ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we show an identifier, like an ID or a key, we have a pattern which adds a ‘copy to clipboard’ button. We weren’t using this pattern for service ID. This commit also moves it under the table, so hopefully people will be less likely to confuse the service ID for an API key when scanning down the page. --- app/assets/javascripts/apiKey.js | 2 ++ app/templates/views/api-keys.html | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/apiKey.js b/app/assets/javascripts/apiKey.js index 2bbfa174c..e7905e2d0 100644 --- a/app/assets/javascripts/apiKey.js +++ b/app/assets/javascripts/apiKey.js @@ -33,6 +33,8 @@ key = $component.data('key'), thing = $component.data('thing'); + console.log(thing) + $component .html(states.keyVisible(key, thing)) .attr('aria-live', 'polite') diff --git a/app/templates/views/api-keys.html b/app/templates/views/api-keys.html index eca7175cf..5a187d27f 100644 --- a/app/templates/views/api-keys.html +++ b/app/templates/views/api-keys.html @@ -1,5 +1,6 @@ {% extends "withnav_template.html" %} {% from "components/table.html" import list_table, field, hidden_field_heading %} +{% from "components/api-key.html" import api_key %} {% block page_title %} API keys – GOV.UK Notify @@ -22,17 +23,11 @@ developer documentation.

-

- Service ID -

-

- {{ current_service.id }} -

- {% call(item, row_number) list_table( keys, empty_message="You haven’t created any API keys yet", caption="API keys", + caption_visible=False, field_headings=['Key name', hidden_field_heading('Action')] ) %} {% call field() %} @@ -53,4 +48,6 @@ Create a new API key

+ {{ api_key(current_service.id, "Service ID", thing="service ID") }} + {% endblock %} From 71035ab96e13e38205430ad66873153789592410 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 25 Apr 2016 09:50:17 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Use=20the=20same=20pattern=20as=20elsewhere?= =?UTF-8?q?=20for=20=E2=80=98new=20thing=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On the team and templates pages we have a pattern for adding a new ‘thing’, which is a green button in the top right. This commit changes the API key page to follow the same pattern. --- app/assets/javascripts/apiKey.js | 2 -- app/templates/views/api-keys.html | 17 ++++++++++------- tests/app/main/views/test_api_keys.py | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/apiKey.js b/app/assets/javascripts/apiKey.js index e7905e2d0..2bbfa174c 100644 --- a/app/assets/javascripts/apiKey.js +++ b/app/assets/javascripts/apiKey.js @@ -33,8 +33,6 @@ key = $component.data('key'), thing = $component.data('thing'); - console.log(thing) - $component .html(states.keyVisible(key, thing)) .attr('aria-live', 'polite') diff --git a/app/templates/views/api-keys.html b/app/templates/views/api-keys.html index 5a187d27f..9da84d7de 100644 --- a/app/templates/views/api-keys.html +++ b/app/templates/views/api-keys.html @@ -8,9 +8,16 @@ {% block maincolumn_content %} -

- API keys -

+
+
+

+ API keys +

+
+ +

To connect to the API you will need to create an API Key. Each service can have multiple API Keys to allow @@ -44,10 +51,6 @@ {% endif %} {% endcall %} -

- {{ api_key(current_service.id, "Service ID", thing="service ID") }} {% endblock %} diff --git a/tests/app/main/views/test_api_keys.py b/tests/app/main/views/test_api_keys.py index a21905246..70ad47196 100644 --- a/tests/app/main/views/test_api_keys.py +++ b/tests/app/main/views/test_api_keys.py @@ -34,7 +34,7 @@ def test_should_show_empty_api_keys_page(app_, assert response.status_code == 200 assert 'You haven’t created any API keys yet' in response.get_data(as_text=True) - assert 'Create a new API key' in response.get_data(as_text=True) + assert 'Create new API key' in response.get_data(as_text=True) mock_get_no_api_keys.assert_called_once_with(service_id=service_id) From 63995e7273317608ea85c1afb0fe2b3fe8464972 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 25 Apr 2016 11:16:00 +0100 Subject: [PATCH 3/3] Make wording around multiple API keys clearer --- app/templates/views/api-keys.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/templates/views/api-keys.html b/app/templates/views/api-keys.html index 9da84d7de..4fa1267c4 100644 --- a/app/templates/views/api-keys.html +++ b/app/templates/views/api-keys.html @@ -20,8 +20,12 @@

- To connect to the API you will need to create an API Key. Each service can have multiple API Keys to allow - for test and live environments. + To connect to the API you need to create an API Key. +

+

+ Each service can have multiple API Keys. This allows you to integrate a + number of systems, each with its own key. You can also have separate + keys for your development and test environments.