diff --git a/ui-v2/app/services/services.js b/ui-v2/app/services/services.js
index 62cf2fa4d..7e92a418a 100644
--- a/ui-v2/app/services/services.js
+++ b/ui-v2/app/services/services.js
@@ -21,6 +21,12 @@ export default Service.extend({
.then(function(item) {
const nodes = get(item, 'Nodes');
const service = get(nodes, 'firstObject');
+ const tags = nodes
+ .reduce(function(prev, item) {
+ return prev.concat(get(item, 'Service.Tags') || []);
+ }, [])
+ .uniq();
+ set(service, 'Tags', tags);
set(service, 'Nodes', nodes);
return service;
});
diff --git a/ui-v2/app/templates/dc/services/show.hbs b/ui-v2/app/templates/dc/services/show.hbs
index 5f6ba6a21..23dc23af9 100644
--- a/ui-v2/app/templates/dc/services/show.hbs
+++ b/ui-v2/app/templates/dc/services/show.hbs
@@ -15,11 +15,11 @@
{{/if}}
{{/block-slot}}
{{#block-slot 'content'}}
-{{#if (gt item.Service.Tags.length 0)}}
+{{#if (gt item.Tags.length 0)}}
- Tags
- -
- {{join ', ' item.Service.Tags}}
+
-
+ {{join ', ' item.Tags}}
{{/if}}
diff --git a/ui-v2/tests/acceptance/dc/services/show.feature b/ui-v2/tests/acceptance/dc/services/show.feature
new file mode 100644
index 000000000..29daba7b6
--- /dev/null
+++ b/ui-v2/tests/acceptance/dc/services/show.feature
@@ -0,0 +1,22 @@
+@setupApplicationTest
+Feature: dc / services / show: Show Service
+ Scenario: Given various service with various tags, all tags are displayed
+ Given 1 datacenter model with the value "dc1"
+ And 3 node models
+ And 1 service model from yaml
+ ---
+ - Service:
+ Tags: ['Tag1', 'Tag2']
+ - Service:
+ Tags: ['Tag3', 'Tag1']
+ - Service:
+ Tags: ['Tag2', 'Tag3']
+ ---
+ When I visit the service page for yaml
+ ---
+ dc: dc1
+ service: service-0
+ ---
+ Then I see the text "Tag1, Tag2, Tag3" in "[data-test-tags]"
+ Then ok
+
diff --git a/ui-v2/tests/acceptance/steps/dc/services/show-steps.js b/ui-v2/tests/acceptance/steps/dc/services/show-steps.js
new file mode 100644
index 000000000..a7eff3228
--- /dev/null
+++ b/ui-v2/tests/acceptance/steps/dc/services/show-steps.js
@@ -0,0 +1,10 @@
+import steps from '../../steps';
+
+// step definitions that are shared between features should be moved to the
+// tests/acceptance/steps/steps.js file
+
+export default function(assert) {
+ return steps(assert).then('I should find a file', function() {
+ assert.ok(true, this.step);
+ });
+}
diff --git a/ui-v2/tests/helpers/type-to-url.js b/ui-v2/tests/helpers/type-to-url.js
index 68446a8b7..6fa84bbbb 100644
--- a/ui-v2/tests/helpers/type-to-url.js
+++ b/ui-v2/tests/helpers/type-to-url.js
@@ -2,22 +2,30 @@ export default function(type) {
let url = null;
switch (type) {
case 'dc':
- url = '/v1/catalog/datacenters';
+ url = ['/v1/catalog/datacenters'];
break;
case 'service':
- url = '/v1/internal/ui/services';
+ url = ['/v1/internal/ui/services', '/v1/health/service/'];
break;
case 'node':
- url = '/v1/internal/ui/nodes';
- // url = '/v1/health/service/_';
+ url = ['/v1/internal/ui/nodes'];
break;
case 'kv':
url = '/v1/kv/';
break;
case 'acl':
- url = '/v1/acl/list';
- // url = '/v1/acl/info/_';
+ url = ['/v1/acl/list'];
break;
}
- return url;
+ return function(actual) {
+ if (url === null) {
+ return false;
+ }
+ if (typeof url === 'string') {
+ return url === actual;
+ }
+ return url.some(function(item) {
+ return actual.indexOf(item) === 0;
+ });
+ };
}
diff --git a/ui-v2/tests/steps.js b/ui-v2/tests/steps.js
index 4a429f6bb..990c313bf 100644
--- a/ui-v2/tests/steps.js
+++ b/ui-v2/tests/steps.js
@@ -1,6 +1,6 @@
/* eslint no-console: "off" */
import yadda from './helpers/yadda';
-import { currentURL, click, triggerKeyEvent } from '@ember/test-helpers';
+import { currentURL, click, triggerKeyEvent, find } from '@ember/test-helpers';
import getDictionary from '@hashicorp/ember-cli-api-double/dictionary';
import pages from 'consul-ui/tests/pages';
import api from 'consul-ui/tests/helpers/api';
@@ -38,14 +38,14 @@ export default function(assert) {
}, yadda)
)
// doubles
- .given(['$number $model model', '$number $model models'], function(number, model) {
+ .given(['$number $model model[s]?', '$number $model models'], function(number, model) {
return create(number, model);
})
- .given(['$number $model model with the value "$value"'], function(number, model, value) {
+ .given(['$number $model model[s]? with the value "$value"'], function(number, model, value) {
return create(number, model, value);
})
.given(
- ['$number $model model[s]? from yaml\n$yaml', '$number $model model from json\n$json'],
+ ['$number $model model[s]? from yaml\n$yaml', '$number $model model[s]? from json\n$json'],
function(number, model, data) {
return create(number, model, data);
}
@@ -273,6 +273,12 @@ export default function(assert) {
.then(['I see $property'], function(property, component) {
assert.ok(currentPage[property], `Expected to see ${property}`);
})
+ .then(['I see the text "$text" in "$selector"'], function(text, selector) {
+ assert.ok(
+ find(selector).textContent.indexOf(text) !== -1,
+ `Expected to see "${text}" in "${selector}"`
+ );
+ })
.then('ok', function() {
assert.ok(true);
})
diff --git a/ui-v2/yarn.lock b/ui-v2/yarn.lock
index c760ef53b..c712625d4 100644
--- a/ui-v2/yarn.lock
+++ b/ui-v2/yarn.lock
@@ -70,8 +70,8 @@
"@glimmer/di" "^0.2.0"
"@hashicorp/api-double@^1.1.0":
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/@hashicorp/api-double/-/api-double-1.1.0.tgz#299d3c560090dfe9c335db64d63c3ef0c5da79c4"
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/@hashicorp/api-double/-/api-double-1.2.0.tgz#d2846f79d086ac009673ae755da15301e0f2f7c3"
dependencies:
"@gardenhq/o" "^8.0.1"
"@gardenhq/tick-control" "^2.0.0"
@@ -5704,7 +5704,14 @@ js-yaml@0.3.x:
version "0.3.7"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-0.3.7.tgz#d739d8ee86461e54b354d6a7d7d1f2ad9a167f62"
-js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.2.5, js-yaml@^3.2.7, js-yaml@^3.6.1, js-yaml@^3.7.0, js-yaml@^3.8.4, js-yaml@^3.9.0, js-yaml@^3.9.1:
+js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.8.4:
+ version "3.12.0"
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
+ dependencies:
+ argparse "^1.0.7"
+ esprima "^4.0.0"
+
+js-yaml@^3.2.5, js-yaml@^3.2.7, js-yaml@^3.6.1, js-yaml@^3.7.0, js-yaml@^3.9.0, js-yaml@^3.9.1:
version "3.11.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef"
dependencies:
@@ -6711,8 +6718,8 @@ morgan@^1.8.1:
on-headers "~1.0.1"
mousetrap@^1.6.1:
- version "1.6.1"
- resolved "https://registry.yarnpkg.com/mousetrap/-/mousetrap-1.6.1.tgz#2a085f5c751294c75e7e81f6ec2545b29cbf42d9"
+ version "1.6.2"
+ resolved "https://registry.yarnpkg.com/mousetrap/-/mousetrap-1.6.2.tgz#caadd9cf886db0986fb2fee59a82f6bd37527587"
mout@^1.0.0:
version "1.1.0"