mirror of
https://github.com/sartography/spiffworkflow-backend.git
synced 2025-02-24 05:18:22 +00:00
add list of files to process model show and allow for filtering files by extension
This commit is contained in:
parent
eee52eb400
commit
4ff7d770c2
@ -24,7 +24,6 @@ def process_model_run(process_model_id):
|
||||
result = processor.get_data()
|
||||
|
||||
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('process_model_show.html', process_model=process_model, bpmn_xml=bpmn_xml, result=result)
|
||||
@ -34,7 +33,6 @@ def process_model_run(process_model_id):
|
||||
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('process_model_edit.html', bpmn_xml=bpmn_xml.decode("utf-8"),
|
||||
@ -45,20 +43,19 @@ def process_model_edit(process_model_id):
|
||||
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('process_model_edit.html', bpmn_xml=bpmn_xml.decode("utf-8"),
|
||||
process_model=process_model)
|
||||
|
||||
|
||||
@admin_blueprint.route("/process-models/<process_model_id>/<file_id>", methods=["GET"])
|
||||
def process_model_show_file(process_model_id, file_id):
|
||||
@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)
|
||||
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)
|
||||
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-groups/<process_group_id>", methods=["GET"])
|
||||
@ -79,8 +76,10 @@ def process_groups_list():
|
||||
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)
|
||||
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:
|
||||
|
@ -49,7 +49,22 @@ html, body, #canvas {
|
||||
<div id="result">{{ result }}</div>
|
||||
<button type="button" onclick="window.location.href='{{ url_for( 'admin.process_group_show', process_group_id=process_model.process_group_id ) }}';">Back</button>
|
||||
<button type="button" onclick="window.location.href='{{ url_for( 'admin.process_model_run' , process_model_id=process_model.id ) }}';">Run</button>
|
||||
<button type="button" onclick="window.location.href='{{ url_for( 'admin.process_model_edit' , process_model_id=process_model.id ) }}';">Edit</button>
|
||||
|
||||
{% if files %}
|
||||
<h3>BPMN Files</h3>
|
||||
<ul>
|
||||
{% for file in files %}
|
||||
<li>
|
||||
<a href="{{ url_for('admin.process_model_show_file', process_model_id=process_model.id, file_name=file.name) }}">{{ file.name }}</a>
|
||||
{% if file.name == current_file_name %}
|
||||
(current)
|
||||
{% endif %}
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<div id="canvas"></div>
|
||||
|
||||
<meta id="bpmn_xml" data-name="{{bpmn_xml}}">
|
||||
|
@ -23,7 +23,7 @@ class SpecFileService(FileSystemService):
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_files(workflow_spec: ProcessModelInfo, file_name=None, include_libraries=False) -> List[File]:
|
||||
def get_files(workflow_spec: ProcessModelInfo, file_name=None, include_libraries=False, extension_filter="") -> List[File]:
|
||||
""" Returns all files associated with a workflow specification."""
|
||||
path = SpecFileService.workflow_path(workflow_spec)
|
||||
files = SpecFileService._get_files(path, file_name)
|
||||
@ -31,6 +31,10 @@ class SpecFileService(FileSystemService):
|
||||
for lib_name in workflow_spec.libraries:
|
||||
lib_path = SpecFileService.library_path(lib_name)
|
||||
files.extend(SpecFileService._get_files(lib_path, file_name))
|
||||
|
||||
if extension_filter != "":
|
||||
files = filter(lambda file: file.name.endswith(extension_filter), files)
|
||||
|
||||
return files
|
||||
|
||||
@staticmethod
|
||||
|
Loading…
x
Reference in New Issue
Block a user