Skip to content
Snippets Groups Projects
Commit a55aa143 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

Merge branch 'master' into 'dev-nico'

Master

See merge request !120
parents 695c501c 0f803d03
Branches
No related tags found
4 merge requests!143Query Page:,!125Master,!124Dev nico,!120Master
...@@ -7,11 +7,37 @@ ...@@ -7,11 +7,37 @@
<div class="card-body"> <div class="card-body">
<h3>Inputs </h3> <h3>Inputs </h3>
<table class="table table-striped"> <table class="table table-striped">
<tbody> <tbody id="inputs_table">
{{ results | safe }}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<script>
var inputs_values = {{ resultsjson | safe }}
function generate_tree(tree, div) {
if (Array.isArray(tree)) {
var array = $("<tbody></tbody>")
div.append(array)
for (let row_index in tree) {
var row = $('<tr></tr>')
generate_tree(tree[row_index], row)
array.append(row)
}
} else if (typeof (tree) === 'object' && tree !== null) {
for (var att_name in tree) {
var row = $(`<tr><td><b>${att_name}</b></td></tr>`)
generate_tree(tree[att_name], row);
div.append(
row
)
}
} else {
div.append(`<td>${tree}</td>`)
}
}
generate_tree(inputs_values, $('#inputs_table'))
</script>
{% endblock %} {% endblock %}
\ No newline at end of file
{% load static %} {% load static %}
{% block myBlock %} {% block myBlock %}
...@@ -7,11 +6,39 @@ ...@@ -7,11 +6,39 @@
<div class="card-body"> <div class="card-body">
<h3>Outputs </h3> <h3>Outputs </h3>
<table class="table table-striped"> <table class="table table-striped">
<tbody> <tbody id="output_values">
{{ results | safe }}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<script>
var output_values = {{ resultsjson | safe }}
function generate_tree(tree, div) {
if (Array.isArray(tree)) {
var array = $("<tbody></tbody>")
div.append(array)
for (let row_index in tree) {
var row = $('<tr></tr>')
generate_tree(tree[row_index], row)
array.append(row)
}
} else if (typeof (tree) === 'object' && tree !== null) {
for (var att_name in tree) {
var row = $(`<tr><td><b>${att_name}</b></td></tr>`)
generate_tree(tree[att_name], row);
div.append(
row
)
}
} else {
div.append(`<td>${tree}</td>`)
}
}
generate_tree(output_values, $('#output_values'))
</script>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -267,7 +267,7 @@ def ShowInputs(request, id): ...@@ -267,7 +267,7 @@ def ShowInputs(request, id):
# convert the json to a presentable piece of html for the output template # convert the json to a presentable piece of html for the output template
results = algorithms.convert_list_of_dicts_to_html(task.inputs) results = algorithms.convert_list_of_dicts_to_html(task.inputs)
return render(request, "taskdatabase/details/inputs.html", {'results': results}) return render(request, "taskdatabase/details/inputs.html", {'results': results, 'resultsjson': task.inputs})
def ShowOutputs(request, id): def ShowOutputs(request, id):
...@@ -275,7 +275,7 @@ def ShowOutputs(request, id): ...@@ -275,7 +275,7 @@ def ShowOutputs(request, id):
# convert the json to a presentable piece of html for the output template # convert the json to a presentable piece of html for the output template
results = algorithms.convert_list_of_dicts_to_html(task.outputs) results = algorithms.convert_list_of_dicts_to_html(task.outputs)
return render(request, "taskdatabase/details/outputs.html", {'results': results}) return render(request, "taskdatabase/details/outputs.html", {'results': results, 'resultsjson': task.outputs})
def ShowMetrics(request, id): def ShowMetrics(request, id):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment