ui: allow searching services by admin-partition (#13650)

This commit is contained in:
Michael Klein 2022-06-30 18:24:52 +02:00 committed by GitHub
parent ef21100435
commit 65b0faf96b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 1 deletions

View File

@ -2,4 +2,5 @@ export default {
Name: item => item.Name, Name: item => item.Name,
Tags: item => item.Tags || [], Tags: item => item.Tags || [],
PeerName: item => item.PeerName, PeerName: item => item.PeerName,
Partition: item => item.Partition,
}; };

View File

@ -60,4 +60,39 @@ module('Unit | Search | Predicate | service', function() {
).search('hit'); ).search('hit');
assert.equal(actual.length, 0); 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'
);
});
}); });

View File

@ -47,6 +47,7 @@ consul:
readreplica: Read replica readreplica: Read replica
redundancyzone: Redundancy zone redundancyzone: Redundancy zone
peername: Peer peername: Peer
partition: Admin Partitions
search: search:
search: Search search: Search
searchproperty: Search Across searchproperty: Search Across

View File

@ -54,7 +54,7 @@
kind: 'kind', kind: 'kind',
searchproperty: { searchproperty: {
as: 'searchproperty', as: 'searchproperty',
empty: [['Name', 'Tags', 'PeerName']], empty: [['Partition', 'Name', 'Tags', 'PeerName']],
}, },
search: { search: {
as: 'filter', as: 'filter',