From 89589bf72302e7a4991a09e2e978543472417d35 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 20 Apr 2023 16:11:17 -0400 Subject: [PATCH] do not show full group path in process model search and do not attempt to convert a date to ymd if it is already ymd w/ burnettk --- .../src/components/ProcessModelSearch.tsx | 16 ++++++++++------ spiffworkflow-frontend/src/helpers.tsx | 16 +++++++++------- .../src/routes/ProcessInstanceShow.tsx | 3 --- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ProcessModelSearch.tsx b/spiffworkflow-frontend/src/components/ProcessModelSearch.tsx index 8b9d8e74b..3a6331a3d 100644 --- a/spiffworkflow-frontend/src/components/ProcessModelSearch.tsx +++ b/spiffworkflow-frontend/src/components/ProcessModelSearch.tsx @@ -28,10 +28,14 @@ export default function ProcessModelSearch({ return ''; }; - const getFullProcessModelLabel = (processModel: ProcessModel) => { - return `${getParentGroupsDisplayName(processModel)} / ${ - processModel.display_name - } (${processModel.id})`; + const getProcessModelLabelForDisplay = (processModel: ProcessModel) => { + return `${processModel.display_name} (${processModel.id})`; + }; + + const getProcessModelLabelForSearch = (processModel: ProcessModel) => { + return `${processModel.display_name} ${ + processModel.id + } ${getParentGroupsDisplayName(processModel)}`; }; const shouldFilterProcessModel = (options: any) => { @@ -42,7 +46,7 @@ export default function ProcessModelSearch({ } const inputValueArray = inputValue.split(' '); const processModelLowerCase = - getFullProcessModelLabel(processModel).toLowerCase(); + getProcessModelLabelForSearch(processModel).toLowerCase(); return inputValueArray.every((i: any) => { return processModelLowerCase.includes((i || '').toLowerCase()); @@ -56,7 +60,7 @@ export default function ProcessModelSearch({ items={processModels} itemToString={(processModel: ProcessModel) => { if (processModel) { - return getFullProcessModelLabel(processModel); + return getProcessModelLabelForDisplay(processModel); } return null; }} diff --git a/spiffworkflow-frontend/src/helpers.tsx b/spiffworkflow-frontend/src/helpers.tsx index 7ea6f86e1..441d3c0f1 100644 --- a/spiffworkflow-frontend/src/helpers.tsx +++ b/spiffworkflow-frontend/src/helpers.tsx @@ -71,13 +71,15 @@ export const convertDateObjectToFormattedString = (dateObject: Date) => { }; export const dateStringToYMDFormat = (dateString: string) => { - if (DATE_FORMAT.startsWith('dd')) { - const d = dateString.split('-'); - return `${d[2]}-${d[1]}-${d[0]}`; - } - if (DATE_FORMAT.startsWith('MM')) { - const d = dateString.split('-'); - return `${d[2]}-${d[0]}-${d[1]}`; + if (dateString && dateString.match(/^\d{2}-\d{2}-\d{4}$/)) { + if (DATE_FORMAT.startsWith('dd')) { + const d = dateString.split('-'); + return `${d[2]}-${d[1]}-${d[0]}`; + } + if (DATE_FORMAT.startsWith('MM')) { + const d = dateString.split('-'); + return `${d[2]}-${d[0]}-${d[1]}`; + } } return dateString; }; diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx index 170673bf0..a3b5842b6 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx @@ -690,7 +690,6 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { setSelectingEvent(false); initializeTaskDataToDisplay(taskToDisplay); setEventPayload('{}'); - console.log('cancel updating task'); removeError(); }; @@ -771,10 +770,8 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { } if (task.typename === 'CallActivity') { - console.log('task', task); const taskDefinitionPropertiesJson: TaskDefinitionPropertiesJson = task.task_definition_properties_json; - console.log('taskDefinitionPropertiesJson', taskDefinitionPropertiesJson); buttons.push(