From 4370e6a3469608db9a5fc516b39226eea5148683 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 4 May 2020 19:06:25 +0100 Subject: [PATCH] ui: Metadata cleanup (#7767) * Use new ConsulMetadataList for service > instance > metadata tab * Meta Data vs Metadata everywhere (Metadata is correct) * Fix up wording in tests --- ui-v2/app/router.js | 2 +- ui-v2/app/templates/dc/nodes/show.hbs | 2 +- ui-v2/app/templates/dc/services/-metadata.hbs | 7 ---- ui-v2/app/templates/dc/services/instance.hbs | 2 +- .../dc/services/instance/metadata.hbs | 37 ++++--------------- ui-v2/tests/acceptance/dc/nodes/show.feature | 4 +- .../dc/services/instances/show.feature | 6 +-- ui-v2/tests/pages/dc/nodes/show.js | 4 +- ui-v2/tests/pages/dc/services/instance.js | 4 +- 9 files changed, 20 insertions(+), 48 deletions(-) delete mode 100644 ui-v2/app/templates/dc/services/-metadata.hbs diff --git a/ui-v2/app/router.js b/ui-v2/app/router.js index 38e3101cc..da6514f63 100644 --- a/ui-v2/app/router.js +++ b/ui-v2/app/router.js @@ -70,7 +70,7 @@ export const routes = { _options: { path: '/lock-sessions' }, }, metadata: { - _options: { path: '/meta-data' }, + _options: { path: '/metadata' }, }, }, }, diff --git a/ui-v2/app/templates/dc/nodes/show.hbs b/ui-v2/app/templates/dc/nodes/show.hbs index 291e51e97..0e3f4c157 100644 --- a/ui-v2/app/templates/dc/nodes/show.hbs +++ b/ui-v2/app/templates/dc/nodes/show.hbs @@ -21,7 +21,7 @@ (hash label="Services" href=(href-to "dc.nodes.show.services") selected=(is-href "dc.nodes.show.services")) (if tomography.distances (hash label="Round Trip Time" href=(href-to "dc.nodes.show.rtt") selected=(is-href "dc.nodes.show.rtt")) '') (hash label="Lock Sessions" href=(href-to "dc.nodes.show.sessions") selected=(is-href "dc.nodes.show.sessions")) - (hash label="Meta Data" href=(href-to "dc.nodes.show.metadata") selected=(is-href "dc.nodes.show.metadata")) + (hash label="Metadata" href=(href-to "dc.nodes.show.metadata") selected=(is-href "dc.nodes.show.metadata")) ) }}/> diff --git a/ui-v2/app/templates/dc/services/-metadata.hbs b/ui-v2/app/templates/dc/services/-metadata.hbs deleted file mode 100644 index 8785b0341..000000000 --- a/ui-v2/app/templates/dc/services/-metadata.hbs +++ /dev/null @@ -1,7 +0,0 @@ -{{#if item.Meta}} - -{{else}} -

- This instance has no meta data. -

-{{/if}} diff --git a/ui-v2/app/templates/dc/services/instance.hbs b/ui-v2/app/templates/dc/services/instance.hbs index e27ffdc11..aa689ff7c 100644 --- a/ui-v2/app/templates/dc/services/instance.hbs +++ b/ui-v2/app/templates/dc/services/instance.hbs @@ -64,7 +64,7 @@ (hash label="Addresses" href=(href-to "dc.services.instance.addresses") selected=(is-href "dc.services.instance.addresses")) "" ) (hash label="Tags" href=(href-to "dc.services.instance.tags") selected=(is-href "dc.services.instance.tags")) - (hash label="Meta Data" href=(href-to "dc.services.instance.metadata") selected=(is-href "dc.services.instance.metadata")) + (hash label="Metadata" href=(href-to "dc.services.instance.metadata") selected=(is-href "dc.services.instance.metadata")) ) }}/> {{outlet}} diff --git a/ui-v2/app/templates/dc/services/instance/metadata.hbs b/ui-v2/app/templates/dc/services/instance/metadata.hbs index b21ed92fd..4a07a9a21 100644 --- a/ui-v2/app/templates/dc/services/instance/metadata.hbs +++ b/ui-v2/app/templates/dc/services/instance/metadata.hbs @@ -1,32 +1,11 @@ -
+
- {{#if item.Meta}} - {{#with (object-entries item.Meta) as |meta|}} - - - Key - Value - - - - - {{object-at 0 item}} - - - - {{object-at 1 item}} - - - - {{/with}} - {{else}} -

- This instance has no meta data. -

- {{/if}} +{{#if item.Meta}} + +{{else}} +

+ This instance has no meta data. +

+{{/if}}
- diff --git a/ui-v2/tests/acceptance/dc/nodes/show.feature b/ui-v2/tests/acceptance/dc/nodes/show.feature index c7ec3b21d..77ac77afc 100644 --- a/ui-v2/tests/acceptance/dc/nodes/show.feature +++ b/ui-v2/tests/acceptance/dc/nodes/show.feature @@ -20,8 +20,8 @@ Feature: dc / nodes / show: Show node When I click lockSessions on the tabs And I see lockSessionsIsSelected on the tabs - When I click metaData on the tabs - And I see metaDataIsSelected on the tabs + When I click metadata on the tabs + And I see metadataIsSelected on the tabs Scenario: Given 1 node all the tabs are visible and clickable and the RTT one isn't there Given 1 node models from yaml --- diff --git a/ui-v2/tests/acceptance/dc/services/instances/show.feature b/ui-v2/tests/acceptance/dc/services/instances/show.feature index 36a1de392..10b2e8d2a 100644 --- a/ui-v2/tests/acceptance/dc/services/instances/show.feature +++ b/ui-v2/tests/acceptance/dc/services/instances/show.feature @@ -68,9 +68,9 @@ Feature: dc / services / instances / show: Show Service Instance Then I see the text "Tag1" in "[data-test-tags] span:nth-child(1)" Then I see the text "Tag2" in "[data-test-tags] span:nth-child(2)" - When I click metaData on the tabs - And I see metaDataIsSelected on the tabs - And I see 3 of the metaData object + When I click metadata on the tabs + And I see metadataIsSelected on the tabs + And I see 3 of the metadata object And the title should be "service-0-with-id - Consul" Scenario: A Service instance warns when deregistered whilst blocking diff --git a/ui-v2/tests/pages/dc/nodes/show.js b/ui-v2/tests/pages/dc/nodes/show.js index 6c85e1257..aad9470f7 100644 --- a/ui-v2/tests/pages/dc/nodes/show.js +++ b/ui-v2/tests/pages/dc/nodes/show.js @@ -6,7 +6,7 @@ export default function(visitable, deletable, clickable, attribute, collection, 'services', 'round-trip-time', 'lock-sessions', - 'meta-data', + 'metadata', ]), healthchecks: collection('[data-test-node-healthcheck]', { name: attribute('data-test-node-healthcheck'), @@ -23,6 +23,6 @@ export default function(visitable, deletable, clickable, attribute, collection, TTL: attribute('data-test-session-ttl', '[data-test-session-ttl]'), }) ), - metaData: collection('#meta-data [data-test-tabular-row]', {}), + metadata: collection('#metadata [data-test-tabular-row]', {}), }; } diff --git a/ui-v2/tests/pages/dc/services/instance.js b/ui-v2/tests/pages/dc/services/instance.js index f61e4d144..78ded4f78 100644 --- a/ui-v2/tests/pages/dc/services/instance.js +++ b/ui-v2/tests/pages/dc/services/instance.js @@ -10,7 +10,7 @@ export default function(visitable, attribute, collection, text, tabs) { 'upstreams', 'exposed-paths', 'tags', - 'meta-data', + 'metadata', ]), serviceChecks: collection('[data-test-service-checks] li', { exposed: attribute('data-test-exposed', '[data-test-exposed]'), @@ -30,6 +30,6 @@ export default function(visitable, attribute, collection, text, tabs) { addresses: collection('#addresses [data-test-tabular-row]', { address: text('[data-test-address]'), }), - metaData: collection('#meta-data [data-test-tabular-row]', {}), + metadata: collection('#metadata [data-test-tabular-row]', {}), }; }