diff --git a/packages/redux-devtools-inspector/src/ActionList.jsx b/packages/redux-devtools-inspector/src/ActionList.jsx index 66ce8a3b..36a9a141 100644 --- a/packages/redux-devtools-inspector/src/ActionList.jsx +++ b/packages/redux-devtools-inspector/src/ActionList.jsx @@ -85,7 +85,8 @@ export default class ActionList extends Component { startActionId, onSelect, onSearch, - searchValue, + searchInclude, + searchExclude, currentActionId, hideMainButtons, hideActionButtons, @@ -93,14 +94,14 @@ export default class ActionList extends Component { onSweep, onJumpToState } = this.props; - const lowerSearchValue = searchValue && searchValue.toLowerCase(); - const filteredActionIds = searchValue - ? actionIds.filter( - id => - actions[id].action.type.toLowerCase().indexOf(lowerSearchValue) !== - -1 - ) - : actionIds; + + const filteredActionIds = actionIds.filter(id => { + const type = actions[id].action.type.toLowerCase(); + return ( + searchExclude.every(searchData => !type.includes(searchData)) && + searchInclude.every(searchData => type.includes(searchData)) + ); + }); return (
{ - this.updateMonitorState({ searchValue: val }); + handleSearch = value => { + const segments = value.toLowerCase().trim().split(/\s+/); + const searchInclude = []; + const searchExclude = []; + + segments.forEach(segment => { + if (segment.charAt(0) === '-') { + if (segment.length > 1) { + searchExclude.push(segment.substr(1)); + } + } else { + searchInclude.push(segment); + } + }); + + this.updateMonitorState({ searchInclude, searchExclude }); }; handleSelectAction = (e, actionId) => { diff --git a/packages/redux-devtools-inspector/src/redux.js b/packages/redux-devtools-inspector/src/redux.js index 92033375..f9aeb81f 100644 --- a/packages/redux-devtools-inspector/src/redux.js +++ b/packages/redux-devtools-inspector/src/redux.js @@ -5,7 +5,9 @@ export const DEFAULT_STATE = { startActionId: null, inspectedActionPath: [], inspectedStatePath: [], - tabName: 'Diff' + tabName: 'Diff', + searchInclude: [], + searchExclude: [] }; export function updateMonitorState(monitorState) {