From a5300e31d81feda86753675c416749b8aedbbf7c Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 31 May 2022 13:06:08 -0400 Subject: [PATCH] reorder everything and indicate private method --- .../routes/admin_blueprint/admin_blueprint.py | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/spiff_workflow_webapp/routes/admin_blueprint/admin_blueprint.py b/src/spiff_workflow_webapp/routes/admin_blueprint/admin_blueprint.py index 518543e1..e9536898 100644 --- a/src/spiff_workflow_webapp/routes/admin_blueprint/admin_blueprint.py +++ b/src/spiff_workflow_webapp/routes/admin_blueprint/admin_blueprint.py @@ -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//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/", 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/", 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//", 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//edit", methods=["GET"]) @@ -49,40 +67,22 @@ def process_model_save(process_model_id): process_model=process_model) -@admin_blueprint.route("/process-models//", methods=["GET"]) -def process_model_show_file(process_model_id, file_name): - """Process_model_show_file.""" +@admin_blueprint.route("/process-models//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/", 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/", 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: