diff --git a/src/js/controller.js b/src/js/controller.js index 327d220..9ae4bd6 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -136,10 +136,7 @@ function submitAnalysis(e) { document.querySelector("#output").id = "page"; //Create loading bars with blank analysis - fileQueue.forEach(file => { - let id = generateID(file); - createLoader(id, file); - }); + createLoaders(fileQueue); analysisInProgress = true; analyse(); @@ -413,6 +410,55 @@ function updateGroup(id, fullFilename, success, folder) { }); } +function createLoaders(fileQueue) { + var progressList = []; + for (let i = 0; i < fileQueue.length; i++) { + let id = generateID(fileQueue[i]); + progressList.push([ + "
" + getFilename(fileQueue[i]) + "
", + "
???
", + "
0%
" + ]); + + if (i % 1000 == 0) { + var row1 = ""; + var row2 = ""; + var row3 = ""; + + progressList.forEach(item => { + row1 += item[0]; + row2 += item[1]; + row3 += item[2]; + }); + progressList = []; + + document.querySelector("#filename").innerHTML += row1; + document.querySelector("#filename-analysis").innerHTML += row2; + document.querySelector("#filename-loader").innerHTML += row3; + } + } + + //Final push to html + var row1 = ""; + var row2 = ""; + var row3 = ""; + + progressList.forEach(item => { + row1 += item[0]; + row2 += item[1]; + row3 += item[2]; + }); + progressList = []; + + document.querySelector("#filename").innerHTML += row1; + document.querySelector("#filename-analysis").innerHTML += row2; + document.querySelector("#filename-loader").innerHTML += row3; +} + /** * Creates the loading details for each of the files * @param {string} id ID of the file