Skip to content

Commit

Permalink
Show errors on polling page, closes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Apr 9, 2024
1 parent b450972 commit 53bfb09
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion datasette_extract/templates/extract_progress.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,19 @@ <h1>Extract progress</h1>
if (data && data.items && data.items.length) {
outputElement.textContent = JSON.stringify(data.items, null, 2);
}
let finishMessage = 'Extraction complete!';
if (data && data.error) {
outputElement.textContent = `Error: ${data.error}`;
outputElement.style.color = "red";
finishMessage = 'Extraction failed';
}
if (data.done) {
clearInterval(pollInterval);
const loadingSpinner = document.getElementById("loadingSpinner");
loadingSpinner.parentNode.removeChild(loadingSpinner);
const doneMessage = document.createElement("p");
doneMessage.style.fontWeight = "bold";
doneMessage.textContent = "Extraction complete!";
doneMessage.textContent = finishMessage;
outputElement.parentNode.appendChild(doneMessage);
}
}
Expand Down

0 comments on commit 53bfb09

Please sign in to comment.