1
0
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:
ivaosthu 2016-12-28 23:36:01 +01:00
parent 1291a664b7
commit d9c1c6cb78
2 changed files with 5 additions and 4 deletions

View File

@ -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) {

View File

@ -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))
)
);
}