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
This commit is contained in:
John Cowen 2020-05-14 17:18:24 +01:00 committed by GitHub
parent 07487220a5
commit 2f7c4cbf86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 2 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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);
});
}