From f0a12b98189b1a1079cdfa659cca5cce70a04665 Mon Sep 17 00:00:00 2001 From: jasquat Date: Mon, 27 Mar 2023 11:25:55 -0400 Subject: [PATCH] allow searching multiple words when searching for process models w/ burnettk --- .../src/components/ProcessModelSearch.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessModelSearch.tsx b/spiffworkflow-frontend/src/components/ProcessModelSearch.tsx index b7debc6bb..21847bbf8 100644 --- a/spiffworkflow-frontend/src/components/ProcessModelSearch.tsx +++ b/spiffworkflow-frontend/src/components/ProcessModelSearch.tsx @@ -36,10 +36,17 @@ export default function ProcessModelSearch({ const shouldFilterProcessModel = (options: any) => { const processModel: ProcessModel = options.item; - const { inputValue } = options; - return getFullProcessModelLabel(processModel) - .toLowerCase() - .includes((inputValue || '').toLowerCase()); + let { inputValue } = options; + if (!inputValue) { + inputValue = ''; + } + const inputValueArray = inputValue.split(' '); + const processModelLowerCase = + getFullProcessModelLabel(processModel).toLowerCase(); + + return inputValueArray.every((i: any) => { + return processModelLowerCase.includes((i || '').toLowerCase()); + }); }; return (