git commit, converted over to base.html pulling Status*, rather than every render_template calling it. Tightened up naming for job manager, fixed a few bugs in there with items like div by zero, created the active jobs link/badge in navbar, have it invoked each time by base.html template and it gets active jobs from DB, pa_job_manager now initiliases from an empty DB and can work out where it is at, no loop/thread/or actual job code yet. jobs.py has basics of a NewJob(), so next step is to force that job to be executed in pa_job_manager, but its tea time

This commit is contained in:
2021-01-16 17:51:16 +11:00
parent dc2ea1265f
commit e138ab22aa
12 changed files with 156 additions and 72 deletions

View File

@@ -1,22 +1,48 @@
{% extends "base.html" %}
{% block main_content %}
<script>
var active_rows=Array()
var completed_rows=Array()
{% for job in jobs %}
row=`
<tr><td>
<a href="{{url_for('joblog', id=job.id )}}">{{job.name}}</td><td>{{job.start_time}}</td>
<td>
`
{% if job.pa_job_state != "Completed" %}
row +=`
<div class="progress">
{% set prog=(job.current_pass/job.num_passes*100)|round|int %}
<div class="progress-bar" role="progressbar" style="width: {{prog}}%;" aria-valuenow="{{prog}}" aria-valuemin="0" aria-valuemax="100">{{job.current_pass}} of {{job.num_passes}}</div>
</div>
</td></tr>
`
active_rows.push(row)
{% else %}
row +=`
{{job.last_update}}</td></td></tr>
`
completed_rows.push(row)
{% endif %}
{% endfor %}
</script>
<h3>{{page_title}}</h3>
<table id="import_tbl" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
<table id="job_tbl" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
<thead>
<tr class="thead-light"><th>Import Id</th><th>Import Started</th><th>Passes</th></tr>
<tr class="thead-light"><th>Active Jobs</th><th>Job Started</th><th>Passes</th></tr>
</thead>
<tbody>
{% for imp in imports %}
<tr><td><a href="{{url_for('importlog', id=imp.id )}}">{{imp.id}}</td><td>{{imp.start_time}}</td>
<td>
<div class="progress">
{% set prog=(imp.current_pass/imp.num_passes*100)|round|int %}
<div class="progress-bar" role="progressbar" style="width: {{prog}}%;" aria-valuenow="{{prog}}" aria-valuemin="0" aria-valuemax="100">{{imp.current_pass}} of {{imp.num_passes}}</div>
</div>
</td>
</tr>
{% endfor %}
<script>
for(el in active_rows)
document.write(active_rows[el])
document.write( '<tr class="thead-light"><th>Completed Jobs</th><th>Job Started</th><th>Job Completed</th></tr>' )
for(el in completed_rows)
document.write(completed_rows[el])
</script>
</tbody>
</table>
{% endblock main_content %}