From ed201c3f1759d6d9283bcad551ef2e4aae4c5497 Mon Sep 17 00:00:00 2001 From: Kenia <19161242+kaxcode@users.noreply.github.com> Date: Tue, 12 May 2020 08:06:08 -0400 Subject: [PATCH] ui: Add and use ProxyFor to get the `connected with proxy` boolean (#7820) * Add and use ProxyFor to get the `connected with proxy` boolean * Fix up page-navigation test * Upgrade to @hashicorp/consul-api-double@2.14.7 --- ui-v2/app/controllers/dc/services/index.js | 8 +++++++- ui-v2/app/models/service.js | 1 + ui-v2/tests/acceptance/page-navigation.feature | 2 +- ui-v2/yarn.lock | 6 +++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ui-v2/app/controllers/dc/services/index.js b/ui-v2/app/controllers/dc/services/index.js index c1a4e6d42..4f3a1185c 100644 --- a/ui-v2/app/controllers/dc/services/index.js +++ b/ui-v2/app/controllers/dc/services/index.js @@ -32,7 +32,13 @@ export default Controller.extend(WithEventSource, WithSearching, { return item.Kind === 'connect-proxy'; }) .forEach(item => { - proxies[item.Name.replace('-proxy', '')] = true; + // Iterating to cover the usecase of a proxy being + // used by more than one service + if (item.ProxyFor) { + item.ProxyFor.forEach(service => { + proxies[service] = true; + }); + } }); return proxies; diff --git a/ui-v2/app/models/service.js b/ui-v2/app/models/service.js index 49b04c2ac..611031f04 100644 --- a/ui-v2/app/models/service.js +++ b/ui-v2/app/models/service.js @@ -14,6 +14,7 @@ export default Model.extend({ }, }), InstanceCount: attr('number'), + ProxyFor: attr(), Kind: attr('string'), ExternalSources: attr(), Meta: attr(), diff --git a/ui-v2/tests/acceptance/page-navigation.feature b/ui-v2/tests/acceptance/page-navigation.feature index 007fdfb2a..f4e0e15b5 100644 --- a/ui-v2/tests/acceptance/page-navigation.feature +++ b/ui-v2/tests/acceptance/page-navigation.feature @@ -42,7 +42,7 @@ Feature: page-navigation Where: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | Item | Model | URL | Endpoint | Back | - | service | services | /dc-1/services/service-0-terminating-gateway/instances | /v1/discovery-chain/service-0-terminating-gateway?dc=dc-1&ns=@namespace | /dc-1/services | + | service | services | /dc-1/services/service-0/instances | /v1/discovery-chain/service-0?dc=dc-1&ns=@namespace | /dc-1/services | | node | nodes | /dc-1/nodes/node-0/health-checks | /v1/session/node/node-0?dc=dc-1&ns=@namespace | /dc-1/nodes | | kv | kvs | /dc-1/kv/0-key-value/edit | /v1/session/info/ee52203d-989f-4f7a-ab5a-2bef004164ca?dc=dc-1&ns=@namespace | /dc-1/kv | # | acl | acls | /dc-1/acls/anonymous | /v1/acl/info/anonymous?dc=dc-1 | /dc-1/acls | diff --git a/ui-v2/yarn.lock b/ui-v2/yarn.lock index f19900d10..eb4a17664 100644 --- a/ui-v2/yarn.lock +++ b/ui-v2/yarn.lock @@ -1211,9 +1211,9 @@ js-yaml "^3.13.1" "@hashicorp/consul-api-double@^2.6.2": - version "2.14.4" - resolved "https://registry.yarnpkg.com/@hashicorp/consul-api-double/-/consul-api-double-2.14.4.tgz#cc68c500f934d9ac76292797f845e78b9e3c4fcb" - integrity sha512-6GXHlSKr822CPuAz7jWBDZE4KAxKNSFt/2RA0Z7q6HAHu0O3NTd14vZweO30hS1yusyVEI9RLd9OvgMbv5WXhA== + version "2.14.7" + resolved "https://registry.yarnpkg.com/@hashicorp/consul-api-double/-/consul-api-double-2.14.7.tgz#80cd19461a3f3716bf76ba28bcabff842bcd9aef" + integrity sha512-QjpwvrraUswn/hFh+9lIKuA9keCGOkh1yr/cT3I6fDiw4JKLyDLaRN8bF/JNGtgoA/SsQh10L1YI3feZ7M3VKw== "@hashicorp/ember-cli-api-double@^3.0.2": version "3.0.2"