Skip to content

Commit

Permalink
ui: Redesign - Gateway Instances List page (#7796)
Browse files Browse the repository at this point in the history
* Hide Nav in Instances page for Gateway services

* Fix up tests to have mocked Services with no Kind attribute

* Upgrade consul-api-double to 2.14.4
  • Loading branch information
kaxcode authored May 6, 2020
1 parent db8ace6 commit 9f97b42
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ui-v2/app/routes/dc/services/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ export default Route.extend({
const nspace = this.modelFor('nspace').nspace.substr(1);
return hash({
item: this.repo.findBySlug(params.name, dc, nspace),
intentions: this.intentionRepo.findByService(params.name, dc, nspace),
urls: this.settings.findBySlug('urls'),
dc: dc,
proxies: [],
}).then(model => {
return ['connect-proxy', 'mesh-gateway'].includes(get(model, 'item.Service.Kind'))
? model
: hash({
intentions: this.intentionRepo.findByService(params.name, dc, nspace),
chain: this.chainRepo.findBySlug(params.name, dc, nspace).catch(function(e) {
const code = get(e, 'errors.firstObject.status');
// Currently we are specifically catching a 500, but we return null
Expand Down
2 changes: 2 additions & 0 deletions ui-v2/app/templates/dc/services/show.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</h1>
<ConsulExternalSource @item={{item.Service}} />
</div>
{{#if (not item.Service.Kind)}}
<TabNav @items={{
compact
(array
Expand All @@ -25,6 +26,7 @@
(hash label="Tags" href=(href-to "dc.services.show.tags") selected=(is-href "dc.services.show.tags"))
)
}}/>
{{/if}}
</BlockSlot>
<BlockSlot @name="actions">
{{#if urls.service}}
Expand Down
9 changes: 9 additions & 0 deletions ui-v2/tests/acceptance/dc/services/show.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: dc / services / show: Show Service
And 1 service model from yaml
---
- Service:
Kind: ~
Tags: ['Tag1', 'Tag2']
Meta:
external-source: consul
Expand All @@ -24,6 +25,7 @@ Feature: dc / services / show: Show Service
And 1 service model from yaml
---
- Service:
Kind: ~
Tags: ['Tag1', 'Tag2']
Meta:
external-source: 'not-supported'
Expand All @@ -40,17 +42,21 @@ Feature: dc / services / show: Show Service
And 1 service model from yaml
---
- Service:
Kind: ~
Tags: ['Tag1', 'Tag2']
- Service:
Kind: ~
Tags: ['Tag3', 'Tag1']
- Service:
Kind: ~
Tags: ['Tag2', 'Tag3']
---
When I visit the service page for yaml
---
dc: dc1
service: service-0
---
And pause for 3000
And I click tags on the tabs
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)"
Expand All @@ -63,18 +69,21 @@ Feature: dc / services / show: Show Service
- Checks:
- Status: passing
Service:
Kind: ~
ID: passing-service-8080
Port: 8080
Address: 1.1.1.1
Node:
Address: 1.2.2.2
- Service:
Kind: ~
ID: service-8000
Port: 8000
Address: 2.2.2.2
Node:
Address: 2.3.3.3
- Service:
Kind: ~
ID: service-8888
Port: 8888
Address: 3.3.3.3
Expand Down
2 changes: 1 addition & 1 deletion ui-v2/tests/acceptance/dc/services/show/intentions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Feature: dc / services / intentions: Intentions per service
And 1 service model from yaml
---
- Service:
Kind: consul
Kind: ~
Name: service-0
ID: service-0-with-id
---
Expand Down
6 changes: 3 additions & 3 deletions ui-v2/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1211,9 +1211,9 @@
js-yaml "^3.13.1"

"@hashicorp/consul-api-double@^2.6.2":
version "2.14.3"
resolved "https://registry.yarnpkg.com/@hashicorp/consul-api-double/-/consul-api-double-2.14.3.tgz#57974cd877cd457d660f1168abdfd0b3fc79ea1b"
integrity sha512-3E7aBFbeWWdCk3f07x5z3puGfV3DEyxrpElWD/J4NWxZIgJ92iYV2LKkLZ5u19UGAI5lVdhT3wYaBOqmC725pA==
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==

"@hashicorp/ember-cli-api-double@^3.0.2":
version "3.0.2"
Expand Down

0 comments on commit 9f97b42

Please sign in to comment.