2019-08-09 09:49:09 +00:00
|
|
|
{% extends "base.html.j2" %}
|
|
|
|
|
|
|
|
{% block page_content %}
|
2019-09-02 13:25:30 +00:00
|
|
|
<script>
|
2019-09-24 12:04:49 +00:00
|
|
|
var job_user_id = {{ job.user_id|tojson|safe }}
|
|
|
|
socket.emit('inspect_user', job_user_id);
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
var JOB_ID = {{ job.id|tojson|safe }}
|
|
|
|
var foreignJobFlag;
|
|
|
|
{% if current_user.id == job.user_id %}
|
|
|
|
foreignJobFlag = false;
|
|
|
|
{% else %}
|
|
|
|
foreignJobFlag = true;
|
|
|
|
{% endif %}
|
2019-09-02 13:25:30 +00:00
|
|
|
|
|
|
|
class InformationUpdater {
|
|
|
|
constructor(jobId) {
|
|
|
|
this.jobId = jobId;
|
2019-09-24 12:04:49 +00:00
|
|
|
if (foreignJobFlag) {
|
|
|
|
foreignJobsSubscribers.push(this);
|
|
|
|
} else {
|
|
|
|
jobsSubscribers.push(this);
|
|
|
|
}
|
2019-09-02 13:25:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_init() {
|
|
|
|
var creationDateElement, descriptionElement, endDateElement,
|
|
|
|
memMbElement, nCoresElement, serviceElement, serviceArgsElement,
|
|
|
|
serviceVersionElement, statusColor, statusElement, titleElement;
|
|
|
|
|
2019-09-24 12:04:49 +00:00
|
|
|
if (foreignJobFlag) {
|
|
|
|
this.job = foreignJobs[this.jobId];
|
|
|
|
} else {
|
|
|
|
this.job = jobs[this.jobId];
|
|
|
|
}
|
2019-09-02 13:25:30 +00:00
|
|
|
creationDateElement = document.getElementById("creation-date");
|
2019-09-10 11:40:26 +00:00
|
|
|
creationDateElement.value = (new Date(this.job.creation_date * 1000)).toLocaleString();
|
2019-09-02 13:25:30 +00:00
|
|
|
descriptionElement = document.getElementById("description");
|
|
|
|
descriptionElement.innerHTML = this.job.description;
|
|
|
|
endDateElement = document.getElementById("end-date");
|
2019-09-10 11:40:26 +00:00
|
|
|
endDateElement.value = this.job.end_date ? (new Date(this.job.end_date * 1000)).toLocaleString() : "Not available";
|
2019-09-02 13:25:30 +00:00
|
|
|
memMbElement = document.getElementById("mem-mb");
|
|
|
|
memMbElement.value = this.job.mem_mb;
|
|
|
|
nCoresElement = document.getElementById("n-cores");
|
|
|
|
nCoresElement.value = this.job.n_cores;
|
|
|
|
serviceElement = document.getElementById("service");
|
|
|
|
serviceElement.value = this.job.service;
|
|
|
|
serviceArgsElement = document.getElementById("service-args");
|
|
|
|
serviceArgsElement.value = this.job.service_args;
|
|
|
|
serviceVersionElement = document.getElementById("service-version");
|
|
|
|
serviceVersionElement.value = this.job.service_version;
|
2019-10-23 06:35:15 +00:00
|
|
|
statusColor = JobList.STATUS_COLORS[this.job.status] || JobList.STATUS_COLORS['default'];
|
2019-09-02 13:25:30 +00:00
|
|
|
statusElement = document.getElementById("status");
|
|
|
|
statusElement.classList.add(statusColor);
|
|
|
|
statusElement.innerHTML = this.job.status;
|
|
|
|
titleElement = document.getElementById("title");
|
|
|
|
titleElement.innerHTML = this.job.title;
|
|
|
|
|
2019-10-23 06:35:15 +00:00
|
|
|
var downloadIconElement, fileElement, filesElement, input, inputDownloadElement, inputElement, result, resultDownloadElement, resultsElement;
|
|
|
|
|
|
|
|
filesElement = document.getElementById("files");
|
|
|
|
downloadIconElement = document.createElement("i");
|
|
|
|
downloadIconElement.classList.add("material-icons", "left");
|
|
|
|
downloadIconElement.innerText = "file_download";
|
|
|
|
for (input of this.job.inputs) {
|
|
|
|
fileElement = document.createElement("tr");
|
|
|
|
inputDownloadElement = document.createElement("a");
|
|
|
|
inputDownloadElement.classList.add("waves-effect", "waves-light", "btn-small");
|
|
|
|
inputDownloadElement.href = `/jobs/${this.job.id}/download?file=${input.filename}`;
|
|
|
|
inputDownloadElement.innerText = input.filename;
|
|
|
|
inputDownloadElement.appendChild(downloadIconElement.cloneNode(true));
|
|
|
|
inputElement = document.createElement("td");
|
|
|
|
inputElement.id = `input-${input.id}`;
|
|
|
|
inputElement.appendChild(inputDownloadElement);
|
|
|
|
resultsElement = document.createElement("td");
|
|
|
|
resultsElement.id = `results-${input.id}`;
|
|
|
|
// add_results(input);
|
|
|
|
for (result of input.results) {
|
|
|
|
resultDownloadElement = document.createElement("a");
|
|
|
|
resultDownloadElement.classList.add("waves-effect", "waves-light", "btn-small");
|
|
|
|
resultDownloadElement.href = `/jobs/${this.job.id}/download?file=output/${input.filename}/${result.filename}`;
|
|
|
|
resultDownloadElement.innerText = result.filename.split(".").slice(-1)[0];
|
|
|
|
resultDownloadElement.appendChild(downloadIconElement.cloneNode(true));
|
|
|
|
resultsElement.appendChild(resultDownloadElement);
|
|
|
|
}
|
|
|
|
fileElement.appendChild(inputElement);
|
|
|
|
fileElement.appendChild(resultsElement);
|
|
|
|
filesElement.appendChild(fileElement);
|
|
|
|
}
|
|
|
|
|
2019-09-02 13:25:30 +00:00
|
|
|
M.updateTextFields();
|
|
|
|
}
|
|
|
|
|
|
|
|
_update(patch) {
|
|
|
|
var newStatusColor, operation, pathArray, status, statusColor,
|
|
|
|
updatedElement;
|
|
|
|
|
|
|
|
for (operation of patch) {
|
|
|
|
/* "/jobId/valueName" -> ["jobId", "valueName"] */
|
|
|
|
pathArray = operation.path.split("/").slice(1);
|
2019-10-23 06:35:15 +00:00
|
|
|
console.log(operation);
|
|
|
|
console.log(pathArray);
|
2019-09-02 13:25:30 +00:00
|
|
|
if (pathArray[0] != this.jobId) {continue;}
|
|
|
|
switch(operation.op) {
|
2019-10-23 06:35:15 +00:00
|
|
|
case "add":
|
|
|
|
switch(pathArray[1]) {
|
|
|
|
case "input":
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2019-09-02 13:25:30 +00:00
|
|
|
case "delete":
|
|
|
|
location.reload();
|
|
|
|
break;
|
|
|
|
case "replace":
|
|
|
|
switch(pathArray[1]) {
|
|
|
|
case "description":
|
|
|
|
updatedElement = document.getElementById("description");
|
|
|
|
updatedElement.innerHTML = operation.value;
|
|
|
|
break;
|
|
|
|
case "end_date":
|
|
|
|
updatedElement = document.getElementById("end-date");
|
2019-09-10 11:40:26 +00:00
|
|
|
updatedElement.value = (new Date(operation.value * 1000)).toLocaleString();
|
2019-09-02 13:25:30 +00:00
|
|
|
M.updateTextFields();
|
|
|
|
break;
|
|
|
|
case "status":
|
2019-09-03 07:07:09 +00:00
|
|
|
if (operation.value == "complete") {
|
|
|
|
location.reload();
|
|
|
|
}
|
2019-09-02 13:25:30 +00:00
|
|
|
updatedElement = document.getElementById("status");
|
|
|
|
status = updatedElement.innerHTML;
|
2019-09-03 07:07:09 +00:00
|
|
|
statusColor = JobList.STATUS_COLORS[status]
|
2019-09-04 12:01:20 +00:00
|
|
|
|| JobList.STATUS_COLORS['default'];
|
2019-09-03 07:07:09 +00:00
|
|
|
newStatusColor = JobList.STATUS_COLORS[operation.value]
|
2019-09-04 12:01:20 +00:00
|
|
|
|| JobList.STATUS_COLORS['default'];
|
2019-09-02 13:25:30 +00:00
|
|
|
updatedElement.classList.remove(statusColor);
|
|
|
|
updatedElement.classList.add(newStatusColor);
|
|
|
|
updatedElement.innerHTML = operation.value;
|
|
|
|
Animations.pulse(updatedElement, 3000);
|
|
|
|
break;
|
|
|
|
case "title":
|
|
|
|
updatedElement = document.getElementById("title");
|
|
|
|
updatedElement.innerHTML = operation.value;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var informationUpdater = new InformationUpdater(JOB_ID);
|
|
|
|
</script>
|
|
|
|
|
2019-08-09 09:49:09 +00:00
|
|
|
<div class="col s12 m4">
|
2019-09-02 13:25:30 +00:00
|
|
|
<h3 id="title"></h3>
|
|
|
|
<p id="description"></p>
|
|
|
|
<a class="waves-effect waves-light btn" id="status"></a>
|
2019-09-11 12:51:59 +00:00
|
|
|
<h2>Actions:</h2>
|
2019-09-16 12:09:07 +00:00
|
|
|
<!-- Confirm deletion of job with modal dialogue
|
2019-09-11 12:51:59 +00:00
|
|
|
Modal Trigger-->
|
|
|
|
<a href="#modal-confirm-delete" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete Job</a>
|
2019-09-27 11:56:52 +00:00
|
|
|
<a href="#" class="waves-effect waves-light btn"><i class="material-icons left">settings</i>Export Parameters</a>
|
2019-09-11 12:51:59 +00:00
|
|
|
<!-- Modal Strucutre -->
|
|
|
|
<div id="modal-confirm-delete" class="modal">
|
|
|
|
<div class="modal-content">
|
|
|
|
<h4>Confirm deletion</h4>
|
2019-09-16 12:09:07 +00:00
|
|
|
<p>Do you really want to delete the job {{job.title}}?
|
|
|
|
All iput and output files will be permanently deleted.</p>
|
2019-09-11 12:51:59 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2019-09-24 14:21:22 +00:00
|
|
|
<a href="{{ url_for('main.delete_job', job_id=job.id) }}" class="modal-close waves-effect waves-green btn red"><i class="material-icons left">delete</i>Delete Job</a>
|
|
|
|
<a href="#!" class="modal-close waves-effect waves-green btn cancel">Cancel</a>
|
2019-09-11 12:51:59 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-08-09 09:49:09 +00:00
|
|
|
</div>
|
|
|
|
|
2019-09-11 12:51:59 +00:00
|
|
|
|
2019-08-09 09:49:09 +00:00
|
|
|
<div class="col s12 m8">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-content">
|
2019-08-09 13:59:53 +00:00
|
|
|
<span class="card-title">Chronometrics</span>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col s12 m6">
|
|
|
|
<div class="input-field">
|
2019-09-02 13:25:30 +00:00
|
|
|
<input disabled value="" id="creation-date" type="text" class="validate">
|
2019-08-09 13:59:53 +00:00
|
|
|
<label for="creation-date">Creation date</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col s12 m6">
|
|
|
|
<div class="input-field">
|
2019-09-02 13:25:30 +00:00
|
|
|
<input disabled value="" id="end-date" type="text" class="validate">
|
2019-08-09 13:59:53 +00:00
|
|
|
<label for="end-date">End date</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-09-03 07:07:09 +00:00
|
|
|
|
2019-08-09 13:59:53 +00:00
|
|
|
<span class="card-title">Ressource allocations</span>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col s12 m6">
|
|
|
|
<div class="input-field">
|
2019-09-02 13:25:30 +00:00
|
|
|
<input disabled value="" id="mem-mb" type="text" class="validate">
|
2019-08-09 13:59:53 +00:00
|
|
|
<label for="mem-mb">Memory</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col s12 m6">
|
|
|
|
<div class="input-field">
|
2019-09-02 13:25:30 +00:00
|
|
|
<input disabled value="" id="n-cores" type="text" class="validate">
|
2019-08-09 13:59:53 +00:00
|
|
|
<label for="n-cores">CPU cores</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-09-03 07:07:09 +00:00
|
|
|
|
2019-08-09 13:59:53 +00:00
|
|
|
<span class="card-title">Service informations</span>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col s12 m4">
|
|
|
|
<div class="input-field">
|
2019-09-02 13:25:30 +00:00
|
|
|
<input disabled value="" id="service" type="text" class="validate">
|
2019-08-09 13:59:53 +00:00
|
|
|
<label for="service">Service</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col s12 m4">
|
|
|
|
<div class="input-field">
|
2019-09-02 13:25:30 +00:00
|
|
|
<input disabled value="" id="service-args" type="text" class="validate">
|
2019-08-09 13:59:53 +00:00
|
|
|
<label for="service-args">Service arguments</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col s12 m4">
|
|
|
|
<div class="input-field">
|
2019-09-02 13:25:30 +00:00
|
|
|
<input disabled value="" id="service-version" type="text" class="validate">
|
2019-08-09 13:59:53 +00:00
|
|
|
<label for="service-version">Service version</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-09-03 07:07:09 +00:00
|
|
|
|
2019-09-04 14:00:14 +00:00
|
|
|
<span class="card-title">Files</span>
|
2019-10-22 11:06:57 +00:00
|
|
|
<div style="overflow-x:auto;">
|
|
|
|
<table class="highlight">
|
2019-10-23 06:35:15 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2019-10-22 11:06:57 +00:00
|
|
|
<th style="width: 25%;">Inputs</th>
|
|
|
|
<th style="width: 25%;"></th>
|
|
|
|
<th style="width: 25%;">Results</th>
|
|
|
|
<th style="width: 25%;"></th>
|
2019-10-23 06:35:15 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody id="files"></tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<span class="card-title">Files old</span>
|
2019-09-04 12:53:23 +00:00
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2019-09-04 14:00:14 +00:00
|
|
|
<th style="width: 50%;">Inputs</th>
|
|
|
|
<th style="width: 50%;">Results</th>
|
2019-09-04 12:53:23 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for file in files %}
|
2019-10-22 11:06:57 +00:00
|
|
|
<tr>
|
|
|
|
<td rowspan="4">
|
|
|
|
{{ file }}
|
|
|
|
</td>
|
|
|
|
<td rowspan="4">
|
|
|
|
<a href="{{ url_for('main.job_download', job_id=job.id, file=files[file]['path']) }}" class="waves-effect waves-light btn-small"><i class="material-icons left">file_download</i>Download</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2019-10-22 13:28:54 +00:00
|
|
|
{% if files[file]['results'] %}
|
2019-10-22 11:06:57 +00:00
|
|
|
{% for result in files[file]['results'] %}
|
2019-09-04 12:53:23 +00:00
|
|
|
<tr>
|
|
|
|
<td>
|
2019-10-22 11:06:57 +00:00
|
|
|
{{ result }}
|
2019-09-04 12:53:23 +00:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{% if job.status == 'complete' %}
|
2019-10-22 11:06:57 +00:00
|
|
|
<a href="{{ url_for('main.job_download', job_id=job.id, file=files[file]['results'][result]['path']) }}" class="waves-effect waves-light btn-small"><i class="material-icons left">file_download</i>Download</a>
|
2019-09-04 12:53:23 +00:00
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
</tr>
|
2019-10-22 13:28:54 +00:00
|
|
|
{% if result == 'vrt' %}
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
</tr>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
{% for step in range(1, 4) %}
|
|
|
|
<tr>
|
|
|
|
<td>processing...</td>
|
|
|
|
<td></td>
|
|
|
|
</tr>
|
2019-09-04 12:53:23 +00:00
|
|
|
{% endfor %}
|
2019-10-22 13:28:54 +00:00
|
|
|
{% endif %}
|
2019-09-04 12:53:23 +00:00
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2019-10-22 11:06:57 +00:00
|
|
|
</div>
|
2019-09-04 12:53:23 +00:00
|
|
|
</div>
|
2019-08-09 09:49:09 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% endblock %}
|