From 1fbd3edde9ff67829e4f5accc296396d6dc49755 Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 24 Jan 2023 16:53:23 -0500 Subject: [PATCH] use a modal for metadata instead w/ burnettk --- .../src/routes/ProcessInstanceShow.tsx | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx index 279322a63..41168bdfe 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx @@ -44,6 +44,7 @@ import { PermissionsToCheck, ProcessData, ProcessInstance, + ProcessInstanceMetadata, ProcessInstanceTask, } from '../interfaces'; import { usePermissionFetcher } from '../hooks/PermissionService'; @@ -74,6 +75,8 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { const [eventTextEditorEnabled, setEventTextEditorEnabled] = useState(false); const [displayDetails, setDisplayDetails] = useState(false); + const [showProcessInstanceMetadata, setShowProcessInstanceMetadata] = + useState(false); const setErrorObject = (useContext as any)(ErrorContext)[1]; @@ -446,6 +449,19 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { Messages + {processInstance.process_metadata && + processInstance.process_metadata.length > 0 ? ( + + ) : null} @@ -903,6 +919,41 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { ); }; + const processInstanceMetadataArea = () => { + if ( + !processInstance || + (processInstance.process_metadata && + processInstance.process_metadata.length < 1) + ) { + return null; + } + const metadataComponents: any[] = []; + (processInstance.process_metadata || []).forEach( + (processInstanceMetadata: ProcessInstanceMetadata) => { + metadataComponents.push( + + + {processInstanceMetadata.key} + + + {processInstanceMetadata.value} + + + ); + } + ); + return ( + setShowProcessInstanceMetadata(false)} + > + {metadataComponents} + + ); + }; + const taskUpdateDisplayArea = () => { const taskToUse: any = { ...taskToDisplay, data: taskDataToDisplay }; const candidateEvents: any = getEvents(taskToUse); @@ -1034,6 +1085,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
{taskUpdateDisplayArea()} {processDataDisplayArea()} + {processInstanceMetadataArea()} {stepsElement()}