link to the spiff step from a task on the frontend and use the correct db in ci
This commit is contained in:
parent
ae66b82edb
commit
1748a0ae7f
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
|||
<Link
|
||||
reloadDocument
|
||||
data-qa="process-instance-step-link"
|
||||
to={`/admin/process-instances/${params.process_model_id}/${
|
||||
params.process_instance_id
|
||||
}/${currentSpiffStep() + distance}${queryParams}`}
|
||||
to={`/admin/process-instances/${params.process_model_id}/${params.process_instance_id}/${spiffStep}${queryParams}`}
|
||||
>
|
||||
{label}
|
||||
</Link>
|
||||
|
@ -272,7 +270,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||
return null;
|
||||
}
|
||||
|
||||
return spiffStepLink(<CaretLeft />, -1);
|
||||
return spiffStepLink(<CaretLeft />, currentSpiffStep() - 1);
|
||||
};
|
||||
|
||||
const nextStepLink = () => {
|
||||
|
@ -280,7 +278,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||
return null;
|
||||
}
|
||||
|
||||
return spiffStepLink(<CaretRight />, 1);
|
||||
return spiffStepLink(<CaretRight />, currentSpiffStep() + 1);
|
||||
};
|
||||
|
||||
const returnToLastSpiffStep = () => {
|
||||
|
@ -996,6 +994,19 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||
): {taskToUse.state}
|
||||
{taskDisplayButtons(taskToUse)}
|
||||
</Stack>
|
||||
{taskToUse.task_spiff_step ? (
|
||||
<div>
|
||||
<Stack orientation="horizontal" gap={2}>
|
||||
Task completed at step:{' '}
|
||||
{spiffStepLink(
|
||||
`${taskToUse.task_spiff_step}`,
|
||||
taskToUse.task_spiff_step
|
||||
)}
|
||||
</Stack>
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
) : null}
|
||||
{selectingEvent
|
||||
? eventSelector(candidateEvents)
|
||||
: taskDataContainer()}
|
||||
|
|
Loading…
Reference in New Issue