mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-28 18:55:14 +00:00
link to the spiff step from a task on the frontend and use the correct db in ci
This commit is contained in:
parent
7c3c2a2baf
commit
fd8134706d
4
.github/workflows/backend_tests.yml
vendored
4
.github/workflows/backend_tests.yml
vendored
@ -148,12 +148,12 @@ jobs:
|
|||||||
host port: 3306
|
host port: 3306
|
||||||
container port: 3306
|
container port: 3306
|
||||||
mysql version: "8.0"
|
mysql version: "8.0"
|
||||||
mysql database: "spiffworkflow_backend_testing"
|
mysql database: "spiffworkflow_backend_unit_testing"
|
||||||
mysql root password: password
|
mysql root password: password
|
||||||
if: matrix.database == 'mysql'
|
if: matrix.database == 'mysql'
|
||||||
|
|
||||||
- name: Setup Postgres
|
- 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'
|
if: matrix.database == 'postgres'
|
||||||
|
|
||||||
- name: Run Nox
|
- name: Run Nox
|
||||||
|
@ -122,6 +122,7 @@ class Task:
|
|||||||
event_definition: Union[dict[str, Any], None] = None,
|
event_definition: Union[dict[str, Any], None] = None,
|
||||||
call_activity_process_identifier: Optional[str] = None,
|
call_activity_process_identifier: Optional[str] = None,
|
||||||
calling_subprocess_task_id: Optional[str] = None,
|
calling_subprocess_task_id: Optional[str] = None,
|
||||||
|
task_spiff_step: Optional[int] = None,
|
||||||
):
|
):
|
||||||
"""__init__."""
|
"""__init__."""
|
||||||
self.id = id
|
self.id = id
|
||||||
@ -136,6 +137,7 @@ class Task:
|
|||||||
self.event_definition = event_definition
|
self.event_definition = event_definition
|
||||||
self.call_activity_process_identifier = call_activity_process_identifier
|
self.call_activity_process_identifier = call_activity_process_identifier
|
||||||
self.calling_subprocess_task_id = calling_subprocess_task_id
|
self.calling_subprocess_task_id = calling_subprocess_task_id
|
||||||
|
self.task_spiff_step = task_spiff_step
|
||||||
|
|
||||||
self.data = data
|
self.data = data
|
||||||
if self.data is None:
|
if self.data is None:
|
||||||
@ -197,6 +199,7 @@ class Task:
|
|||||||
"event_definition": self.event_definition,
|
"event_definition": self.event_definition,
|
||||||
"call_activity_process_identifier": self.call_activity_process_identifier,
|
"call_activity_process_identifier": self.call_activity_process_identifier,
|
||||||
"calling_subprocess_task_id": self.calling_subprocess_task_id,
|
"calling_subprocess_task_id": self.calling_subprocess_task_id,
|
||||||
|
"task_spiff_step": self.task_spiff_step,
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -640,23 +640,19 @@ def process_instance_task_list(
|
|||||||
|
|
||||||
tasks = []
|
tasks = []
|
||||||
for spiff_task in spiff_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(
|
calling_subprocess_task_id = subprocesses_by_child_task_ids.get(
|
||||||
str(spiff_task.id), None
|
str(spiff_task.id), None
|
||||||
)
|
)
|
||||||
task = ProcessInstanceService.spiff_task_to_api_task(
|
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 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
|
task.data = spiff_task.data
|
||||||
tasks.append(task)
|
tasks.append(task)
|
||||||
|
|
||||||
|
@ -303,6 +303,7 @@ class ProcessInstanceService:
|
|||||||
spiff_task: SpiffTask,
|
spiff_task: SpiffTask,
|
||||||
add_docs_and_forms: bool = False,
|
add_docs_and_forms: bool = False,
|
||||||
calling_subprocess_task_id: Optional[str] = None,
|
calling_subprocess_task_id: Optional[str] = None,
|
||||||
|
task_spiff_step: Optional[int] = None,
|
||||||
) -> Task:
|
) -> Task:
|
||||||
"""Spiff_task_to_api_task."""
|
"""Spiff_task_to_api_task."""
|
||||||
task_type = spiff_task.task_spec.spec_type
|
task_type = spiff_task.task_spec.spec_type
|
||||||
@ -354,6 +355,7 @@ class ProcessInstanceService:
|
|||||||
event_definition=serialized_task_spec.get("event_definition"),
|
event_definition=serialized_task_spec.get("event_definition"),
|
||||||
call_activity_process_identifier=call_activity_process_identifier,
|
call_activity_process_identifier=call_activity_process_identifier,
|
||||||
calling_subprocess_task_id=calling_subprocess_task_id,
|
calling_subprocess_task_id=calling_subprocess_task_id,
|
||||||
|
task_spiff_step=task_spiff_step,
|
||||||
)
|
)
|
||||||
|
|
||||||
return task
|
return task
|
||||||
|
@ -46,6 +46,7 @@ export interface ProcessInstanceTask {
|
|||||||
type: string;
|
type: string;
|
||||||
updated_at_in_seconds: number;
|
updated_at_in_seconds: number;
|
||||||
|
|
||||||
|
task_spiff_step?: number;
|
||||||
potential_owner_usernames?: string;
|
potential_owner_usernames?: string;
|
||||||
assigned_user_group_identifier?: string;
|
assigned_user_group_identifier?: string;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
return processInstance && currentSpiffStep() === processInstance.spiff_step;
|
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 processIdentifier = searchParams.get('process_identifier');
|
||||||
const callActivityTaskId = searchParams.get('call_activity_task_id');
|
const callActivityTaskId = searchParams.get('call_activity_task_id');
|
||||||
const queryParamArray = [];
|
const queryParamArray = [];
|
||||||
@ -258,9 +258,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
<Link
|
<Link
|
||||||
reloadDocument
|
reloadDocument
|
||||||
data-qa="process-instance-step-link"
|
data-qa="process-instance-step-link"
|
||||||
to={`/admin/process-instances/${params.process_model_id}/${
|
to={`/admin/process-instances/${params.process_model_id}/${params.process_instance_id}/${spiffStep}${queryParams}`}
|
||||||
params.process_instance_id
|
|
||||||
}/${currentSpiffStep() + distance}${queryParams}`}
|
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
</Link>
|
</Link>
|
||||||
@ -272,7 +270,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return spiffStepLink(<CaretLeft />, -1);
|
return spiffStepLink(<CaretLeft />, currentSpiffStep() - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const nextStepLink = () => {
|
const nextStepLink = () => {
|
||||||
@ -280,7 +278,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return spiffStepLink(<CaretRight />, 1);
|
return spiffStepLink(<CaretRight />, currentSpiffStep() + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const returnToLastSpiffStep = () => {
|
const returnToLastSpiffStep = () => {
|
||||||
@ -996,6 +994,19 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
): {taskToUse.state}
|
): {taskToUse.state}
|
||||||
{taskDisplayButtons(taskToUse)}
|
{taskDisplayButtons(taskToUse)}
|
||||||
</Stack>
|
</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
|
{selectingEvent
|
||||||
? eventSelector(candidateEvents)
|
? eventSelector(candidateEvents)
|
||||||
: taskDataContainer()}
|
: taskDataContainer()}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user