Rework jobs package

This commit is contained in:
Patrick Jentsch 2020-10-26 13:04:12 +01:00
parent 73a597fdd2
commit a996d36f2d

View File

@ -1,28 +1,30 @@
{% extends "nopaque.html.j2" %} {% extends "nopaque.html.j2" %}
{% from '_constants.html.j2' import COLORS %}
{% set headline = '<i class="left material-icons service" data-service="{service}" style="font-size: inherit;"></i>Job ({service}) - {title}'.format(service=job.service, title=job.title) %}
{% if job.service == 'file-setup' %} {% if job.service == 'file-setup' %}
{% set border_color = COLORS.file_setup_darken %}
{% set main_class = 'file-setup-color lighten' %} {% set main_class = 'file-setup-color lighten' %}
{% set scheme_color = COLORS.file_setup_darken %}
{% elif job.service == 'nlp' %} {% elif job.service == 'nlp' %}
{% set border_color = COLORS.nlp_darken %}
{% set main_class = 'nlp-color lighten' %} {% set main_class = 'nlp-color lighten' %}
{% set scheme_color = COLORS.nlp_darken %}
{% elif job.service == 'ocr' %} {% elif job.service == 'ocr' %}
{% set border_color = COLORS.ocr_darken %}
{% set main_class = 'ocr-color lighten' %} {% set main_class = 'ocr-color lighten' %}
{% set scheme_color = COLORS.ocr_darken %}
{% endif %} {% endif %}
{% block main_attribs %} class="{{ main_class }}"{% endblock main_attribs %}
{% block page_content %} {% block page_content %}
<div class="container">
<div class="row">
<div class="col s12">
<h1><i class="left material-icons service" data-service="{{ job.service }}" style="font-size: inherit;"></i>Job ({{ job.service }}) - {{ job.title }}</h1>
</div>
{% if job.service == 'file-setup' %} <div class="col s12">
{{ Macros.insert_color_scheme(file_setup_color_darken) }}
{% set border_color = file_setup_color_darken %}
{% elif job.service == 'nlp' %}
{{ Macros.insert_color_scheme(nlp_color_darken) }}
{% set border_color = nlp_color_darken %}
{% elif job.service == 'ocr' %}
{{ Macros.insert_color_scheme(ocr_color_darken) }}
{% set border_color = ocr_color_darken %}
{% endif %}
<div class="col s12">
<div class="card" style="border-top: 10px solid {{border_color}}"> <div class="card" style="border-top: 10px solid {{border_color}}">
<div class="card-content"> <div class="card-content">
<div class="row"> <div class="row">
@ -97,9 +99,9 @@
<a data-target="delete-job-modal" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete</a> <a data-target="delete-job-modal" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete</a>
</div> </div>
</div> </div>
</div> </div>
<div class="col s12"> <div class="col s12">
<div class="card"> <div class="card">
<div class="card-content" id="inputs"> <div class="card-content" id="inputs">
<div class="row"> <div class="row">
@ -124,9 +126,9 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="col s12"> <div class="col s12">
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<div class="row"> <div class="row">
@ -160,9 +162,10 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div> </div>
<!-- Modals --> <!-- Modals -->
<div id="delete-job-modal" class="modal"> <div id="delete-job-modal" class="modal">
<div class="modal-content"> <div class="modal-content">
@ -174,8 +177,10 @@
<a class="btn modal-close red waves-effect waves-light" href="{{ url_for('jobs.delete_job', job_id=job.id) }}"><i class="material-icons left">delete</i>Delete</a> <a class="btn modal-close red waves-effect waves-light" href="{{ url_for('jobs.delete_job', job_id=job.id) }}"><i class="material-icons left">delete</i>Delete</a>
</div> </div>
</div> </div>
{% endblock page_content %}
{% block scripts %}
{{ super() }}
<script type="module"> <script type="module">
import {RessourceList} from '../../static/js/nopaque.lists.js'; import {RessourceList} from '../../static/js/nopaque.lists.js';
class InformationUpdater { class InformationUpdater {
@ -309,13 +314,9 @@ class InformationUpdater {
var informationUpdater = new InformationUpdater({{ job.id }}, false); var informationUpdater = new InformationUpdater({{ job.id }}, false);
{% else %} {% else %}
var informationUpdater = new InformationUpdater({{ job.id }}, true); var informationUpdater = new InformationUpdater({{ job.id }}, true);
document.addEventListener("DOMContentLoaded", () => { nopaque.socket.emit("foreign_user_data_stream_init", {{ job.user_id }});
nopaque.socket.emit("foreign_user_data_stream_init", {{ job.user_id }});
});
{% endif %} {% endif %}
let jobInputsList = new RessourceList("inputs", null, "JobInput"); let jobInputsList = new RessourceList("inputs", null, "JobInput");
document.addEventListener("DOMContentLoaded", () => { jobInputsList._add({{ job_inputs|tojson|safe }});
jobInputsList._add({{ job_inputs|tojson|safe }});
});
</script> </script>
{% endblock %} {% endblock scripts %}