Skip to content

Commit

Permalink
ui: Normal proxies line to services, sidecars to instances
Browse files Browse the repository at this point in the history
Folllowing on from #5933 we
noticed that 'normal' proxies should link to the service, rather than
the service instance. Additionally sideproxy 'searching' within the
repository should take into account the name of the node that the
originating service is on (sidecar proxies are generally co-located)

Added an additiojnal test here to prove that a sidecar-proxy with the
same service id but on a different node does not show the sidecar proxy
link.
  • Loading branch information
John Cowen committed Jun 11, 2019
1 parent 3c80d24 commit a9d9778
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ui-v2/app/services/repository/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default RepositoryService.extend({
return this.findAllBySlug(slug, dc, configuration).then(function(items) {
let res = {};
if (get(items, 'length') > 0) {
let instance = items.findBy('ServiceProxy.DestinationServiceID', id);
let instance = items.filterBy('ServiceProxy.DestinationServiceID', id).findBy('Node', node);
if (instance) {
res = instance;
} else {
Expand Down
9 changes: 7 additions & 2 deletions ui-v2/app/templates/dc/services/instance.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@
</dl>
{{#if proxy.ServiceName}}
<dl>
<dt data-test-proxy-type="{{if proxy.ServiceProxy.DestinationServiceID "sidecar-proxy" "proxy"}}">{{if proxy.ServiceProxy.DestinationServiceID "Sidecar " ""}}Proxy</dt>
<dd><a href="{{href-to 'dc.services.instance' proxy.ServiceName proxy.ServiceID}}">{{proxy.ServiceID}}</a></dd>
{{#if proxy.ServiceProxy.DestinationServiceID}}
<dt data-test-proxy-type="sidecar-proxy">Sidecar Proxy</dt>
<dd><a href="{{href-to 'dc.services.instance' proxy.ServiceName proxy.Node proxy.ServiceID}}">{{proxy.ServiceID}}</a></dd>
{{else}}
<dt data-test-proxy-type="proxy">Proxy</dt>
<dd><a href="{{href-to 'dc.services.show' proxy.ServiceName}}">{{proxy.ServiceName}}</a></dd>
{{/if}}
</dl>
{{/if}}
{{#if (eq item.Kind 'connect-proxy')}}
Expand Down
25 changes: 22 additions & 3 deletions ui-v2/tests/acceptance/dc/services/instances/with-sidecar.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ Feature: dc / services / instances / with-sidecar: Show Service Instance with a
Given 1 datacenter model with the value "dc1"
And 1 proxy model from yaml
---
- ServiceProxy:
DestinationServiceID: service-1
- Node: node-0
ServiceProxy:
DestinationServiceID: service-0-with-id
DestinationServiceName: ~
---
When I visit the instance page for yaml
---
Expand All @@ -16,8 +18,25 @@ Feature: dc / services / instances / with-sidecar: Show Service Instance with a
---
Then the url should be /dc1/services/service-0/node-0/service-0-with-id
And I see type on the proxy like "sidecar-proxy"

And I see serviceChecksIsSelected on the tabs
And I don't see upstreams on the tabs
Scenario: A Service instance has no Sidecar Proxy (a DestinationServiceID) on the same node
Given 1 datacenter model with the value "dc1"
And 1 proxy model from yaml
---
- Node: node-1
ServiceProxy:
DestinationServiceID: service-0-with-id
DestinationServiceName: ~
---
When I visit the instance page for yaml
---
dc: dc1
service: service-0
node: node-0
id: service-0-with-id
---
Then the url should be /dc1/services/service-0/node-0/service-0-with-id
Then I don't see type on the proxy


0 comments on commit a9d9778

Please sign in to comment.