added show pages for process models and groups w/ burnettk

This commit is contained in:
jasquat 2022-05-31 10:15:03 -04:00
parent 2ee0799db5
commit 21b7bbe22b
6 changed files with 188 additions and 7 deletions

View File

@ -68,9 +68,31 @@ def save_bpmn(process_model_id):
process_model_id=process_model_id)
@admin_blueprint.route("/process_models", methods=["GET"])
def listProcessModels():
"""ListProcessModels."""
@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 list_process_groups():
"""List_process_groups."""
process_groups = ProcessModelService().get_process_groups()
return render_template('process_groups.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)
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)
@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)

View File

@ -66,7 +66,7 @@
</head>
<body>
<div id="result">{{ result }}</div>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.listProcessModels' ) }}';">List</button>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.list_process_models' ) }}';">List</button>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.run_bpmn' , process_model_id=process_model_id ) }}';">Run</button>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.edit_bpmn' , process_model_id=process_model_id ) }}';">Edit</button>
<button type="button" onclick="exportDiagram()" >print to console</button>
@ -163,4 +163,4 @@
</script>
<!--
</body>
</html>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Process Group Show</title>
</head>
<body>
<h1>{{ process_group.id }}</h1>
<table>
<tbody>
{# here we iterate over every item in our list#}
{% for process_model in process_group.specs %}
<tr><td><a href="{{ url_for('admin.process_model_show', process_model_id=process_model.id) }}">{{ process_model.display_name }}</a></td></tr>
{% endfor %}
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Process Groups</title>
</head>
<body>
<h1>Process Groups</h1>
<table>
<tbody>
{# here we iterate over every item in our list#}
{% for process_group in process_groups %}
<tr><td><a href="{{ url_for('admin.process_group_show', process_group_id=process_group.id) }}">{{ process_group.display_name }}</a></td></tr>
{% endfor %}
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,123 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{{ process_model.id }}</title>
<script src="{{ url_for('admin.static', filename='node_modules/bpmn-js/dist/bpmn-viewer.development.js') }}"></script>
<!-- viewer distro (without pan and zoom) -->
<!--
<script src="https://unpkg.com/bpmn-js@9.1.0/dist/bpmn-viewer.development.js"></script>
-->
<!-- required viewer styles -->
<link rel="stylesheet" href="https://unpkg.com/bpmn-js@9.1.0/dist/assets/bpmn-js.css">
<!-- viewer distro (with pan and zoom) -->
<script src="https://unpkg.com/bpmn-js@9.1.0/dist/bpmn-navigated-viewer.development.js"></script>
<!-- needed for this example only -->
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<!-- example styles -->
<style>
html, body, #canvas {
height: 90%;
padding: 0;
margin: 0;
}
.diagram-note {
background-color: rgba(66, 180, 21, 0.7);
color: White;
border-radius: 5px;
font-family: Arial;
font-size: 12px;
padding: 5px;
min-height: 16px;
width: 50px;
text-align: center;
}
.needs-discussion:not(.djs-connection) .djs-visual > :nth-child(1) {
stroke: rgba(66, 180, 21, 0.7) !important; /* color elements as red */
}
</style>
</head>
<body>
<div id="result">{{ result }}</div>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.list_process_models' ) }}';">List</button>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.run_bpmn' , process_model_id=process_model.id ) }}';">Run</button>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.edit_bpmn' , process_model_id=process_model.id ) }}';">Edit</button>
<div id="canvas"></div>
<meta id="bpmn_xml" data-name="{{bpmn_xml}}">
<script>
var diagramUrl = 'https://cdn.staticaly.com/gh/bpmn-io/bpmn-js-examples/dfceecba/starter/diagram.bpmn';
// viewer instance
var bpmnViewer = new BpmnJS({
container: '#canvas'
});
/**
* Open diagram in our viewer instance.
*
* @param {String} bpmnXML diagram to display
*/
async function openDiagram(bpmnXML) {
// import diagram
try {
await bpmnViewer.importXML(bpmnXML);
// access viewer components
var canvas = bpmnViewer.get('canvas');
var overlays = bpmnViewer.get('overlays');
// zoom to fit full viewport
canvas.zoom('fit-viewport');
// attach an overlay to a node
overlays.add('SCAN_OK', 'note', {
position: {
bottom: 0,
right: 0
},
html: '<div class="diagram-note">Mixed up the labels?</div>'
});
// add marker
canvas.addMarker('SCAN_OK', 'needs-discussion');
} catch (err) {
console.error('could not import BPMN 2.0 diagram', err);
}
}
var bpmn_xml = $('#bpmn_xml').data();
openDiagram(bpmn_xml.name)
// load external diagram file via AJAX and open it
//$.get(diagramUrl, openDiagram, 'text');
</script>
<!--
Thanks for trying out our BPMN toolkit!
If you'd like to learn more about what our library,
continue with some more basic examples:
* https://github.com/bpmn-io/bpmn-js-examples/overlays
* https://github.com/bpmn-io/bpmn-js-examples/interaction
* https://github.com/bpmn-io/bpmn-js-examples/colors
* https://github.com/bpmn-io/bpmn-js-examples/commenting
To get a bit broader overview over how bpmn-js works,
follow our walkthrough:
* https://bpmn.io/toolkit/bpmn-js/walkthrough/
Related starters:
* https://raw.githubusercontent.com/bpmn-io/bpmn-js-examples/starter/modeler.html
-->
</body>
</html>

View File

@ -47,7 +47,7 @@
</head>
<body>
<div id="result">{{ result }}</div>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.listProcessModels' ) }}';">List</button>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.list_process_models' ) }}';">List</button>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.run_bpmn' , process_model_id=process_model_id ) }}';">Run</button>
<button type="button" onclick="window.location.href='{{ url_for( 'admin.edit_bpmn' , process_model_id=process_model_id ) }}';">Edit</button>
<div id="canvas"></div>
@ -120,4 +120,4 @@
* https://raw.githubusercontent.com/bpmn-io/bpmn-js-examples/starter/modeler.html
-->
</body>
</html>
</html>