Skip to content

Commit

Permalink
ui: Adds the ability to frontend search instances by address (ip:port) (
Browse files Browse the repository at this point in the history
  • Loading branch information
johncowen authored and John Cowen committed Sep 4, 2019
1 parent 01d1b3c commit 6d8a706
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ui-v2/app/search/filters/service/node.js
Expand Up @@ -8,7 +8,8 @@ export default function(filterable) {
.indexOf(term) !== -1 ||
get(item, 'Service.ID')
.toLowerCase()
.indexOf(term) !== -1
.indexOf(term) !== -1 ||
`${get(item, 'Service.Address')}:${get(item, 'Service.Port')}`.indexOf(term) !== -1
);
});
}
18 changes: 18 additions & 0 deletions ui-v2/tests/unit/search/filters/service/node-test.js
Expand Up @@ -29,6 +29,24 @@ test('items are found by properties', function(assert) {
assert.ok(actual);
});
});
test('items are found by address:port', function(assert) {
const instance = {
Service: {
ID: 'id',
Address: '0.0.0.0',
Port: 8000,
},
Node: {
Node: 'node-0',
},
};
['0.0.0.0', '8000', '0:8000', '0.0.0.0:8000'].forEach(function(item) {
let actual = filter(instance, {
s: item,
});
assert.ok(actual);
});
});
test('items are not found', function(assert) {
[
{
Expand Down

0 comments on commit 6d8a706

Please sign in to comment.