add extensions back onto task before returning task show w/ burnettk

This commit is contained in:
jasquat 2023-04-24 12:58:07 -04:00
parent afc7391806
commit f14d05c793
No known key found for this signature in database
4 changed files with 6 additions and 30 deletions

View File

@ -84,6 +84,7 @@ class TaskModel(SpiffworkflowBaseDBModel):
process_model_identifier: Optional[str] = None process_model_identifier: Optional[str] = None
type: Optional[str] = None type: Optional[str] = None
can_complete: Optional[bool] = None can_complete: Optional[bool] = None
extensions: Optional[dict] = None
def get_data(self) -> dict: def get_data(self) -> dict:
return {**self.python_env_data(), **self.json_data()} return {**self.python_env_data(), **self.json_data()}

View File

@ -280,8 +280,6 @@ def task_show(process_instance_id: int, task_guid: str = "next") -> flask.wrappe
process_instance.process_model_identifier, process_instance.process_model_identifier,
) )
# _find_human_task_or_raise(process_instance_id, task_guid)
form_schema_file_name = "" form_schema_file_name = ""
form_ui_schema_file_name = "" form_ui_schema_file_name = ""
@ -363,6 +361,7 @@ def task_show(process_instance_id: int, task_guid: str = "next") -> flask.wrappe
_munge_form_ui_schema_based_on_hidden_fields_in_task_data(task_model) _munge_form_ui_schema_based_on_hidden_fields_in_task_data(task_model)
_render_instructions_for_end_user(task_model, extensions) _render_instructions_for_end_user(task_model, extensions)
task_model.extensions = extensions
return make_response(jsonify(task_model), 200) return make_response(jsonify(task_model), 200)
@ -382,30 +381,6 @@ def _render_instructions_for_end_user(task_model: TaskModel, extensions: Optiona
return "" return ""
def process_data_show(
process_instance_id: int,
process_data_identifier: str,
modified_process_model_identifier: str,
) -> flask.wrappers.Response:
"""Process_data_show."""
process_instance = _find_process_instance_by_id_or_raise(process_instance_id)
processor = ProcessInstanceProcessor(process_instance)
all_process_data = processor.get_data()
process_data_value = None
if process_data_identifier in all_process_data:
process_data_value = all_process_data[process_data_identifier]
return make_response(
jsonify(
{
"process_data_identifier": process_data_identifier,
"process_data_value": process_data_value,
}
),
200,
)
def _interstitial_stream(process_instance_id: int) -> Generator[str, Optional[str], None]: def _interstitial_stream(process_instance_id: int) -> Generator[str, Optional[str], None]:
process_instance = _find_process_instance_by_id_or_raise(process_instance_id) process_instance = _find_process_instance_by_id_or_raise(process_instance_id)
processor = ProcessInstanceProcessor(process_instance) processor = ProcessInstanceProcessor(process_instance)

View File

@ -10,7 +10,7 @@ export default function InstructionsForEndUser({ task }: any) {
'There is no additional instructions or information for this task.'; 'There is no additional instructions or information for this task.';
let { properties } = task; let { properties } = task;
if (!properties) { if (!properties) {
properties = task.properties_json; properties = task.extensions;
} }
const { instructionsForEndUser } = properties; const { instructionsForEndUser } = properties;
if (instructionsForEndUser) { if (instructionsForEndUser) {

View File

@ -297,7 +297,7 @@ export default function TaskShow() {
let taskData = task.data; let taskData = task.data;
let jsonSchema = task.form_schema; let jsonSchema = task.form_schema;
let reactFragmentToHideSubmitButton = null; let reactFragmentToHideSubmitButton = null;
if (task.type === 'Manual Task') { if (task.type === 'ManualTask') {
taskData = {}; taskData = {};
jsonSchema = { jsonSchema = {
type: 'object', type: 'object',
@ -333,9 +333,9 @@ export default function TaskShow() {
if (task.state === 'READY') { if (task.state === 'READY') {
let submitButtonText = 'Submit'; let submitButtonText = 'Submit';
let saveAsDraftButton = null; let saveAsDraftButton = null;
if (task.type === 'Manual Task') { if (task.type === 'ManualTask') {
submitButtonText = 'Continue'; submitButtonText = 'Continue';
} else if (task.type === 'User Task') { } else if (task.type === 'UserTask') {
saveAsDraftButton = ( saveAsDraftButton = (
<Button <Button
id="save-as-draft-button" id="save-as-draft-button"