added new page to create process models using english text w/ burnettk

This commit is contained in:
jasquat 2023-01-03 17:26:01 -05:00
parent 7f9422ce2c
commit 10e2ea6f91
4 changed files with 15 additions and 9 deletions

View File

@ -396,6 +396,7 @@ def process_instance_report_update(
report_id: int,
body: Dict[str, Any],
) -> flask.wrappers.Response:
"""Process_instance_report_update."""
process_instance_report = ProcessInstanceReportModel.query.filter_by(
id=report_id,
created_by_id=g.user.id,
@ -416,6 +417,7 @@ def process_instance_report_update(
def process_instance_report_delete(
report_id: int,
) -> flask.wrappers.Response:
"""Process_instance_report_delete."""
process_instance_report = ProcessInstanceReportModel.query.filter_by(
id=report_id,
created_by_id=g.user.id,

View File

@ -2,7 +2,6 @@
import json
import os
from spiffworkflow_backend.models.process_instance_report import ProcessInstanceReportModel
from spiffworkflow_backend.services.file_system_service import FileSystemService
import re
from typing import Any
from typing import Dict
@ -366,16 +365,17 @@ def process_model_create_with_natural_language(
)
ProcessModelService.add_process_model(process_model_info)
bpmn_process_identifier = f"{process_model_info.id}_process"
bpmn_process_identifier = f"{process_model_identifier}_process"
bpmn_template_contents = ''
with open(bpmn_template_file, encoding="utf-8") as f:
bpmn_template_contents = f.read()
bpmn_template_contents = bpmn_template_contents.replace('natural_language_process_id_template', bpmn_process_identifier)
bpmn_template_contents = bpmn_template_contents.replace('form-identifier-id-template-', form_identifier)
bpmn_template_contents = bpmn_template_contents.replace(
'natural_language_process_id_template', bpmn_process_identifier)
bpmn_template_contents = bpmn_template_contents.replace('form-identifier-id-template', form_identifier)
form_uischema_json: dict = {
"ui:order": []
"ui:order": columns
}
form_properties: dict = {}
@ -392,8 +392,10 @@ def process_model_create_with_natural_language(
}
SpecFileService.add_file(process_model_info, f"{process_model_identifier}.bpmn", str.encode(bpmn_template_contents))
SpecFileService.add_file(process_model_info, f"{form_identifier}-schema.json", str.encode(json.dumps(form_schema_json)))
SpecFileService.add_file(process_model_info, f"{form_identifier}-uischema.json", str.encode(json.dumps(form_uischema_json)))
SpecFileService.add_file(process_model_info, f"{form_identifier}-schema.json",
str.encode(json.dumps(form_schema_json)))
SpecFileService.add_file(
process_model_info, f"{form_identifier}-uischema.json", str.encode(json.dumps(form_uischema_json)))
_commit_and_push_to_git(
f"User: {g.user.username} created process model via natural language:"
@ -403,7 +405,7 @@ def process_model_create_with_natural_language(
default_report_metadata = ProcessInstanceReportService.system_metadata_map('default')
for column in columns:
default_report_metadata['columns'].append({
"Header": column, "accessor": column
"Header": column, "accessor": column, "filterable": True
})
ProcessInstanceReportModel.create_report(
identifier=process_model_identifier,

View File

@ -86,6 +86,7 @@ class ProcessInstanceReportService:
@classmethod
def system_metadata_map(cls, metadata_key: str) -> dict[str, Any]:
"""System_metadata_map."""
# TODO replace with system reports that are loaded on launch (or similar)
temp_system_metadata_map = {
"default": {

View File

@ -221,7 +221,8 @@ class TestProcessApi(BaseTest):
process_instance_report = ProcessInstanceReportModel.query.filter_by(identifier='bug-tracker').first()
assert process_instance_report is not None
report_column_accessors = [i['accessor'] for i in process_instance_report.report_metadata['columns']]
expected_column_accessors = ['id', 'process_model_display_name', 'start_in_seconds', 'end_in_seconds', 'username', 'status', 'summary', 'description', 'priority']
expected_column_accessors = ['id', 'process_model_display_name', 'start_in_seconds',
'end_in_seconds', 'username', 'status', 'summary', 'description', 'priority']
assert report_column_accessors == expected_column_accessors
def test_primary_process_id_updates_via_xml(