diff --git a/.github/workflows/backend_tests.yml b/.github/workflows/backend_tests.yml index 89cca7be..f1d9a1c7 100644 --- a/.github/workflows/backend_tests.yml +++ b/.github/workflows/backend_tests.yml @@ -148,12 +148,12 @@ jobs: host port: 3306 container port: 3306 mysql version: "8.0" - mysql database: "spiffworkflow_backend_testing" + mysql database: "spiffworkflow_backend_unit_testing" mysql root password: password if: matrix.database == 'mysql' - name: Setup Postgres - run: docker run --name postgres-spiff -p 5432:5432 -e POSTGRES_PASSWORD=spiffworkflow_backend -e POSTGRES_USER=spiffworkflow_backend -e POSTGRES_DB=spiffworkflow_backend_testing -d postgres + run: docker run --name postgres-spiff -p 5432:5432 -e POSTGRES_PASSWORD=spiffworkflow_backend -e POSTGRES_USER=spiffworkflow_backend -e POSTGRES_DB=spiffworkflow_backend_unit_testing -d postgres if: matrix.database == 'postgres' - name: Run Nox diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/task.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/task.py index 26f615ed..413be5e5 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/task.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/task.py @@ -122,6 +122,7 @@ class Task: event_definition: Union[dict[str, Any], None] = None, call_activity_process_identifier: Optional[str] = None, calling_subprocess_task_id: Optional[str] = None, + task_spiff_step: Optional[int] = None, ): """__init__.""" self.id = id @@ -136,6 +137,7 @@ class Task: self.event_definition = event_definition self.call_activity_process_identifier = call_activity_process_identifier self.calling_subprocess_task_id = calling_subprocess_task_id + self.task_spiff_step = task_spiff_step self.data = data if self.data is None: @@ -197,6 +199,7 @@ class Task: "event_definition": self.event_definition, "call_activity_process_identifier": self.call_activity_process_identifier, "calling_subprocess_task_id": self.calling_subprocess_task_id, + "task_spiff_step": self.task_spiff_step, } @classmethod 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 470c3198..800c50c9 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_instances_controller.py @@ -640,23 +640,19 @@ def process_instance_task_list( tasks = [] for spiff_task in spiff_tasks: + task_spiff_step: Optional[int] = None + if str(spiff_task.id) in steps_by_id: + task_spiff_step = steps_by_id[str(spiff_task.id)].spiff_step calling_subprocess_task_id = subprocesses_by_child_task_ids.get( str(spiff_task.id), None ) task = ProcessInstanceService.spiff_task_to_api_task( - processor, spiff_task, calling_subprocess_task_id=calling_subprocess_task_id + processor, + spiff_task, + calling_subprocess_task_id=calling_subprocess_task_id, + task_spiff_step=task_spiff_step, ) if get_task_data: - # if str(spiff_task.id) in steps_by_id: - # spiff_step_detail = steps_by_id[str(spiff_task.id)] - # task_data = ( - # spiff_step_detail.task_json["task_data"] | spiff_step_detail.task_json["python_env"] - # ) - # task.data = task_data - # task.state = spiff_step_detail.task_state - # else: - # task.data = {} - # task.state = TaskStateNames[TaskState.FUTURE] task.data = spiff_task.data tasks.append(task) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py index d837331f..d112dc09 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_instance_service.py @@ -303,6 +303,7 @@ class ProcessInstanceService: spiff_task: SpiffTask, add_docs_and_forms: bool = False, calling_subprocess_task_id: Optional[str] = None, + task_spiff_step: Optional[int] = None, ) -> Task: """Spiff_task_to_api_task.""" task_type = spiff_task.task_spec.spec_type @@ -354,6 +355,7 @@ class ProcessInstanceService: event_definition=serialized_task_spec.get("event_definition"), call_activity_process_identifier=call_activity_process_identifier, calling_subprocess_task_id=calling_subprocess_task_id, + task_spiff_step=task_spiff_step, ) return task diff --git a/spiffworkflow-frontend/src/interfaces.ts b/spiffworkflow-frontend/src/interfaces.ts index 7b0aba38..f86a7bb5 100644 --- a/spiffworkflow-frontend/src/interfaces.ts +++ b/spiffworkflow-frontend/src/interfaces.ts @@ -46,6 +46,7 @@ export interface ProcessInstanceTask { type: string; updated_at_in_seconds: number; + task_spiff_step?: number; potential_owner_usernames?: string; assigned_user_group_identifier?: string; } diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx index e21e3304..94775671 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx @@ -240,7 +240,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { return processInstance && currentSpiffStep() === processInstance.spiff_step; }; - const spiffStepLink = (label: any, distance: number) => { + const spiffStepLink = (label: any, spiffStep: number) => { const processIdentifier = searchParams.get('process_identifier'); const callActivityTaskId = searchParams.get('call_activity_task_id'); const queryParamArray = []; @@ -258,9 +258,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { {label} @@ -272,7 +270,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { return null; } - return spiffStepLink(, -1); + return spiffStepLink(, currentSpiffStep() - 1); }; const nextStepLink = () => { @@ -280,7 +278,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { return null; } - return spiffStepLink(, 1); + return spiffStepLink(, currentSpiffStep() + 1); }; const returnToLastSpiffStep = () => { @@ -996,6 +994,19 @@ export default function ProcessInstanceShow({ variant }: OwnProps) { ): {taskToUse.state} {taskDisplayButtons(taskToUse)} + {taskToUse.task_spiff_step ? ( +
+ + Task completed at step:{' '} + {spiffStepLink( + `${taskToUse.task_spiff_step}`, + taskToUse.task_spiff_step + )} + +
+
+
+ ) : null} {selectingEvent ? eventSelector(candidateEvents) : taskDataContainer()}