diff --git a/app/static/js/opaque.js b/app/static/js/opaque.js index 9d9b8ac9..03964c02 100644 --- a/app/static/js/opaque.js +++ b/app/static/js/opaque.js @@ -10,14 +10,18 @@ function sendNewJobFormData(newJobFormElement, progressModalElement, request) { progressModal.options.dismissible = false; progressModalElement.querySelector(".title").innerHTML = newJobFormElement.title.value; request.upload.addEventListener("progress", function(event) { - progressModalElement.querySelector(".loaded").innerHTML = event.loaded.toString(); - progressModalElement.querySelector(".total").innerHTML = event.total.toString(); - progressModalElement.querySelector(".determinate").style.width = ((event.loaded / event.total) * 100).toString() + "%"; + progressInPercent = Math.floor(100 * event.loaded / event.total).toString() + "%"; + progressModalElement.querySelector(".progress-in-percent").innerHTML = progressInPercent; + progressModalElement.querySelector(".determinate").style.width = progressInPercent; }); request.addEventListener("load", function(event) { newJobFormElement.reset(); location.reload(); }); + request.addEventListener("abort", function(event) { + progressModalElement.querySelector(".progress-in-percent").innerHTML = "0%"; + progressModalElement.querySelector(".determinate").style.width = "0%"; + }); progressModal.open(); request.open("POST", window.location.href); diff --git a/app/templates/services/nlp.html.j2 b/app/templates/services/nlp.html.j2 index 8fcf30aa..6502df7c 100644 --- a/app/templates/services/nlp.html.j2 +++ b/app/templates/services/nlp.html.j2 @@ -124,11 +124,11 @@