Merge remote-tracking branch 'origin/main' into feature/add_active_task
This commit is contained in:
commit
405277d323
|
@ -6,6 +6,7 @@ from flask_bpmn.models.db import db
|
|||
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
|
||||
from SpiffWorkflow.navigation import NavItem # type: ignore
|
||||
from typing import Any
|
||||
from typing import Optional
|
||||
|
||||
import marshmallow
|
||||
from marshmallow import INCLUDE
|
||||
|
@ -17,6 +18,7 @@ from sqlalchemy.orm import relationship
|
|||
|
||||
from spiffworkflow_backend.helpers.spiff_enum import SpiffEnum
|
||||
from spiffworkflow_backend.models.process_model import ProcessModelInfo
|
||||
from spiffworkflow_backend.models.task import Task
|
||||
from spiffworkflow_backend.models.task import TaskSchema
|
||||
from spiffworkflow_backend.models.user import UserModel
|
||||
|
||||
|
@ -143,7 +145,7 @@ class ProcessInstanceApi:
|
|||
self,
|
||||
id: int,
|
||||
status: ProcessInstanceStatus,
|
||||
next_task: None,
|
||||
next_task: Optional[Task],
|
||||
process_model_identifier: str,
|
||||
process_group_identifier: str,
|
||||
total_tasks: int,
|
||||
|
|
|
@ -102,7 +102,7 @@ class Task:
|
|||
type: str,
|
||||
state: str,
|
||||
lane: str,
|
||||
form: Optional[Form],
|
||||
form: None,
|
||||
documentation: str,
|
||||
data: dict[str, Any],
|
||||
multi_instance_type: MultiInstanceType,
|
||||
|
@ -117,7 +117,7 @@ class Task:
|
|||
self.title = title
|
||||
self.type = type
|
||||
self.state = state
|
||||
self.form = form
|
||||
self.form = None
|
||||
self.documentation = documentation
|
||||
self.data = data
|
||||
self.lane = lane
|
||||
|
@ -200,11 +200,11 @@ class FormFieldSchema(Schema):
|
|||
)
|
||||
|
||||
|
||||
class FormSchema(Schema):
|
||||
"""FormSchema."""
|
||||
|
||||
key = marshmallow.fields.String(required=True, allow_none=False)
|
||||
fields = marshmallow.fields.List(marshmallow.fields.Nested(FormFieldSchema))
|
||||
# class FormSchema(Schema):
|
||||
# """FormSchema."""
|
||||
#
|
||||
# key = marshmallow.fields.String(required=True, allow_none=False)
|
||||
# fields = marshmallow.fields.List(marshmallow.fields.Nested(FormFieldSchema))
|
||||
|
||||
|
||||
class TaskSchema(Schema):
|
||||
|
@ -232,7 +232,7 @@ class TaskSchema(Schema):
|
|||
|
||||
multi_instance_type = EnumField(MultiInstanceType)
|
||||
documentation = marshmallow.fields.String(required=False, allow_none=True)
|
||||
form = marshmallow.fields.Nested(FormSchema, required=False, allow_none=True)
|
||||
# form = marshmallow.fields.Nested(FormSchema, required=False, allow_none=True)
|
||||
title = marshmallow.fields.String(required=False, allow_none=True)
|
||||
process_name = marshmallow.fields.String(required=False, allow_none=True)
|
||||
lane = marshmallow.fields.String(required=False, allow_none=True)
|
||||
|
|
|
@ -110,6 +110,9 @@ class ProcessInstanceService:
|
|||
next_task_trying_again, add_docs_and_forms=True
|
||||
)
|
||||
)
|
||||
# TODO: Hack for now, until we decide how to implment forms
|
||||
process_instance_api.next_task.form = None
|
||||
|
||||
# Update the state of the task to locked if the current user does not own the task.
|
||||
# user_uids = WorkflowService.get_users_assigned_to_task(processor, next_task)
|
||||
# if not UserService.in_list(user_uids, allow_admin_impersonate=True):
|
||||
|
@ -413,29 +416,29 @@ class ProcessInstanceService:
|
|||
properties=props,
|
||||
)
|
||||
|
||||
# Only process the form and documentation if requested.
|
||||
# The task should be in a completed or a ready state, and should
|
||||
# not be a previously completed MI Task.
|
||||
if add_docs_and_forms:
|
||||
task.data = spiff_task.data
|
||||
if (
|
||||
hasattr(spiff_task.task_spec, "form")
|
||||
and spiff_task.task_spec.form is not None
|
||||
):
|
||||
task.form = spiff_task.task_spec.form
|
||||
for i, field in enumerate(task.form.fields):
|
||||
task.form.fields[i] = ProcessInstanceService.process_options(
|
||||
spiff_task, field
|
||||
)
|
||||
# If there is a default value, set it.
|
||||
# if field.id not in task.data and ProcessInstanceService.get_default_value(field, spiff_task) is not None:
|
||||
# task.data[field.id] = ProcessInstanceService.get_default_value(field, spiff_task)
|
||||
# task.documentation = ProcessInstanceService._process_documentation(spiff_task)
|
||||
task.documentation = (
|
||||
spiff_task.task_spec.documentation
|
||||
if hasattr(spiff_task.task_spec, "documentation")
|
||||
else None
|
||||
)
|
||||
# # Only process the form and documentation if requested.
|
||||
# # The task should be in a completed or a ready state, and should
|
||||
# # not be a previously completed MI Task.
|
||||
# if add_docs_and_forms:
|
||||
# task.data = spiff_task.data
|
||||
# if (
|
||||
# hasattr(spiff_task.task_spec, "form")
|
||||
# and spiff_task.task_spec.form is not None
|
||||
# ):
|
||||
# task.form = spiff_task.task_spec.form
|
||||
# for i, field in enumerate(task.form.fields):
|
||||
# task.form.fields[i] = ProcessInstanceService.process_options(
|
||||
# spiff_task, field
|
||||
# )
|
||||
# # If there is a default value, set it.
|
||||
# # if field.id not in task.data and ProcessInstanceService.get_default_value(field, spiff_task) is not None:
|
||||
# # task.data[field.id] = ProcessInstanceService.get_default_value(field, spiff_task)
|
||||
# # task.documentation = ProcessInstanceService._process_documentation(spiff_task)
|
||||
# task.documentation = (
|
||||
# spiff_task.task_spec.documentation
|
||||
# if hasattr(spiff_task.task_spec, "documentation")
|
||||
# else None
|
||||
# )
|
||||
|
||||
# All ready tasks should have a valid name, and this can be computed for
|
||||
# some tasks, particularly multi-instance tasks that all have the same spec
|
||||
|
|
Loading…
Reference in New Issue