diff --git a/lib/job_server.py b/lib/job_server.py index 33ce585..0641740 100755 --- a/lib/job_server.py +++ b/lib/job_server.py @@ -61,7 +61,8 @@ def job_detail(job_id): media_basename = os.path.basename(found_job.file_list()[0]) media_url = f"/api/job/{job_id}/file/{media_basename}" return render_template('details.html', detail_table=table_html, media_url=media_url, - job_status=found_job.render_status().value.title(), job=found_job) + hostname=RenderQueue.host_name, job_status=found_job.render_status().value.title(), + job=found_job, renderer_info=renderer_info()) return f'Cannot find job with ID {job_id}', 400 @@ -111,7 +112,7 @@ def filtered_jobs_json(status_val): return f'Cannot find jobs with status {status_val}', 400 -@server.get('/api/job_status/') +@server.get('/api/job/') def get_job_status(job_id): found_job = RenderQueue.job_with_id(job_id) if found_job: diff --git a/lib/render_job.py b/lib/render_job.py index 060b63d..8e3e6fb 100644 --- a/lib/render_job.py +++ b/lib/render_job.py @@ -47,6 +47,7 @@ class RenderJob: job_dict['status'] = self.render_status().value job_dict['time_elapsed'] = self.time_elapsed() if type(self.time_elapsed) != str else self.time_elapsed job_dict['file_hash'] = self.file_hash if self.file_hash and isinstance(self.file_hash, str) else self.file_hash() + job_dict['percent_complete'] = self.percent_complete() job_dict['file_list'] = self.file_list() job_dict['worker'] = self.worker.__dict__.copy() job_dict['worker']['status'] = job_dict['status'] diff --git a/lib/static/cancelled.png b/lib/static/images/cancelled.png similarity index 100% rename from lib/static/cancelled.png rename to lib/static/images/cancelled.png diff --git a/lib/static/images/desktop.png b/lib/static/images/desktop.png new file mode 100644 index 0000000..b04158c Binary files /dev/null and b/lib/static/images/desktop.png differ diff --git a/lib/static/error.png b/lib/static/images/error.png similarity index 100% rename from lib/static/error.png rename to lib/static/images/error.png diff --git a/lib/static/gears.png b/lib/static/images/gears.png similarity index 100% rename from lib/static/gears.png rename to lib/static/images/gears.png diff --git a/lib/static/images/logo.png b/lib/static/images/logo.png new file mode 100644 index 0000000..9ffcebd Binary files /dev/null and b/lib/static/images/logo.png differ diff --git a/lib/static/not_started.png b/lib/static/images/not_started.png similarity index 100% rename from lib/static/not_started.png rename to lib/static/images/not_started.png diff --git a/lib/static/scheduled.png b/lib/static/images/scheduled.png similarity index 100% rename from lib/static/scheduled.png rename to lib/static/images/scheduled.png diff --git a/lib/static/spinner.gif b/lib/static/images/spinner.gif similarity index 100% rename from lib/static/spinner.gif rename to lib/static/images/spinner.gif diff --git a/lib/static/js/job_table.js b/lib/static/js/job_table.js new file mode 100644 index 0000000..2538dc6 --- /dev/null +++ b/lib/static/js/job_table.js @@ -0,0 +1,71 @@ +const grid = new gridjs.Grid({ +columns: [ + { data: (row) => row.id, + name: 'Thumbnail', + formatter: (cell) => gridjs.html(``), + sort: {enabled: false} + }, + { id: 'name', + name: 'Name', + data: (row) => row.name, + formatter: (name, row) => gridjs.html(`${name}`) + }, + { id: 'renderer', data: (row) => `${row.renderer}-${row.worker.renderer_version}`, name: 'Renderer' }, + { id: 'priority', name: 'Priority' }, + { id: 'status', + name: 'Status', + data: (row) => row, + formatter: (cell, row) => gridjs.html(` + ${cell.status} + ${cell.status} + `)}, + { id: 'time_elapsed', name: 'Time Elapsed' }, + { data: (row) => row.worker.total_frames, name: 'Frame Count' }, + { id: 'client', name: 'Client'}, + { data: (row) => row.worker.last_output, + name: 'Last Output', + formatter: (output, row) => gridjs.html(`${output}`) + }, + { data: (row) => row, + name: 'Commands', + formatter: (cell, row) => gridjs.html(` +
+ + + + + +
+ `), + sort: false + } +], +style: { + table: { + 'white-space': 'nowrap' + }, + th: { + 'vertical-align': 'middle', + }, + td: { + 'vertical-align': 'middle', + } +}, +server: { + url: '/api/jobs', + then: results => results, +}, +sort: true, +}).render(document.getElementById('table')); \ No newline at end of file diff --git a/lib/static/modals.js b/lib/static/js/modals.js similarity index 100% rename from lib/static/modals.js rename to lib/static/js/modals.js diff --git a/templates/details.html b/templates/details.html index 203e413..76b200b 100644 --- a/templates/details.html +++ b/templates/details.html @@ -1,52 +1,48 @@ - - - - - - Zordon Dashboard - - - - +{% extends 'layout.html' %} - - -
+{% block body %} +
+
{% if media_url: %} {% elif job_status == 'Running': %} -
- - - Rendering - {{ '{0:0.0f}'.format(job.percent_complete() * 100) }}% - +
+ + + Rendering + Rendering in Progress - {{(job.percent_complete() * 100) | int}}% +
Time Elapsed: {{job.time_elapsed()}} +
+
{% else %}
- - + + {{job_status}}
{% endif %} +
{{detail_table|safe}}
- - - \ No newline at end of file +{% endblock %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index a224d3c..f0de9ec 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,296 +1,8 @@ - - - - - - Zordon Dashboard - - - - - - +{% extends 'layout.html' %} - - -
- - - - - - - - - - - - - - - - - - - - - - {% for job in all_jobs %} - - - - - - - - - - - - - - - - {% endfor %} -
PreviewNameRendererPriorityStatusTime Elapsed%Frame CountClientLast OutputCommands
- - - - {{job.name}}{{job.renderer}}-{{job.worker.renderer_version}}{{job.priority}}{{job.render_status().value}}{{job.time_elapsed()}}{{ '{0:0.0f}'.format(job.percent_complete() * 100) }}%{{job.frame_count()}}{{job.client}}{{job.worker.last_output}} -
- - - {% if job.render_status().value in ['running', 'scheduled', 'not_started']: %} - - {% elif job.render_status().value == 'completed': %} - - {% endif %} - -
-
+{% block body %} +
+
- - - - - \ No newline at end of file + +{% endblock %} \ No newline at end of file diff --git a/templates/layout.html b/templates/layout.html new file mode 100644 index 0000000..71ac978 --- /dev/null +++ b/templates/layout.html @@ -0,0 +1,236 @@ + + + + + + Zordon Dashboard + + + + + + + + + + + + +{% block body %} +{% endblock %} + + + + + \ No newline at end of file