joblog rewrite to show only a few "newest" lines and "oldest" logs for a job, with the more button in the middle, also has a little icon to show the re-ordering that goes with each view - should really make this clickable/togglable.

This commit is contained in:
2022-01-13 21:12:09 +11:00
parent 10866c3147
commit 8a6a7a5115
6 changed files with 47 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
{% block main_content %}
<div class="container-fluid">
<h3>{{page_title}}</h3>
<h3>Show Job Details</h3>
<dl class="row">
<dt class="col-2">Job #:</dt>
<dd class="col-10">{{job.id}}</dt>
@@ -46,27 +46,31 @@
<dd class="col-10">N/A</dd>
{% endif %}
</dl>
<table id="jobort_tbl" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
<thead><tr class="table-primary"><th>When</th><th>Details</th></tr></thead>
<thead><tr class="table-primary"><th>When
<svg width="16" height="16" fill="currentColor"><use xlink:href="{{url_for('internal', filename='icons.svg')}}#sort-num-{{order}}"/></svg>
</th><th>Details</th></tr></thead>
<tbody>
{% for log in logs %}
<tr><td>{{log.log_date|vicdate}}</td><td>{{log.log|safe}}</td></tr>
{% if display_more and loop.index == NEWEST_LOG_LIMIT %}
<tr>
<td class="align-middle">Remaining logs truncated</td>
<td>
<button type="button" class="btn btn-outline-info my-0 py-1" onClick="document.body.innerHTML+='<form id=_fm method=POST action={{url_for('joblog', id=job.id)}}></form>';document.getElementById('_fm').submit();">Show all logs</button>
</td>
</tr>
{% endif %}
{% endfor %}
{% if log_cnt > logs|length %}
<tr>
<td class="align-middle">Remaining logs truncated</td>
<td>
<button type="button" class="btn btn-outline-info my-0 py-1" onClick="document.body.innerHTML+='<form id=_fm method=POST action={{url_for('joblog', id=job.id)}}></form>';document.getElementById('_fm').submit();">Show all logs</button>
</td>
</tr>
{% endif %}
</tbody>
</table>
</div class="containter">
{% endblock main_content %}
{% block script_content %}
<script>
{% if first_logs_only and job.pa_job_state != "Completed" %}
{% if display_more and job.pa_job_state != "Completed" %}
setTimeout(function(){ window.location.reload(1); }, 3000 )
{% endif %}
</script>