diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py index 75e2a23cd..bb5cef6c2 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py @@ -685,7 +685,7 @@ def process_instance_task_list( if to_task_model is not None: task_models_dict = json.loads(current_app.json.dumps(task_models)) for task_model in task_models_dict: - end_in_seconds = float(task_model["end_in_seconds"]) + end_in_seconds = float(task_model["end_in_seconds"]) if task_model["end_in_seconds"] is not None else None if to_task_model.guid == task_model["guid"] and task_model["state"] == "COMPLETED": TaskService.reset_task_model_dict(task_model, state="READY") elif ( diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx index 797ba2543..a59b2fab4 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceLogList.tsx @@ -55,8 +55,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) { const tableRow = []; const taskNameCell = ( - {logEntry.spiff_task_guid || - logEntry.task_definition_name || + {logEntry.task_definition_name || (logEntry.bpmn_task_type === 'StartEvent' ? 'Process Started' : '') || (logEntry.bpmn_task_type === 'EndEvent' ? 'Process Ended' : '')} @@ -96,17 +95,24 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) { ); } - // tableRow.push({convertSecondsToFormattedDateTime(logEntry.timestamp)}); - tableRow.push( - - - {convertSecondsToFormattedDateTime(logEntry.timestamp)} - - + + let timestampComponent = ( + {convertSecondsToFormattedDateTime(logEntry.timestamp)} ); + if (logEntry.spiff_task_guid) { + timestampComponent = ( + + + {convertSecondsToFormattedDateTime(logEntry.timestamp)} + + + ); + } + tableRow.push(timestampComponent); return {tableRow}; }; diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx index 1cfc36c21..07cb45fdf 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx @@ -605,7 +605,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { } }; - const isCurrentTask = (task: Task) => { + const isActiveTask = (task: Task) => { const subprocessTypes = [ 'Subprocess', 'CallActivity', @@ -622,7 +622,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { return ( processInstance && ability.can('PUT', targetUris.processInstanceTaskDataPath) && - isCurrentTask(task) && + isActiveTask(task) && processInstance.status === 'suspended' && showingLastSpiffStep() ); @@ -646,7 +646,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { processInstance && processInstance.status === 'suspended' && ability.can('POST', targetUris.processInstanceCompleteTaskPath) && - isCurrentTask(task) && + isActiveTask(task) && showingLastSpiffStep() ); }; @@ -976,16 +976,18 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { ): {taskToUse.state} {taskDisplayButtons(taskToUse)} -
- - {completionViewLink( - 'View state at task completion', - taskToUse.guid - )} - -
-
-
+ {taskToUse.state == 'COMPLETED' ? ( +
+ + {completionViewLink( + 'View state at task completion', + taskToUse.guid + )} + +
+
+
+ ) : null} {selectingEvent ? eventSelector(candidateEvents) : taskDataContainer()} @@ -1029,6 +1031,36 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { return elements; }; + // right now this just assume if to_task_guid was passed in then + // this cannot be the active task. + // we may need a better way to figure this out. + const showingActiveTask = () => { + return !!params.to_task_guid; + }; + + const viewMostRecentStateComponent = () => { + if (!showingActiveTask()) { + return null; + } + + return ( + <> + + + + View at most recent state + + + +
+ + ); + }; + if (processInstance && (tasks || tasksCallHadError)) { const taskIds = getTaskIds(); const processModelId = unModifyProcessIdentifierForPathParam( @@ -1083,6 +1115,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { {processDataDisplayArea()} {processInstanceMetadataArea()}
+ {viewMostRecentStateComponent()}