Merge pull request #4223 from hashicorp/feature/search-acls-by-token

UI - Search ACLs by token aswell as name
This commit is contained in:
John Cowen 2018-06-14 16:52:26 +01:00 committed by GitHub
commit b11e342f2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 4 deletions

View File

@ -28,10 +28,14 @@ export default Controller.extend(WithFiltering, {
});
}),
filter: function(item, { s = '', type = '' }) {
const sLower = s.toLowerCase();
return (
get(item, 'Name')
(get(item, 'Name')
.toLowerCase()
.indexOf(s.toLowerCase()) !== -1 &&
.indexOf(sLower) !== -1 ||
get(item, 'ID')
.toLowerCase()
.indexOf(sLower) !== -1) &&
(type === '' || get(item, 'Type') === type)
);
},

View File

@ -1,4 +1,4 @@
{{!<form>}}
{{freetext-filter onchange=(action onchange) value=search placeholder="Search by name"}}
{{freetext-filter onchange=(action onchange) value=search placeholder="Search by name/token"}}
{{radio-group name="type" value=type items=filters onchange=(action onchange)}}
{{!</form>}}

View File

@ -1,5 +1,8 @@
@setupApplicationTest
Feature: Acl Filter
Feature: dc / components /acl filter: Acl Filter
In order to find the acl token I'm looking for easier
As a user
I should be able to filter by type and freetext search tokens by name and token
Scenario: Filtering [Model]
Given 1 datacenter model with the value "dc-1"
And 2 [Model] models
@ -27,6 +30,11 @@ Feature: Acl Filter
s: Anonymous Token
---
And I see 1 [Model] model with the name "Anonymous Token"
Then I type with yaml
---
s: secret
---
And I see 1 [Model] model with the name "Master Token"
Where:
-------------------------------------------------