Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development

This commit is contained in:
Stephan Porada 2019-11-04 13:19:20 +01:00
commit ce39b24937
3 changed files with 28 additions and 6 deletions

View File

@ -20,10 +20,11 @@ def job(job_id):
@jobs.route('/<int:job_id>/delete')
@login_required
def delete_job(job_id):
delete_thread = threading.Thread(
target=background_delete_job,
args=(current_app._get_current_object(), job_id)
)
job = Job.query.get_or_404(job_id)
if not (job.creator == current_user or current_user.is_administrator()):
abort(403)
delete_thread = threading.Thread(target=background_delete_job,
args=(current_app, job_id))
delete_thread.start()
flash('Job has been deleted!')
return redirect(url_for('main.dashboard'))

View File

@ -55,7 +55,7 @@
<td class="right-align">
<a class="waves-effect waves-light btn-small" href="{{ url_for('corpora.edit_corpus_file', corpus_file_id=file.id, corpus_id=corpus.id) }}"><i class="material-icons">edit</i></a>
<a class="waves-effect waves-light btn-small" href="{{ url_for('corpora.download_corpus_file', corpus_file_id=file.id, corpus_id=corpus.id) }}"><i class="material-icons">file_download</i></a>
<a class="waves-effect waves-light btn-small red" href="{{ url_for('corpora.delete_corpus_file', corpus_file_id=file.id, corpus_id=corpus.id) }}"><i class="material-icons">delete</i></a>
<a data-target="delete-corpus-file-{{ file.id }}-modal" class="waves-effect waves-light btn-small red modal-trigger"><i class="material-icons">delete</i></a>
</td>
</tr>
{% endfor %}
@ -79,4 +79,17 @@
<a href="{{ url_for('corpora.delete_corpus', corpus_id=corpus.id) }}" class="modal-close waves-effect waves-green btn red">Confirm<i class="material-icons right">send</i></a>
</div>
</div>
{% for file in corpus.files %}
<div id="delete-corpus-file-{{ file.id }}-modal" class="modal">
<div class="modal-content">
<h4>Confirm corpus file deletion</h4>
<p>Do you really want to delete the corpus file {{ file.filename }}? The file will be permanently deleted!</p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-close waves-effect waves-green btn cancel">Cancel</a>
<a class="modal-close waves-effect waves-green btn red" href="{{ url_for('corpora.delete_corpus_file', corpus_file_id=file.id, corpus_id=corpus.id) }}">Confirm<i class="material-icons right">send</i></a>
</div>
</div>
{% endfor %}
{% endblock %}

View File

@ -31,6 +31,8 @@
this.job = jobs[this.jobId];
}
// End date
this.setEndDate(this.job.end_date);
// Status
this.setStatus(this.job.status);
// End date
@ -73,7 +75,13 @@
}
setEndDate(timestamp) {
document.getElementById("end-date").value = new Date(timestamp * 1000).toLocaleString();
var end_date;
if (timestamp === null) {
end_date = "N.a.";
} else {
end_date = new Date(timestamp * 1000).toLocaleString();
}
document.getElementById("end-date").value = end_date;
M.updateTextFields();
}