Add progress bar for parsing data.

pull/12111/head
Andriy Dzikh 2021-08-03 14:51:52 -07:00
parent 37d7ff3eff
commit 4e0478eb97
1 changed files with 11 additions and 0 deletions

View File

@ -103,9 +103,20 @@ async function loadTestData() {
throw `Fetched CSV data contains wrong number of fields. Expected: 9. Actual Header: "${header}"`;
}
progressBarPrompt.textContent = "Parsing data...";
progressBar.setAttribute("max", lines.length);
const testData = [];
let lineData = ["", "", "", "", "", "", "", "", ""];
for (let i = 1; i < lines.length; i++) {
if (i % 30000 === 0) {
await new Promise(resolve => {
setTimeout(() => {
progressBar.setAttribute("value", i);
resolve();
});
});
}
const line = lines[i];
let splitLine = line.split(",");
if (splitLine.length != 9) {