send to task guid to signify how far to go with the tasks w/ burnettk

This commit is contained in:
jasquat 2023-03-20 17:29:53 -04:00
parent 28bda31802
commit 41a3bbc475
No known key found for this signature in database
4 changed files with 37 additions and 70 deletions

View File

@ -907,12 +907,6 @@ paths:
description: If true, this wil return all tasks associated with the process instance and not just user tasks.
schema:
type: boolean
- name: spiff_step
in: query
required: false
description: If set will return the tasks as they were during a specific step of execution.
schema:
type: integer
- name: most_recent_tasks_only
in: query
required: false
@ -925,6 +919,12 @@ paths:
description: The guid of the bpmn process to get the tasks for.
schema:
type: string
- name: to_task_guid
in: query
required: false
description: Get the tasks only up to the given guid.
schema:
type: string
get:
tags:
- Process Instances
@ -966,12 +966,6 @@ paths:
description: If true, this wil return all tasks associated with the process instance and not just user tasks.
schema:
type: boolean
- name: spiff_step
in: query
required: false
description: If set will return the tasks as they were during a specific step of execution.
schema:
type: integer
- name: most_recent_tasks_only
in: query
required: false
@ -984,6 +978,12 @@ paths:
description: The guid of the bpmn process to get the tasks for.
schema:
type: string
- name: to_task_guid
in: query
required: false
description: Get the tasks only up to the given guid.
schema:
type: string
get:
tags:
- Process Instances

View File

@ -563,6 +563,7 @@ def process_instance_task_list_without_task_data_for_me(
spiff_step: int = 0,
most_recent_tasks_only: bool = False,
bpmn_process_guid: Optional[str] = None,
to_task_guid: Optional[str] = None,
) -> flask.wrappers.Response:
"""Process_instance_task_list_without_task_data_for_me."""
process_instance = _find_process_instance_for_me_or_raise(process_instance_id)
@ -572,7 +573,8 @@ def process_instance_task_list_without_task_data_for_me(
all_tasks=all_tasks,
spiff_step=spiff_step,
most_recent_tasks_only=most_recent_tasks_only,
bpmn_process_guid=bpmn_process_guid
bpmn_process_guid=bpmn_process_guid,
to_task_guid=to_task_guid,
)
@ -583,6 +585,7 @@ def process_instance_task_list_without_task_data(
spiff_step: int = 0,
most_recent_tasks_only: bool = False,
bpmn_process_guid: Optional[str] = None,
to_task_guid: Optional[str] = None,
) -> flask.wrappers.Response:
"""Process_instance_task_list_without_task_data."""
process_instance = _find_process_instance_by_id_or_raise(process_instance_id)
@ -592,7 +595,8 @@ def process_instance_task_list_without_task_data(
all_tasks=all_tasks,
spiff_step=spiff_step,
most_recent_tasks_only=most_recent_tasks_only,
bpmn_process_guid=bpmn_process_guid
bpmn_process_guid=bpmn_process_guid,
to_task_guid=to_task_guid,
)

View File

@ -73,7 +73,7 @@ export default function AdminRoutes() {
element={<ProcessInstanceShow variant="for-me" />}
/>
<Route
path="process-instances/for-me/:process_model_id/:process_instance_id/:spiff_step"
path="process-instances/for-me/:process_model_id/:process_instance_id/:to_task_guid"
element={<ProcessInstanceShow variant="for-me" />}
/>
<Route
@ -81,7 +81,7 @@ export default function AdminRoutes() {
element={<ProcessInstanceShow variant="all" />}
/>
<Route
path="process-instances/:process_model_id/:process_instance_id/:spiff_step"
path="process-instances/:process_model_id/:process_instance_id/:to_task_guid"
element={<ProcessInstanceShow variant="all" />}
/>
<Route

View File

@ -145,8 +145,8 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
successCallback: setProcessInstance,
});
let taskParams = '?all_tasks=true&most_recent_tasks_only=true';
if (typeof params.spiff_step !== 'undefined') {
taskParams = `${taskParams}&spiff_step=${params.spiff_step}`;
if (typeof params.to_task_guid !== 'undefined') {
taskParams = `${taskParams}&to_task_guid=${params.to_task_guid}`;
}
const bpmnProcessGuid = searchParams.get('bpmn_process_guid');
if (bpmnProcessGuid) {
@ -231,7 +231,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
};
const currentSpiffStep = () => {
if (processInstance && typeof params.spiff_step === 'undefined') {
if (processInstance && typeof params.to_task_guid === 'undefined') {
return processInstance.spiff_step || 0;
}
@ -246,7 +246,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
return processInstance && currentSpiffStep() === processInstance.spiff_step;
};
const spiffStepLink = (label: any, spiffStep: number) => {
const completionViewLink = (label: any, taskGuid: string) => {
const processIdentifier = searchParams.get('process_identifier');
const callActivityTaskId = searchParams.get('bpmn_process_guid');
const queryParamArray = [];
@ -265,29 +265,13 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
<Link
reloadDocument
data-qa="process-instance-step-link"
to={`${processInstanceShowPageBaseUrl}/${spiffStep}${queryParams}`}
to={`${processInstanceShowPageBaseUrl}/${taskGuid}${queryParams}`}
>
{label}
</Link>
);
};
const previousStepLink = () => {
if (showingFirstSpiffStep()) {
return null;
}
return spiffStepLink(<CaretLeft />, currentSpiffStep() - 1);
};
const nextStepLink = () => {
if (showingLastSpiffStep()) {
return null;
}
return spiffStepLink(<CaretRight />, currentSpiffStep() + 1);
};
const returnToLastSpiffStep = () => {
window.location.href = processInstanceShowPageBaseUrl;
};
@ -782,10 +766,10 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
}
if (task.typename === 'CallActivity') {
console.log('task', task)
console.log('task', task);
const taskDefinitionPropertiesJson: TaskDefinitionPropertiesJson =
task.task_definition_properties_json;
console.log('taskDefinitionPropertiesJson', taskDefinitionPropertiesJson)
console.log('taskDefinitionPropertiesJson', taskDefinitionPropertiesJson);
buttons.push(
<Link
data-qa="go-to-call-activity-result"
@ -993,19 +977,16 @@ 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}
<div>
<Stack orientation="horizontal" gap={2}>
{completionViewLink(
'View state at task completion',
taskToUse.guid
)}
</Stack>
<br />
<br />
</div>
{selectingEvent
? eventSelector(candidateEvents)
: taskDataContainer()}
@ -1015,23 +996,6 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
return null;
};
const stepsElement = () => {
if (!processInstance) {
return null;
}
return (
<Grid condensed fullWidth>
<Column sm={3} md={3} lg={3}>
<Stack orientation="horizontal" gap={3} className="smaller-text">
{previousStepLink()}
Step {currentSpiffStep()} of {processInstance.spiff_step}
{nextStepLink()}
</Stack>
</Column>
</Grid>
);
};
const buttonIcons = () => {
if (!processInstance) {
return null;
@ -1119,7 +1083,6 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
{taskUpdateDisplayArea()}
{processDataDisplayArea()}
{processInstanceMetadataArea()}
{stepsElement()}
<br />
<ReactDiagramEditor
processModelId={processModelId || ''}