reorder everything and indicate private method

This commit is contained in:
burnettk 2022-05-31 13:06:08 -04:00
parent 4ff7d770c2
commit a5300e31d8
1 changed files with 41 additions and 41 deletions

View File

@ -14,19 +14,37 @@ from spiff_workflow_webapp.services.process_model_service import ProcessModelSer
admin_blueprint = Blueprint("admin", __name__, template_folder='templates', static_folder='static')
@admin_blueprint.route("/process-models/<process_model_id>/run", methods=["GET"])
def process_model_run(process_model_id):
"""Process_model_run."""
user = find_or_create_user('Mr. Test') # Fixme - sheesh!
process_instance = ProcessInstanceService.create_process_instance(process_model_id, user)
processor = ProcessInstanceProcessor(process_instance)
processor.do_engine_steps()
result = processor.get_data()
@admin_blueprint.route("/process-groups", methods=["GET"])
def process_groups_list():
"""Process_groups_list."""
process_groups = ProcessModelService().get_process_groups()
return render_template('process_groups_list.html', process_groups=process_groups)
@admin_blueprint.route("/process-groups/<process_group_id>", methods=["GET"])
def process_group_show(process_group_id):
"""Show_process_group."""
process_group = ProcessModelService().get_process_group(process_group_id)
return render_template('process_group_show.html', process_group=process_group)
@admin_blueprint.route("/process-models/<process_model_id>", methods=["GET"])
def process_model_show(process_model_id):
"""Show_process_model."""
process_model = ProcessModelService().get_spec(process_model_id)
bpmn_xml = SpecFileService.get_data(process_model, process_model.primary_file_name)
files = SpecFileService.get_files(process_model, extension_filter="bpmn")
current_file_name = process_model.primary_file_name
bpmn_xml = SpecFileService.get_data(process_model, current_file_name)
return render_template('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml, files=files, current_file_name=current_file_name)
return render_template('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml, result=result)
@admin_blueprint.route("/process-models/<process_model_id>/<file_name>", methods=["GET"])
def process_model_show_file(process_model_id, file_name):
"""Process_model_show_file."""
process_model = ProcessModelService().get_spec(process_model_id)
bpmn_xml = SpecFileService.get_data(process_model, file_name)
files = SpecFileService.get_files(process_model, extension_filter="bpmn")
return render_template('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml, files=files, current_file_name=file_name)
@admin_blueprint.route("/process_models/<process_model_id>/edit", methods=["GET"])
@ -49,40 +67,22 @@ def process_model_save(process_model_id):
process_model=process_model)
@admin_blueprint.route("/process-models/<process_model_id>/<file_name>", methods=["GET"])
def process_model_show_file(process_model_id, file_name):
"""Process_model_show_file."""
@admin_blueprint.route("/process-models/<process_model_id>/run", methods=["GET"])
def process_model_run(process_model_id):
"""Process_model_run."""
user = _find_or_create_user('Mr. Test') # Fixme - sheesh!
process_instance = ProcessInstanceService.create_process_instance(process_model_id, user)
processor = ProcessInstanceProcessor(process_instance)
processor.do_engine_steps()
result = processor.get_data()
process_model = ProcessModelService().get_spec(process_model_id)
bpmn_xml = SpecFileService.get_data(process_model, file_name)
files = SpecFileService.get_files(process_model, extension_filter="bpmn")
return render_template('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml, files=files, current_file_name=file_name)
bpmn_xml = SpecFileService.get_data(process_model, process_model.primary_file_name)
return render_template('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml, result=result)
@admin_blueprint.route("/process-groups/<process_group_id>", methods=["GET"])
def process_group_show(process_group_id):
"""Show_process_group."""
process_group = ProcessModelService().get_process_group(process_group_id)
return render_template('process_group_show.html', process_group=process_group)
@admin_blueprint.route("/process-groups", methods=["GET"])
def process_groups_list():
"""Process_groups_list."""
process_groups = ProcessModelService().get_process_groups()
return render_template('process_groups_list.html', process_groups=process_groups)
@admin_blueprint.route("/process-models/<process_model_id>", methods=["GET"])
def process_model_show(process_model_id):
"""Show_process_model."""
process_model = ProcessModelService().get_spec(process_model_id)
files = SpecFileService.get_files(process_model, extension_filter="bpmn")
current_file_name = process_model.primary_file_name
bpmn_xml = SpecFileService.get_data(process_model, current_file_name)
return render_template('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml, files=files, current_file_name=current_file_name)
def find_or_create_user(username: str = "test_user1") -> Any:
def _find_or_create_user(username: str = "test_user1") -> Any:
"""Find_or_create_user."""
user = UserModel.query.filter_by(username=username).first()
if user is None: