diff --git a/ui/packages/consul-ui/app/search/predicates/service.js b/ui/packages/consul-ui/app/search/predicates/service.js index f46529769a..63d2d17901 100644 --- a/ui/packages/consul-ui/app/search/predicates/service.js +++ b/ui/packages/consul-ui/app/search/predicates/service.js @@ -2,4 +2,5 @@ export default { Name: item => item.Name, Tags: item => item.Tags || [], PeerName: item => item.PeerName, + Partition: item => item.Partition, }; diff --git a/ui/packages/consul-ui/tests/unit/search/predicates/service-test.js b/ui/packages/consul-ui/tests/unit/search/predicates/service-test.js index 1f3bd0ade8..f33921cb20 100644 --- a/ui/packages/consul-ui/tests/unit/search/predicates/service-test.js +++ b/ui/packages/consul-ui/tests/unit/search/predicates/service-test.js @@ -60,4 +60,39 @@ module('Unit | Search | Predicate | service', function() { ).search('hit'); assert.equal(actual.length, 0); }); + test('items can be found by Partition', function(assert) { + const search = new ExactSearch( + [ + { + Name: 'name-a', + Partition: 'default', + }, + { + Name: 'name-b', + Partition: 'lorem-ipsum', + }, + ], + { + finders: predicates, + } + ); + + assert.deepEqual( + search.search('').map(i => i.Name), + ['name-a', 'name-b'], + 'both items included in search' + ); + + assert.deepEqual( + search.search('def').map(i => i.Name), + ['name-a'], + 'only item from default partition is included' + ); + + assert.deepEqual( + search.search('tomster').map(i => i.Name), + [], + 'no item included when no Partition matches' + ); + }); }); diff --git a/ui/packages/consul-ui/translations/common/en-us.yaml b/ui/packages/consul-ui/translations/common/en-us.yaml index 5d10766dfe..d45545c3c0 100644 --- a/ui/packages/consul-ui/translations/common/en-us.yaml +++ b/ui/packages/consul-ui/translations/common/en-us.yaml @@ -47,6 +47,7 @@ consul: readreplica: Read replica redundancyzone: Redundancy zone peername: Peer + partition: Admin Partitions search: search: Search searchproperty: Search Across diff --git a/ui/packages/consul-ui/vendor/consul-ui/routes.js b/ui/packages/consul-ui/vendor/consul-ui/routes.js index 426fccbf2d..e78193d952 100644 --- a/ui/packages/consul-ui/vendor/consul-ui/routes.js +++ b/ui/packages/consul-ui/vendor/consul-ui/routes.js @@ -54,7 +54,7 @@ kind: 'kind', searchproperty: { as: 'searchproperty', - empty: [['Name', 'Tags', 'PeerName']], + empty: [['Partition', 'Name', 'Tags', 'PeerName']], }, search: { as: 'filter',