Skip to content
Snippets Groups Projects
Commit ce39b249 authored by Stephan Porada's avatar Stephan Porada :speech_balloon:
Browse files

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

parents 9c611afd 093f3bfe
No related branches found
No related tags found
No related merge requests found
...@@ -20,10 +20,11 @@ def job(job_id): ...@@ -20,10 +20,11 @@ def job(job_id):
@jobs.route('/<int:job_id>/delete') @jobs.route('/<int:job_id>/delete')
@login_required @login_required
def delete_job(job_id): def delete_job(job_id):
delete_thread = threading.Thread( job = Job.query.get_or_404(job_id)
target=background_delete_job, if not (job.creator == current_user or current_user.is_administrator()):
args=(current_app._get_current_object(), job_id) abort(403)
) delete_thread = threading.Thread(target=background_delete_job,
args=(current_app, job_id))
delete_thread.start() delete_thread.start()
flash('Job has been deleted!') flash('Job has been deleted!')
return redirect(url_for('main.dashboard')) return redirect(url_for('main.dashboard'))
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<td class="right-align"> <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.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" 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> </td>
</tr> </tr>
{% endfor %} {% endfor %}
...@@ -79,4 +79,17 @@ ...@@ -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> <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>
</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 %} {% endblock %}
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
this.job = jobs[this.jobId]; this.job = jobs[this.jobId];
} }
// End date
this.setEndDate(this.job.end_date);
// Status // Status
this.setStatus(this.job.status); this.setStatus(this.job.status);
// End date // End date
...@@ -73,7 +75,13 @@ ...@@ -73,7 +75,13 @@
} }
setEndDate(timestamp) { 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(); M.updateTextFields();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment