mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
ui: Add ability to search nodes listing page with IP Address (#7204)
* Update search field placeholder to display `Search` * Add an acceptance test to search node listings with node name and IP Address * Update and add unit tests for filter/search node listing with IP Address
This commit is contained in:
parent
c706089c9f
commit
773b092a64
@ -4,6 +4,9 @@ export default function(filterable) {
|
||||
const sLower = s.toLowerCase();
|
||||
return (
|
||||
get(item, 'Node')
|
||||
.toLowerCase()
|
||||
.indexOf(sLower) !== -1 ||
|
||||
get(item, 'Address')
|
||||
.toLowerCase()
|
||||
.indexOf(sLower) !== -1
|
||||
);
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{!<form>}}
|
||||
{{freetext-filter searchable=searchable value=search placeholder="Search by name"}}
|
||||
{{freetext-filter searchable=searchable value=search placeholder="Search"}}
|
||||
{{radio-group keyboardAccess=true name="status" value=status items=(array
|
||||
(hash label='All (Any Status)' value='' )
|
||||
(hash label='Critical Checks' value='critical')
|
||||
|
@ -50,3 +50,30 @@ Feature: dc / nodes / index
|
||||
Then the url should be /dc-1/nodes
|
||||
Then I see 3 node models
|
||||
And I see leader on the healthyNodes
|
||||
Scenario: Searching the nodes with name and IP address
|
||||
Given 3 node models from yaml
|
||||
---
|
||||
- Node: node-01
|
||||
Address: 10.0.0.0
|
||||
- Node: node-02
|
||||
Address: 10.0.0.1
|
||||
- Node: node-03
|
||||
Address: 10.0.0.2
|
||||
---
|
||||
When I visit the nodes page for yaml
|
||||
---
|
||||
dc: dc-1
|
||||
---
|
||||
And I see 3 node models
|
||||
Then I fill in with yaml
|
||||
---
|
||||
s: node-01
|
||||
---
|
||||
And I see 1 node model
|
||||
And I see 1 node model with the name "node-01"
|
||||
Then I fill in with yaml
|
||||
---
|
||||
s: 10.0.0.1
|
||||
---
|
||||
And I see 1 node model
|
||||
And I see 1 node model with the name "node-02"
|
||||
|
@ -3,10 +3,11 @@ import { module, test } from 'qunit';
|
||||
|
||||
module('Unit | Search | Filter | node', function() {
|
||||
const filter = getFilter(cb => cb);
|
||||
test('items are found by properties', function(assert) {
|
||||
test('items are found by name', function(assert) {
|
||||
[
|
||||
{
|
||||
Node: 'node-HIT',
|
||||
Address: '10.0.0.0',
|
||||
},
|
||||
].forEach(function(item) {
|
||||
const actual = filter(item, {
|
||||
@ -15,10 +16,24 @@ module('Unit | Search | Filter | node', function() {
|
||||
assert.ok(actual);
|
||||
});
|
||||
});
|
||||
test('items are not found', function(assert) {
|
||||
test('items are found by IP address', function(assert) {
|
||||
[
|
||||
{
|
||||
Node: 'node-HIT',
|
||||
Address: '10.0.0.0',
|
||||
},
|
||||
].forEach(function(item) {
|
||||
const actual = filter(item, {
|
||||
s: '10',
|
||||
});
|
||||
assert.ok(actual);
|
||||
});
|
||||
});
|
||||
test('items are not found by name', function(assert) {
|
||||
[
|
||||
{
|
||||
Node: 'name',
|
||||
Address: '10.0.0.0',
|
||||
},
|
||||
].forEach(function(item) {
|
||||
const actual = filter(item, {
|
||||
@ -27,4 +42,17 @@ module('Unit | Search | Filter | node', function() {
|
||||
assert.notOk(actual);
|
||||
});
|
||||
});
|
||||
test('items are not found by IP address', function(assert) {
|
||||
[
|
||||
{
|
||||
Node: 'name',
|
||||
Address: '10.0.0.0',
|
||||
},
|
||||
].forEach(function(item) {
|
||||
const actual = filter(item, {
|
||||
s: '9',
|
||||
});
|
||||
assert.notOk(actual);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user