Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Hides the Routing tab for a service proxy #7195

Merged
merged 1 commit into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ui-v2/app/routes/dc/services/show.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import { hash } from 'rsvp';
import { get } from '@ember/object';

export default Route.extend({
repo: service('repository/service'),
Expand All @@ -17,9 +18,15 @@ export default Route.extend({
const nspace = this.modelFor('nspace').nspace.substr(1);
return hash({
item: this.repo.findBySlug(params.name, dc, nspace),
chain: this.chainRepo.findBySlug(params.name, dc, nspace),
urls: this.settings.findBySlug('urls'),
dc: dc,
}).then(model => {
return hash({
chain: ['connect-proxy', 'mesh-gateway'].includes(get(model, 'item.Service.Kind'))
? null
: this.chainRepo.findBySlug(params.name, dc, nspace),
...model,
});
});
},
setupController: function(controller, model) {
Expand Down
8 changes: 4 additions & 4 deletions ui-v2/app/templates/dc/services/show.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
items=(compact
(array
'Instances'
'Routing'
(if chain 'Routing' '')
'Tags'
)
)
Expand All @@ -45,9 +45,9 @@
{{#each
(compact
(array
(hash id=(slugify 'Instances') partial='dc/services/instances')
(hash id=(slugify 'Routing') partial='dc/services/routing')
(hash id=(slugify 'Tags') partial='dc/services/tags')
(hash id=(slugify 'Instances') partial='dc/services/instances')
(if chain (hash id=(slugify 'Routing') partial='dc/services/routing') '')
(hash id=(slugify 'Tags') partial='dc/services/tags')
)
) as |panel|
}}
Expand Down
37 changes: 37 additions & 0 deletions ui-v2/tests/acceptance/dc/services/show-routing.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@setupApplicationTest
Feature: dc / services / Show Routing for Serivce
Scenario: Given a service, the Routing tab should display
Given 1 datacenter model with the value "dc1"
And 1 node models
And 1 service model from yaml
---
- Service:
Kind: consul
Name: service-0
ID: service-0-with-id
---
When I visit the service page for yaml
---
dc: dc1
service: service-0
---
And the title should be "service-0 - Consul"
And I see routing on the tabs
Scenario: Given a service proxy, the Routing tab should not display
Given 1 datacenter model with the value "dc1"
And 1 node models
And 1 service model from yaml
---
- Service:
Kind: connect-proxy
Name: service-0-proxy
ID: service-0-proxy-with-id
---
When I visit the service page for yaml
---
dc: dc1
service: service-0-proxy
---
And the title should be "service-0-proxy - Consul"
And I don't see routing on the tabs

10 changes: 10 additions & 0 deletions ui-v2/tests/acceptance/steps/dc/services/show-routing-steps.js
Original file line number Diff line number Diff line change
@@ -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);
});
}
6 changes: 4 additions & 2 deletions ui-v2/tests/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ const roleSelector = roleSelectorFactory(clickable, deletable, collection, alias
export default {
index: create(index(visitable, collection)),
dcs: create(dcs(visitable, clickable, attribute, collection)),
services: create(services(visitable, clickable, attribute, collection, page, catalogFilter)),
service: create(service(visitable, attribute, collection, text, catalogFilter)),
services: create(
services(visitable, clickable, attribute, collection, page, catalogFilter, radiogroup)
),
service: create(service(visitable, attribute, collection, text, catalogFilter, radiogroup)),
instance: create(instance(visitable, attribute, collection, text, radiogroup)),
nodes: create(nodes(visitable, clickable, attribute, collection, catalogFilter)),
node: create(node(visitable, deletable, clickable, attribute, collection, radiogroup)),
Expand Down
3 changes: 2 additions & 1 deletion ui-v2/tests/pages/dc/services/show.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function(visitable, attribute, collection, text, filter) {
export default function(visitable, attribute, collection, text, filter, radiogroup) {
return {
visit: visitable('/:dc/services/:service'),
externalSource: attribute('data-test-external-source', 'h1 span'),
Expand All @@ -8,6 +8,7 @@ export default function(visitable, attribute, collection, text, filter) {
dashboardAnchor: {
href: attribute('href', '[data-test-dashboard-anchor]'),
},
tabs: radiogroup('tab', ['instances', 'routing', 'tags']),
filter: filter,
};
}