2020-02-07 14:21:59 +00:00
|
|
|
{% extends "nopaque.html.j2" %}
|
2020-10-30 09:35:29 +00:00
|
|
|
{% from '_colors.html.j2' import colors %}
|
2019-08-09 09:49:09 +00:00
|
|
|
|
2020-09-21 08:36:04 +00:00
|
|
|
{% if job.service == 'file-setup' %}
|
2020-10-30 09:35:29 +00:00
|
|
|
{% set border_color = colors.file_setup_darken %}
|
2020-09-21 08:36:04 +00:00
|
|
|
{% set main_class = 'file-setup-color lighten' %}
|
2020-10-30 09:35:29 +00:00
|
|
|
{% set scheme_color = colors.file_setup_darken %}
|
2020-09-21 08:36:04 +00:00
|
|
|
{% elif job.service == 'nlp' %}
|
2020-10-30 09:35:29 +00:00
|
|
|
{% set border_color = colors.nlp_darken %}
|
2020-09-21 08:36:04 +00:00
|
|
|
{% set main_class = 'nlp-color lighten' %}
|
2020-10-30 09:35:29 +00:00
|
|
|
{% set scheme_color = colors.nlp_darken %}
|
2020-09-21 08:36:04 +00:00
|
|
|
{% elif job.service == 'ocr' %}
|
2020-10-30 09:35:29 +00:00
|
|
|
{% set border_color = colors.ocr_darken %}
|
2020-09-21 08:36:04 +00:00
|
|
|
{% set main_class = 'ocr-color lighten' %}
|
2020-10-30 09:35:29 +00:00
|
|
|
{% set scheme_color = colors.ocr_darken %}
|
2020-09-21 08:36:04 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2020-10-30 14:01:41 +00:00
|
|
|
{% block nav_content %}
|
|
|
|
{% include 'jobs/_breadcrumbs.html.j2' %}
|
|
|
|
{% endblock nav_content %}
|
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
{% block main_attribs %} class="{{ main_class }}"{% endblock main_attribs %}
|
2020-09-21 08:36:04 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
{% block page_content %}
|
|
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col s12">
|
2020-11-03 09:12:06 +00:00
|
|
|
<h1>[{{ job.service }}] {{ job.title }}</h1>
|
2020-10-26 12:04:12 +00:00
|
|
|
</div>
|
2019-09-11 12:51:59 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12">
|
|
|
|
<div class="card" style="border-top: 10px solid {{border_color}}">
|
|
|
|
<div class="card-content">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col s8 m9 l10">
|
|
|
|
<span class="card-title title">{{ job.title }}</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col s4 m3 l2 right-align">
|
|
|
|
<span class="chip status white-text"></span>
|
2020-10-30 09:19:45 +00:00
|
|
|
<div class="active preloader-wrapper small status-spinner" id="progress-indicator">
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="spinner-layer spinner-blue-only">
|
|
|
|
<div class="circle-clipper left">
|
|
|
|
<div class="circle"></div>
|
|
|
|
</div>
|
|
|
|
<div class="gap-patch">
|
|
|
|
<div class="circle"></div>
|
|
|
|
</div>
|
|
|
|
<div class="circle-clipper right">
|
|
|
|
<div class="circle"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-13 14:36:06 +00:00
|
|
|
</div>
|
2020-02-12 13:48:29 +00:00
|
|
|
</div>
|
2020-05-13 14:36:06 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12">
|
|
|
|
<p class="description">{{ job.description }}</p>
|
|
|
|
</div>
|
2020-05-13 14:36:06 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12"> </div>
|
2020-05-13 14:36:06 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12 m6">
|
|
|
|
<div class="input-field">
|
|
|
|
<input disabled id="creation-date" type="text" value="{{ job.creation_date.strftime('%d/%m/%Y, %H:%M:%S %p') }}">
|
|
|
|
<label for="creation-date">Creation date</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-12 13:48:29 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12 m6">
|
|
|
|
<div class="input-field">
|
|
|
|
<input class="end-date" disabled id="end-date" type="text" value="">
|
|
|
|
<label for="end-date">End date</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-13 14:36:06 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12 m4">
|
|
|
|
<div class="input-field">
|
|
|
|
<input disabled id="service" type="text" value="{{ job.service }}">
|
|
|
|
<label for="service">Service</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-12 13:48:29 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12 m4">
|
|
|
|
<div class="input-field">
|
|
|
|
<input disabled id="service-args" type="text" value="{{ job.service_args|e }}">
|
|
|
|
<label for="service-args">Service arguments</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-13 14:36:06 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12 m4">
|
|
|
|
<div class="input-field">
|
|
|
|
<input disabled id="service-version" type="text" value="{{ job.service_version }}">
|
|
|
|
<label for="service-version">Service version</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-12 13:48:29 +00:00
|
|
|
</div>
|
2020-05-13 14:36:06 +00:00
|
|
|
</div>
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="card-action right-align">
|
|
|
|
{% if current_user.is_administrator() and job.status == 'failed' %}
|
|
|
|
<a href="{{ url_for('jobs.restart', job_id=job.id) }}" class="btn waves-effect waves-light"><i class="material-icons left">repeat</i>Restart</a>
|
|
|
|
{% endif %}
|
|
|
|
<!-- <a href="#" class="btn disabled waves-effect waves-light"><i class="material-icons left">settings</i>Export Parameters</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>
|
2020-05-13 14:36:06 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-content" id="inputs">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col s12 m2">
|
|
|
|
<span class="card-title"><i class="left material-icons" style="font-size: inherit;">input</i>Inputs</span>
|
|
|
|
<p>Original input files.</p>
|
|
|
|
</div>
|
|
|
|
<div class="col s12 m10">
|
|
|
|
<table class="highlight responsive-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class="sort" data-sort="filename">Filename</th>
|
|
|
|
<th>{# Actions #}</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="list">
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2020-11-22 15:03:41 +00:00
|
|
|
<ul class="pagination"></ul>
|
2020-10-26 12:04:12 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-13 14:36:06 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
<div class="col s12">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-content">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col s12 m2">
|
|
|
|
<span class="card-title"><i class="left material-icons" style="font-size: inherit;">done</i>Results</span>
|
|
|
|
<p>Processed result files.</p>
|
|
|
|
</div>
|
|
|
|
<div class="col s12 m10">
|
|
|
|
<table class="highlight responsive-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Result Type</th>
|
|
|
|
<th>Archive Name</th>
|
|
|
|
<th>{# Actions #}</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="results">
|
|
|
|
<tr class="show-if-only-child">
|
|
|
|
<td colspan="3">
|
|
|
|
<span class="card-title">
|
|
|
|
<i class="left material-icons" style="font-size: inherit;">file_download</i>Nothing here...
|
|
|
|
</span>
|
|
|
|
<p>
|
|
|
|
No results available (yet). Is the job already completed?
|
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-12 13:48:29 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-13 14:36:06 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-08-09 09:49:09 +00:00
|
|
|
</div>
|
|
|
|
|
2019-11-04 15:58:15 +00:00
|
|
|
<!-- Modals -->
|
|
|
|
<div id="delete-job-modal" class="modal">
|
|
|
|
<div class="modal-content">
|
|
|
|
<h4>Confirm deletion</h4>
|
2020-05-13 14:36:06 +00:00
|
|
|
<p>Do you really want to delete the job {{ job.title }}? All associated files will be permanently deleted.</p>
|
2019-11-04 15:58:15 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2020-02-20 14:59:08 +00:00
|
|
|
<a href="#!" class="btn modal-close waves-effect waves-light">Cancel</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>
|
2019-11-04 15:58:15 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-26 12:04:12 +00:00
|
|
|
{% endblock page_content %}
|
2019-11-15 10:45:04 +00:00
|
|
|
|
2020-10-26 12:04:12 +00:00
|
|
|
{% block scripts %}
|
|
|
|
{{ super() }}
|
2020-09-17 09:12:08 +00:00
|
|
|
<script type="module">
|
|
|
|
import {RessourceList} from '../../static/js/nopaque.lists.js';
|
|
|
|
class InformationUpdater {
|
|
|
|
constructor(jobId, foreignJobFlag) {
|
|
|
|
this.jobId = jobId;
|
|
|
|
this.foreignJobFlag = foreignJobFlag;
|
2020-04-15 12:30:41 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
if (this.foreignJobFlag) {
|
|
|
|
nopaque.foreignJobsSubscribers.push(this);
|
|
|
|
} else {
|
|
|
|
nopaque.jobsSubscribers.push(this);
|
2019-11-15 10:45:04 +00:00
|
|
|
}
|
2020-09-17 09:12:08 +00:00
|
|
|
}
|
2019-11-15 10:45:04 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
_init() {
|
|
|
|
let job;
|
2020-01-20 08:49:39 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
job = (this.foreignJobFlag ? nopaque.foreignUser.jobs[this.jobId]
|
|
|
|
: nopaque.user.jobs[this.jobId]);
|
|
|
|
// Results
|
|
|
|
this.addResults(job.results);
|
|
|
|
// End date
|
|
|
|
this.setEndDate(job.end_date);
|
|
|
|
// Status
|
|
|
|
this.setStatus(job.status);
|
|
|
|
}
|
2019-11-15 10:45:04 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
_update(patch) {
|
|
|
|
let pathArray;
|
2019-11-15 10:45:04 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
for (let operation of patch) {
|
|
|
|
/* "/jobs/{jobId}/..." -> ["{jobId}", ...] */
|
|
|
|
pathArray = operation.path.split("/").slice(2);
|
|
|
|
if (pathArray[0] != this.jobId) {continue;}
|
|
|
|
switch(operation.op) {
|
|
|
|
case "add":
|
|
|
|
if (pathArray[1] === "results") {
|
|
|
|
this.addResults([operation.value]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "delete":
|
|
|
|
location.reload();
|
|
|
|
break;
|
|
|
|
case "replace":
|
|
|
|
if (pathArray[1] === "end_date") {
|
|
|
|
this.setEndDate(operation.value);
|
|
|
|
} else if (pathArray[1] === "status") {
|
|
|
|
this.setStatus(operation.value);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2019-11-15 10:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-17 09:12:08 +00:00
|
|
|
}
|
2019-11-15 10:45:04 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
addResults(results) {
|
|
|
|
let resultsArray, resultsElements, resultsHTML, resultType;
|
|
|
|
resultsArray = Object.values(results);
|
|
|
|
resultsArray.sort(function (a, b) {
|
|
|
|
if (a.filename < b.filename) {return -1;}
|
|
|
|
if (a.filename > b.filename) {return 1;}
|
|
|
|
return 0;
|
|
|
|
});
|
|
|
|
resultsHTML = ``;
|
|
|
|
for (let result of resultsArray) {
|
|
|
|
if (result.filename.endsWith(".pdf.zip")) {
|
|
|
|
resultType = "PDF file with text layer";
|
|
|
|
} else if (result.filename.endsWith(".txt.zip")) {
|
|
|
|
resultType = "Raw text files";
|
|
|
|
} else if (result.filename.endsWith(".vrt.zip")) {
|
|
|
|
resultType = "VRT(XML dialect) files holding the NLP data";
|
|
|
|
} else if (result.filename.endsWith(".xml.zip")) {
|
|
|
|
resultType = "XML files";
|
|
|
|
} else if (result.filename.endsWith(".poco.zip")) {
|
|
|
|
resultType = "HCOR und image files needed for Post correction(PoCo)";
|
|
|
|
} else {
|
|
|
|
resultType = "All result files created during this job";
|
|
|
|
}
|
2020-06-10 14:00:33 +00:00
|
|
|
resultsHTML += `
|
2020-09-17 09:12:08 +00:00
|
|
|
<tr>
|
|
|
|
<td>${resultType}</td>
|
|
|
|
<td>${result.filename}</td>
|
|
|
|
<td class="right-align">
|
|
|
|
<a class="btn-floating tooltipped waves-effect waves-light"
|
|
|
|
download href="/jobs/${result.job_id}/results/${result.id}/download"
|
|
|
|
data-position="top"
|
|
|
|
data-tooltip="Download">
|
|
|
|
<i class="material-icons">file_download</i>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2020-06-10 14:00:33 +00:00
|
|
|
`;
|
2020-09-17 09:12:08 +00:00
|
|
|
};
|
|
|
|
resultsHTML += `
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
`;
|
|
|
|
resultsElements = document.querySelectorAll(".results");
|
|
|
|
for (let resultsElement of resultsElements) {
|
|
|
|
resultsElement.innerHTML += resultsHTML;
|
2019-11-15 10:45:04 +00:00
|
|
|
}
|
2020-09-17 09:12:08 +00:00
|
|
|
}
|
2019-11-15 10:45:04 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
setEndDate(timestamp) {
|
|
|
|
let endDate;
|
2020-05-13 14:36:06 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
if (timestamp === null) {
|
|
|
|
endDate = "N.a.";
|
|
|
|
} else {
|
|
|
|
endDate = new Date(timestamp * 1000).toLocaleString("en-US");
|
2020-05-13 14:36:06 +00:00
|
|
|
}
|
2020-09-17 09:12:08 +00:00
|
|
|
document.getElementById("end-date").value = endDate;
|
|
|
|
M.updateTextFields();
|
|
|
|
}
|
2020-05-13 14:36:06 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
setStatus(status) {
|
|
|
|
let progressIndicator, statusElements;
|
|
|
|
if (status === "complete" || status === "failed") {
|
|
|
|
progressIndicator = document.getElementById("progress-indicator");
|
|
|
|
progressIndicator.classList.add("hide");
|
|
|
|
}
|
|
|
|
statusElements = document.querySelectorAll(".status");
|
|
|
|
for (let statusElement of statusElements) {
|
|
|
|
statusElement.dataset.status = status;
|
2019-11-15 10:45:04 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-17 09:12:08 +00:00
|
|
|
}
|
2019-11-15 10:45:04 +00:00
|
|
|
|
2020-09-17 09:12:08 +00:00
|
|
|
{% if job.creator == current_user %}
|
|
|
|
var informationUpdater = new InformationUpdater({{ job.id }}, false);
|
|
|
|
{% else %}
|
|
|
|
var informationUpdater = new InformationUpdater({{ job.id }}, true);
|
2020-10-26 12:04:12 +00:00
|
|
|
nopaque.socket.emit("foreign_user_data_stream_init", {{ job.user_id }});
|
2020-09-17 09:12:08 +00:00
|
|
|
{% endif %}
|
|
|
|
let jobInputsList = new RessourceList("inputs", null, "JobInput");
|
2020-10-26 12:04:12 +00:00
|
|
|
jobInputsList._add({{ job_inputs|tojson|safe }});
|
2019-11-15 10:45:04 +00:00
|
|
|
</script>
|
2020-10-26 12:04:12 +00:00
|
|
|
{% endblock scripts %}
|