mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
Filter should be case insensitive. Closes #25
This commit is contained in:
parent
1291a664b7
commit
d9c1c6cb78
@ -39,7 +39,7 @@ export default class FeatureListComponent extends React.PureComponent {
|
||||
}
|
||||
|
||||
setFilter (v) {
|
||||
this.props.updateSetting('filter', typeof v === 'string' ? v.trim() : '');
|
||||
this.props.updateSetting('filter', typeof v === 'string' ? v : '');
|
||||
}
|
||||
|
||||
setSort (v) {
|
||||
|
@ -11,11 +11,12 @@ const mapStateToProps = (state) => {
|
||||
const settings = state.settings.toJS().feature || {};
|
||||
let features = state.features.toJS();
|
||||
if (settings.filter) {
|
||||
const regex = new RegExp(settings.filter, 'i');
|
||||
features = features.filter(feature =>
|
||||
(
|
||||
feature.name.indexOf(settings.filter) > -1 ||
|
||||
feature.description.indexOf(settings.filter) > -1 ||
|
||||
feature.strategies.some(s => s && s.name && s.name.indexOf(settings.filter) > -1)
|
||||
regex.test(feature.name) ||
|
||||
regex.test(feature.description) ||
|
||||
feature.strategies.some(s => s && s.name && regex.test(s.name))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user