added a list processes.
This commit is contained in:
parent
a786bd5091
commit
cdde4b729b
|
@ -26,8 +26,8 @@ def view_bpmn(process_model_id, file_id):
|
|||
bpmn_xml = SpecFileService.get_data(process_model, files[0].name)
|
||||
return render_template('view.html', bpmn_xml=bpmn_xml.decode("utf-8") )
|
||||
|
||||
@admin_blueprint.route("/run/<process_model_id>/<file_id>", methods=["GET"])
|
||||
def run_bpmn(process_model_id, file_id):
|
||||
@admin_blueprint.route("/run/<process_model_id>", methods=["GET"])
|
||||
def run_bpmn(process_model_id):
|
||||
user = find_or_create_user('Mr. Test') # Fixme - sheesh!
|
||||
process_instance = ProcessInstanceService.create_process_instance(process_model_id, user)
|
||||
processor = ProcessInstanceProcessor(process_instance)
|
||||
|
@ -38,8 +38,13 @@ def run_bpmn(process_model_id, file_id):
|
|||
files = SpecFileService.get_files(process_model)
|
||||
bpmn_xml = SpecFileService.get_data(process_model, files[0].name)
|
||||
|
||||
return render_template('view.html', bpmn_xml=bpmn_xml.decode("utf-8"), result=result)
|
||||
return render_template('view.html', bpmn_xml=bpmn_xml.decode("utf-8"), result=result,
|
||||
process_model_id=process_model_id)
|
||||
|
||||
@admin_blueprint.route("/process_models", methods=["GET"])
|
||||
def listProcessModels():
|
||||
models = ProcessModelService().get_specs()
|
||||
return render_template('process_models.html', models=models)
|
||||
|
||||
def find_or_create_user(username: str = "test_user1") -> Any:
|
||||
user = UserModel.query.filter_by(username=username).first()
|
||||
|
@ -47,4 +52,5 @@ def find_or_create_user(username: str = "test_user1") -> Any:
|
|||
user = UserModel(username=username)
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
return user
|
||||
return user
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Process Models</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Process Models</h1>
|
||||
<table>
|
||||
<tbody>
|
||||
{# here we iterate over every item in our list#}
|
||||
{% for pm in models %}
|
||||
<tr><td><a href="{{ url_for('admin.run_bpmn', process_model_id=pm.id) }}">{{ pm.display_name }}</a></td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -47,7 +47,10 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="result">{{ result }}</div>
|
||||
<button type="button" onclick="window.location.href='{{ url_for( 'admin.listProcessModels' , table='Y' ) }}';">Display Table Y</button>
|
||||
<button type="button" onclick="window.location.href='{{ url_for( 'admin.run_bpmn' , process_model_id=process_model_id ) }}';">Run</button>
|
||||
<div id="canvas"></div>
|
||||
|
||||
<meta id="bpmn_xml" data-name="{{bpmn_xml}}">
|
||||
<script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue