Browse Source

ui: Quote service names when filtering for intentions (#7888)

* ui: Quote service names for intention filtering

* ui: return null if we ever get an error with anything else
pull/7889/head
John Cowen 5 years ago committed by GitHub
parent
commit
2f7c4cbf86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      ui-v2/app/routes/dc/services/show.js
  2. 2
      ui-v2/app/services/repository/intention.js
  3. 20
      ui-v2/tests/acceptance/dc/services/show/intentions-error.feature
  4. 10
      ui-v2/tests/acceptance/steps/dc/services/show/intentions-error-steps.js

6
ui-v2/app/routes/dc/services/show.js

@ -25,7 +25,11 @@ export default Route.extend({
)
? model
: hash({
intentions: this.intentionRepo.findByService(params.name, dc, nspace),
intentions: this.intentionRepo
.findByService(params.name, dc, nspace)
.catch(function() {
return null;
}),
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

2
ui-v2/app/services/repository/intention.js

@ -12,7 +12,7 @@ export default RepositoryService.extend({
const query = {
dc: dc,
nspace: nspace,
filter: `SourceName == ${slug} or DestinationName == ${slug}`,
filter: `SourceName == "${slug}" or DestinationName == "${slug}"`,
};
if (typeof configuration.cursor !== 'undefined') {
query.index = configuration.cursor;

20
ui-v2/tests/acceptance/dc/services/show/intentions-error.feature

@ -0,0 +1,20 @@
@setupApplicationTest
Feature: dc / services / intentions-error: An error with intentions doesn't 500 the page
Scenario:
Given 1 datacenter model with the value "dc1"
And 1 node model
And 1 service model from yaml
---
- Service:
Kind: ~
Name: service-0
ID: service-0-with-id
---
And the url "/v1/connect/intentions" responds with a 500 status
When I visit the service page for yaml
---
dc: dc1
service: service-0
---
And the title should be "service-0 - Consul"
And I see 1 instance model

10
ui-v2/tests/acceptance/steps/dc/services/show/intentions-error-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);
});
}
Loading…
Cancel
Save