From d5a2323dbe9741d5d00051503f7f228741198ee3 Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 31 May 2022 11:34:44 -0400 Subject: [PATCH] use consistent naming for actions and views w/ burnettk --- .../routes/admin_blueprint/admin_blueprint.py | 59 ++++----- .../admin_blueprint/templates/index.html | 117 ----------------- .../templates/process_group_show.html | 2 +- ...s_groups.html => process_groups_list.html} | 0 .../{edit.html => process_model_edit.html} | 4 +- .../templates/process_model_show.html | 4 +- .../templates/process_models.html | 12 -- .../admin_blueprint/templates/view.html | 123 ------------------ 8 files changed, 28 insertions(+), 293 deletions(-) delete mode 100644 src/spiff_workflow_webapp/routes/admin_blueprint/templates/index.html rename src/spiff_workflow_webapp/routes/admin_blueprint/templates/{process_groups.html => process_groups_list.html} (100%) rename src/spiff_workflow_webapp/routes/admin_blueprint/templates/{edit.html => process_model_edit.html} (96%) delete mode 100644 src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_models.html delete mode 100644 src/spiff_workflow_webapp/routes/admin_blueprint/templates/view.html 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 1346d9d4..f6aff657 100644 --- a/src/spiff_workflow_webapp/routes/admin_blueprint/admin_blueprint.py +++ b/src/spiff_workflow_webapp/routes/admin_blueprint/admin_blueprint.py @@ -14,24 +14,9 @@ from spiff_workflow_webapp.services.process_model_service import ProcessModelSer admin_blueprint = Blueprint("admin", __name__, template_folder='templates', static_folder='static') -@admin_blueprint.route("/index", methods=["GET"]) -def hello_world(): - """Hello_world.""" - return render_template('index.html') - - -@admin_blueprint.route("/view//", methods=["GET"]) -def view_bpmn(process_model_id, file_id): - """View_bpmn.""" - process_model = ProcessModelService().get_spec(process_model_id) - SpecFileService.get_files(process_model) - bpmn_xml = SpecFileService.get_data(process_model, process_model.primary_file_name) - return render_template('view.html', bpmn_xml=bpmn_xml.decode("utf-8")) - - -@admin_blueprint.route("/run/", methods=["GET"]) -def run_bpmn(process_model_id): - """Run_bpmn.""" +@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) @@ -45,26 +30,35 @@ def run_bpmn(process_model_id): return render_template('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml, result=result) -@admin_blueprint.route("/edit/", methods=["GET"]) -def edit_bpmn(process_model_id): +@admin_blueprint.route("/process_models//edit", methods=["GET"]) +def process_model_edit(process_model_id): """Edit_bpmn.""" process_model = ProcessModelService().get_spec(process_model_id) SpecFileService.get_files(process_model) bpmn_xml = SpecFileService.get_data(process_model, process_model.primary_file_name) - return render_template('edit.html', bpmn_xml=bpmn_xml.decode("utf-8"), + return render_template('process_model_edit.html', bpmn_xml=bpmn_xml.decode("utf-8"), process_model=process_model) -@admin_blueprint.route("/save/", methods=["POST"]) -def save_bpmn(process_model_id): - """Save_bpmn.""" +@admin_blueprint.route("/process-models//save", methods=["POST"]) +def process_model_save(process_model_id): + """Process_model_save.""" process_model = ProcessModelService().get_spec(process_model_id) SpecFileService.get_files(process_model, process_model.primary_file_name) SpecFileService.update_file(process_model, process_model.primary_file_name, request.get_data()) bpmn_xml = SpecFileService.get_data(process_model, process_model.primary_file_name) - return render_template('edit.html', bpmn_xml=bpmn_xml.decode("utf-8"), - process_model_id=process_model_id) + return render_template('process_model_edit.html', bpmn_xml=bpmn_xml.decode("utf-8"), + process_model=process_model) + + +@admin_blueprint.route("/process-models//", methods=["GET"]) +def process_model_show_file(process_model_id, file_id): + """Process_model_show_file.""" + process_model = ProcessModelService().get_spec(process_model_id) + SpecFileService.get_files(process_model) + bpmn_xml = SpecFileService.get_data(process_model, file_id) + return render_template('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml) @admin_blueprint.route("/process-groups/", methods=["GET"]) @@ -75,10 +69,10 @@ def process_group_show(process_group_id): @admin_blueprint.route("/process-groups", methods=["GET"]) -def list_process_groups(): - """List_process_groups.""" +def process_groups_list(): + """Process_groups_list.""" process_groups = ProcessModelService().get_process_groups() - return render_template('process_groups.html', process_groups=process_groups) + return render_template('process_groups_list.html', process_groups=process_groups) @admin_blueprint.route("/process-models/", methods=["GET"]) @@ -89,13 +83,6 @@ def process_model_show(process_model_id): return render_template('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml) -@admin_blueprint.route("/process-models", methods=["GET"]) -def list_process_models(): - """List_process_models.""" - models = ProcessModelService().get_specs() - return render_template('process_models.html', models=models) - - def find_or_create_user(username: str = "test_user1") -> Any: """Find_or_create_user.""" user = UserModel.query.filter_by(username=username).first() diff --git a/src/spiff_workflow_webapp/routes/admin_blueprint/templates/index.html b/src/spiff_workflow_webapp/routes/admin_blueprint/templates/index.html deleted file mode 100644 index 81cc3728..00000000 --- a/src/spiff_workflow_webapp/routes/admin_blueprint/templates/index.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - Hello World - - - - - - - - - - - - - - - - - - - -
- - - - - \ No newline at end of file diff --git a/src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_group_show.html b/src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_group_show.html index f1d9535f..8f0ed5ae 100644 --- a/src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_group_show.html +++ b/src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_group_show.html @@ -1,7 +1,7 @@ {% extends "layout.html" %} {% block title %}Process Group: {{ process_group.id }}{% endblock %} {% block content %} - + {# here we iterate over every item in our list#} diff --git a/src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_groups.html b/src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_groups_list.html similarity index 100% rename from src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_groups.html rename to src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_groups_list.html diff --git a/src/spiff_workflow_webapp/routes/admin_blueprint/templates/edit.html b/src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_model_edit.html similarity index 96% rename from src/spiff_workflow_webapp/routes/admin_blueprint/templates/edit.html rename to src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_model_edit.html index 86965158..52d9c8dd 100644 --- a/src/spiff_workflow_webapp/routes/admin_blueprint/templates/edit.html +++ b/src/spiff_workflow_webapp/routes/admin_blueprint/templates/process_model_edit.html @@ -53,7 +53,7 @@
- + - - - - - - - - - - - - - - - - - -
{{ result }}
- - - -
- - - - - -