general clean up of lazy dt/dd tag use, also added estimate remainging in the dd for run time, rather than elsewhere

This commit is contained in:
2022-07-17 15:57:22 +10:00
parent d08d10a3ae
commit 3193b86f9f

View File

@@ -5,8 +5,8 @@
<script src="{{url_for( 'internal', filename='upstream/DataTables-1.11.3/js/jquery.dataTables.min.js' )}}"></script> <script src="{{url_for( 'internal', filename='upstream/DataTables-1.11.3/js/jquery.dataTables.min.js' )}}"></script>
<style> <style>
table.dataTable tbody td { table.dataTable tbody td {
padding: 4px 4px; padding: 4px 4px;
border-bottom-width: 0px; border-bottom-width: 0px;
} }
</style> </style>
@@ -14,86 +14,85 @@ table.dataTable tbody td {
<h3>Show Job Details</h3> <h3>Show Job Details</h3>
<dl class="row"> <dl class="row">
<dt class="col-2">Name:</dt> <dt class="col-2">Name:</dt>
<dd class="col-4">{{job.name}}</dt> <dd class="col-4">{{job.name}}</dd>
{% if job.wait_for != None %} {% if job.wait_for != None %}
<dt class="col-2">Job #:</dt> <dt class="col-2">Job #:</dt>
<dd class="col-4">{{job.id}} [Waiting on: <a href="{{url_for('joblog', id=job.wait_for)}}">Job (id={{job.wait_for}})</a>]</dd> <dd class="col-4">{{job.id}} [Waiting on: <a href="{{url_for('joblog', id=job.wait_for)}}">Job (id={{job.wait_for}})</a>]</dd>
{% else %} {% else %}
<dt class="col-2">Job #:</dt> <dt class="col-2">Job #:</dt>
<dd class="col-4">{{job.id}}</dt> <dd class="col-4">{{job.id}}</dd>
{% endif %} {% endif %}
{% if estimate != None %}
(estimated time remaining: {{estimate}})
{% endif %}
</dd>
<dt class="col-2">Current state:</dt> <dt class="col-2">Current state:</dt>
{% if job.state == "Failed" %} {% if job.state == "Failed" %}
<dd class="col-4 bg-danger text-white">{{job.state}}</dd> <dd class="col-4 bg-danger text-white">{{job.state}}</dd>
{% elif job.state == "Withdrawn" %} {% elif job.state == "Withdrawn" %}
<dd class="col-4 bg-secondary text-white">{{job.state}}</dd> <dd class="col-4 bg-secondary text-white">{{job.state}}</dd>
{% else %} {% else %}
<dd class="col-4">{{job.state}}</dd> <dd class="col-4">{{job.state}}</dd>
{% endif %} {% endif %}
<dt class="col-2">Start Time:</dt> <dt class="col-2">Start Time:</dt>
<dd class="col-4">{{job.start_time|vicdate}}</dt> <dd class="col-4">{{job.start_time|vicdate}}</dt>
<dt class="col-2">Run Time:</dt> <dt class="col-2">Run Time:</dt>
<dd class="col-4">{{duration}} <dd class="col-4">{{duration}}
<dt class="col-2">Last Update:</dt> {% if estimate != None %}
<dd class="col-4">{{job.last_update|vicdate}}</dd> (remaining: {{estimate}})
<dt class="col-2">Files in pass:</label> {% endif %}
{% if job.num_files and job.num_files > 0 %} <dt class="col-2">Last Update:</dt>
<dd class="col-4"> <dd class="col-4">{{job.last_update|vicdate}}</dd>
{% set prog=(job.current_file_num/job.num_files*100)|round|int %} <dt class="col-2">Files in pass:</dt>
<div title="{{job.current_file_num}} of {{job.num_files}} - {{prog}}%" class="progress my-auto h-100"> {% if job.num_files and job.num_files > 0 %}
<div class="progress-bar bg-info" role="progressbar" style="width: {{prog}}%;" aria-valuenow="{{prog}}" aria-valuemin="0" aria-valuemax="100">{{job.current_file_num}} of {{job.num_files}} - {{prog}}%</div> <dd class="col-4">
</div> {% set prog=(job.current_file_num/job.num_files*100)|round|int %}
</dd> <div title="{{job.current_file_num}} of {{job.num_files}} - {{prog}}%" class="progress my-auto h-100">
<dt class="col-2">Current File:</dt> <div class="progress-bar bg-info" role="progressbar" style="width: {{prog}}%;" aria-valuenow="{{prog}}" aria-valuemin="0" aria-valuemax="100">{{job.current_file_num}} of {{job.num_files}} - {{prog}}%</div>
<dd class="col-4">{{job.current_file}}</dd> </div>
{% elif job.num_files == 0 and job.current_file_num > 0 %} </dd>
<dd class="col-10">{{job.current_file_num}} of Unknown Total</dd> <dt class="col-2">Current File:</dt>
{% else %} <dd class="col-4">{{job.current_file}}</dd>
<dd class="col-10">N/A</dd> {% elif job.num_files == 0 and job.current_file_num > 0 %}
{% endif %} <dd class="col-10">{{job.current_file_num}} of Unknown Total</dd>
</dl> {% else %}
<table id="joblog_tbl" class="table table-striped table-sm sm-txt" data-toolbar="#toolbar" data-search="true"> <dd class="col-10">N/A</dd>
<thead><tr class="table-info"><th>#</th><th>When</th><th>Details</th></tr></thead> {% endif %}
<tbody> </dl>
{% for log in logs %} <table id="joblog_tbl" class="table table-striped table-sm sm-txt" data-toolbar="#toolbar" data-search="true">
<tr><td>{{loop.index}}</td><td>{{log.log_date|vicdate}}</td><td>{{log.log|safe}}</td></tr> <thead><tr class="table-info"><th>#</th><th>When</th><th>Details</th></tr></thead>
{% if display_more and loop.index == OLDEST_LOG_LIMIT %} <tbody>
<tr> {% for log in logs %}
<td>{{loop.index}}.1</td> <tr><td>{{loop.index}}</td><td>{{log.log_date|vicdate}}</td><td>{{log.log|safe}}</td></tr>
<td class="align-middle">Remaining logs hidden</td> {% if display_more and loop.index == OLDEST_LOG_LIMIT %}
<td> <tr>
<button type="button" class="btn btn-outline-info my-0 py-1 sm-txt" 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>{{loop.index}}.1</td>
</td> <td class="align-middle">Remaining logs hidden</td>
</tr> <td>
{% endif %} <button type="button" class="btn btn-outline-info my-0 py-1 sm-txt" 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>
{% endfor %} </td>
</tbody> </tr>
</table> {% endif %}
{% endfor %}
</tbody>
</table>
</div class="containter"> </div class="containter">
{% endblock main_content %} {% endblock main_content %}
{% block script_content %} {% block script_content %}
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#joblog_tbl').DataTable( $('#joblog_tbl').DataTable(
{ {
'paging': false, 'info': false, 'paging': false, 'info': false,
'order': [[1, "{{order}}"]], 'order': [[1, "{{order}}"]],
'columnDefs': [ 'columnDefs': [
{ 'orderData':[0], 'targets': [1] }, { 'orderData':[0], 'targets': [1] },
{ {
'targets': [0], 'targets': [0],
'visible': false, 'visible': false,
'searchable': false 'searchable': false
}, },
] ]
} ); } );
{% if refresh and job.pa_job_state != "Completed" %} {% if refresh and job.pa_job_state != "Completed" %}
setTimeout(function(){ window.location.reload(1); }, 3000 ) setTimeout(function(){ window.location.reload(1); }, 10000 )
{% endif %} {% endif %}
} ); } );
</script> </script>
{% endblock script_content %} {% endblock script_content %}