diff --git a/excalibur/www/static/js/job.js b/excalibur/www/static/js/job.js index 2ce29d2..0e391df 100644 --- a/excalibur/www/static/js/job.js +++ b/excalibur/www/static/js/job.js @@ -1,4 +1,25 @@ +const pollUntilServerIsReady = function () { + window.setInterval(() => { + const httpRequest = new XMLHttpRequest(); + httpRequest.onloadend = () => { + if (httpRequest.status < 300) { + if(httpRequest.responseText.indexOf('__please-wait-symbol__') == -1) { + window.location.reload(true); + } + } + }; + + httpRequest.open("GET", window.location); + httpRequest.send(); + }, 500); +}; + $(document).ready(function () { + + if(document.getElementById('__please-wait-symbol__') != null) { + pollUntilServerIsReady(); + } + var loc = window.location.pathname.split('/'); $('#download').click(function () { diff --git a/excalibur/www/static/js/workspace.js b/excalibur/www/static/js/workspace.js index 88c30f9..c023ae1 100644 --- a/excalibur/www/static/js/workspace.js +++ b/excalibur/www/static/js/workspace.js @@ -14,6 +14,22 @@ const compare = function (a, b) { return a - b; } +const pollUntilServerIsReady = function () { + window.setInterval(() => { + const httpRequest = new XMLHttpRequest(); + httpRequest.onloadend = () => { + if (httpRequest.status < 300) { + if(httpRequest.responseText.indexOf('__please-wait-symbol__') == -1) { + window.location.reload(true); + } + } + }; + + httpRequest.open("GET", window.location); + httpRequest.send(); + }, 500); +}; + const getTableAreasForRender = function (page, detectedAreas) { const imageWidth = $('#image-{0}'.format(page)).width(); const imageHeight = $('#image-{0}'.format(page)).height(); @@ -332,6 +348,10 @@ const debugQtyAreas = function (event, id, areas) { }; $(document).ready(function () { + if(document.getElementById('__please-wait-symbol__') != null) { + pollUntilServerIsReady(); + } + $('.image-area').selectAreas({ onChanged: debugQtyAreas }); diff --git a/excalibur/www/templates/job.html b/excalibur/www/templates/job.html index 7e0611e..279cca9 100644 --- a/excalibur/www/templates/job.html +++ b/excalibur/www/templates/job.html @@ -62,11 +62,11 @@
Please wait while the tables are extracted.
+Please wait while the pages are converted to images.
+